linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	amd-gfx@lists.freedesktop.org,
	Christian Koenig <christian.koenig@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	David Zhou <David1.Zhou@amd.com>, Huang Rui <ray.huang@amd.com>,
	Junwei Zhang <Jerry.Zhang@amd.com>,
	Michel Daenzer <michel.daenzer@amd.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Sean Paul <sean@poorly.run>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [RFC PATCH] drm: disable WC optimization for cache coherent devices on non-x86
Date: Mon, 21 Jan 2019 08:22:38 -0800	[thread overview]
Message-ID: <20190121162238.GA17651@infradead.org> (raw)
In-Reply-To: <CAKv+Gu8LzS9OgvVnzUT8BZWVgDmx4OfqNiPSf+8=riY_LByN-g@mail.gmail.com>

On Mon, Jan 21, 2019 at 05:14:37PM +0100, Ard Biesheuvel wrote:
> > I'll add big fat comments.  But the fact that nothing is exported
> > there should be a fairly big hint.
> >
> 
> I don't follow. How do other header files 'export' things in a way
> that this header doesn't?

Well, I'll add comments to make it more obvious..

> As far as I can tell, these drivers allocate DMA'able memory [in
> ttm_tt_populate()] and subsequently create their own CPU mappings for
> it, assuming that
> a) the default is cache coherent, so vmap()ing those pages with
> cacheable attributes works, and

Yikes.  vmaping with different attributes is generally prone to
create problems on a lot of architectures.

> b) telling the GPU to use NoSnoop attributes makes the accesses it
> performs coherent with non-cacheable CPU mappings of those physical
> pages
> 
> Since the latter is not true for many arm64 systems, I need this patch
> to get a working system.

Do we know that this actually works anywhere but x86?

In general I would call these above sequence rather bogus and would
prefer we could get rid of such antipatterns in the kernel and just use
dma_alloc_attrs with DMA_ATTR_WRITECOMBINE if we want writecombine
semantics.

Until that happens we should just change the driver ifdefs to default
the hacks to off and only enable them on setups where we 100%
positively know that they actually work.  And document that fact
in big fat comments.

  reply	other threads:[~2019-01-21 16:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 10:06 [RFC PATCH] drm: disable WC optimization for cache coherent devices on non-x86 Ard Biesheuvel
2019-01-21 10:11 ` Koenig, Christian
2019-01-21 15:07 ` Christoph Hellwig
2019-01-21 15:33   ` Ard Biesheuvel
2019-01-21 15:59     ` Christoph Hellwig
2019-01-21 16:14       ` Ard Biesheuvel
2019-01-21 16:22         ` Christoph Hellwig [this message]
2019-01-21 16:30           ` Ard Biesheuvel
2019-01-21 16:35             ` Christoph Hellwig
2019-01-21 16:50               ` Ard Biesheuvel
2019-01-21 17:55             ` Michel Dänzer
2019-01-21 17:59               ` Ard Biesheuvel
2019-01-21 18:04                 ` Michel Dänzer
2019-01-21 18:20                   ` Ard Biesheuvel
2019-01-21 18:23                     ` Michel Dänzer
2019-01-21 18:28                       ` Ard Biesheuvel
2019-01-21 19:04                         ` Michel Dänzer
2019-01-21 19:18                           ` Ard Biesheuvel
2019-01-22  8:38                           ` Ard Biesheuvel
2019-01-22 20:56                             ` Alex Deucher
2019-01-22 21:07                               ` Ard Biesheuvel
2019-01-23  7:15                                 ` Christoph Hellwig
2019-01-23  9:08                                   ` Ard Biesheuvel
2019-01-23 16:44                                     ` Christoph Hellwig
2019-01-23 16:52                                       ` Ard Biesheuvel
2019-01-24  9:13                                         ` Christoph Hellwig
2019-01-24  9:25                                           ` Koenig, Christian
2019-01-24  9:28                                             ` Ard Biesheuvel
2019-01-24  9:45                                               ` Koenig, Christian
2019-01-24  9:59                                                 ` Ard Biesheuvel
2019-01-24 11:23                                                   ` Koenig, Christian
2019-01-24 11:26                                                     ` Ard Biesheuvel
2019-01-24 11:37                                                       ` Koenig, Christian
2019-01-24 11:45                                                         ` Ard Biesheuvel
2019-01-24 13:54                                                           ` Alex Deucher
2019-01-24 13:57                                                             ` Ard Biesheuvel
2019-01-24 14:00                                                               ` Alex Deucher
2019-01-24 16:04                                                           ` Michel Dänzer
2019-01-24  9:31                                         ` Michel Dänzer
2019-01-24  9:37                                           ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190121162238.GA17651@infradead.org \
    --to=hch@infradead.org \
    --cc=David1.Zhou@amd.com \
    --cc=Jerry.Zhang@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=michel.daenzer@amd.com \
    --cc=mpe@ellerman.id.au \
    --cc=ray.huang@amd.com \
    --cc=sean@poorly.run \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).