All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "DRI Development" <dri-devel@lists.freedesktop.org>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Matthew Wilcox" <willy@infradead.org>,
	"John Stultz" <john.stultz@linaro.org>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH] RFC: dma-buf: Require VM_SPECIAL vma for mmap
Date: Thu, 4 Feb 2021 12:13:39 -0400	[thread overview]
Message-ID: <20210204161339.GX4718@ziepe.ca> (raw)
In-Reply-To: <20210203211948.2529297-1-daniel.vetter@ffwll.ch>

On Wed, Feb 03, 2021 at 10:19:48PM +0100, Daniel Vetter wrote:
> tldr; DMA buffers aren't normal memory, expecting that you can use
> them like that (like calling get_user_pages works, or that they're
> accounting like any other normal memory) cannot be guaranteed.
> 
> Since some userspace only runs on integrated devices, where all
> buffers are actually all resident system memory, there's a huge
> temptation to assume that a struct page is always present and useable
> like for any more pagecache backed mmap. This has the potential to
> result in a uapi nightmare.
> 
> To stop this gap require that DMA buffer mmaps are VM_SPECIAL, which
> blocks get_user_pages and all the other struct page based
> infrastructure for everyone. In spirit this is the uapi counterpart to
> the kernel-internal CONFIG_DMABUF_DEBUG.

Fast gup needs the special flag set on the PTE as well.. Feels weird
to have a special VMA without also having special PTEs?

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Christian König" <christian.koenig@amd.com>,
	linaro-mm-sig@lists.linaro.org,
	"DRI Development" <dri-devel@lists.freedesktop.org>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] RFC: dma-buf: Require VM_SPECIAL vma for mmap
Date: Thu, 4 Feb 2021 12:13:39 -0400	[thread overview]
Message-ID: <20210204161339.GX4718@ziepe.ca> (raw)
In-Reply-To: <20210203211948.2529297-1-daniel.vetter@ffwll.ch>

On Wed, Feb 03, 2021 at 10:19:48PM +0100, Daniel Vetter wrote:
> tldr; DMA buffers aren't normal memory, expecting that you can use
> them like that (like calling get_user_pages works, or that they're
> accounting like any other normal memory) cannot be guaranteed.
> 
> Since some userspace only runs on integrated devices, where all
> buffers are actually all resident system memory, there's a huge
> temptation to assume that a struct page is always present and useable
> like for any more pagecache backed mmap. This has the potential to
> result in a uapi nightmare.
> 
> To stop this gap require that DMA buffer mmaps are VM_SPECIAL, which
> blocks get_user_pages and all the other struct page based
> infrastructure for everyone. In spirit this is the uapi counterpart to
> the kernel-internal CONFIG_DMABUF_DEBUG.

Fast gup needs the special flag set on the PTE as well.. Feels weird
to have a special VMA without also having special PTEs?

Jason
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2021-02-04 16:15 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 21:19 [PATCH] RFC: dma-buf: Require VM_SPECIAL vma for mmap Daniel Vetter
2021-02-03 21:19 ` [Intel-gfx] " Daniel Vetter
2021-02-03 21:19 ` Daniel Vetter
2021-02-04  0:27 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-02-04  0:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-02-04  4:48 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-02-04 16:13 ` Jason Gunthorpe [this message]
2021-02-04 16:13   ` [PATCH] " Jason Gunthorpe
2021-02-04 17:16   ` Daniel Vetter
2021-02-04 17:16     ` [Intel-gfx] " Daniel Vetter
2021-02-04 17:16     ` Daniel Vetter
2021-02-04 18:38     ` Jason Gunthorpe
2021-02-04 18:38       ` Jason Gunthorpe
2021-02-04 19:59       ` Daniel Vetter
2021-02-04 19:59         ` [Intel-gfx] " Daniel Vetter
2021-02-04 19:59         ` Daniel Vetter
2021-02-04 20:09         ` Jason Gunthorpe
2021-02-04 20:09           ` Jason Gunthorpe
2021-02-04 20:19           ` Daniel Vetter
2021-02-04 20:19             ` [Intel-gfx] " Daniel Vetter
2021-02-04 20:19             ` Daniel Vetter
2021-02-04 20:59             ` Jason Gunthorpe
2021-02-04 20:59               ` Jason Gunthorpe
2021-02-05  9:14               ` Daniel Vetter
2021-02-05  9:14                 ` [Intel-gfx] " Daniel Vetter
2021-02-05  9:14                 ` Daniel Vetter
2021-02-05  8:05       ` Christian König
2021-02-05  8:05         ` [Intel-gfx] " Christian König
2021-02-05  8:05         ` Christian König
2021-02-05 13:41 ` [PATCH] RFC: dma-buf: Require VM_PFNMAP " Daniel Vetter
2021-02-05 13:41   ` [Intel-gfx] " Daniel Vetter
2021-02-05 13:41   ` Daniel Vetter
2021-02-05 13:42   ` Christian König
2021-02-05 13:42     ` [Intel-gfx] " Christian König
2021-02-05 13:42     ` Christian König
2021-02-05 19:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for RFC: dma-buf: Require VM_SPECIAL vma for mmap (rev2) Patchwork
2021-02-05 19:50 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-02-06 14:22 ` [RFC] b922393a2c: WARNING:at_drivers/dma-buf/dma-buf.c:#dma_buf_mmap_internal kernel test robot
2021-02-06 14:22   ` kernel test robot
2021-02-06 14:22   ` [Intel-gfx] " kernel test robot

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=20210204161339.GX4718@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.