intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Kenneth Graunke <kenneth@whitecape.org>
To: Daniel Vetter <daniel@ffwll.ch>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>
Subject: Re: [Intel-gfx] [PATCH 3/4] drm/i915/userptr: Probe existence of backing struct pages upon creation
Date: Thu, 15 Jul 2021 11:21:02 -0700	[thread overview]
Message-ID: <2516720.Dzi6zm1QmA@mizzik> (raw)
In-Reply-To: <2098303d-5b94-d9ff-7bd4-a7ba197a7431@linux.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 2943 bytes --]

On Thursday, July 15, 2021 4:27:44 AM PDT Tvrtko Ursulin wrote:
> 
> On 15/07/2021 12:07, Daniel Vetter wrote:
> > On Thu, Jul 15, 2021 at 11:33:10AM +0100, Tvrtko Ursulin wrote:
> >>
> >> On 15/07/2021 11:15, Matthew Auld wrote:
> >>> From: Chris Wilson <chris@chris-wilson.co.uk>
> >>>
> >>> Jason Ekstrand requested a more efficient method than userptr+set-domain
> >>> to determine if the userptr object was backed by a complete set of pages
> >>> upon creation. To be more efficient than simply populating the userptr
> >>> using get_user_pages() (as done by the call to set-domain or execbuf),
> >>> we can walk the tree of vm_area_struct and check for gaps or vma not
> >>> backed by struct page (VM_PFNMAP). The question is how to handle
> >>> VM_MIXEDMAP which may be either struct page or pfn backed...
> >>>
> >>> With discrete are going to drop support for set_domain(), so offering a
> >>> way to probe the pages, without having to resort to dummy batches has
> >>> been requested.
> >>>
> >>> v2:
> >>> - add new query param for the PROPBE flag, so userspace can easily
> >>>     check if the kernel supports it(Jason).
> >>> - use mmap_read_{lock, unlock}.
> >>> - add some kernel-doc.
> >>
> >> 1)
> >>
> >> I think probing is too weak to be offered as part of the uapi. What probes
> >> successfully at create time might not be there anymore at usage time. So if
> >> the pointer is not trusted at one point, why should it be at a later stage?
> >>
> >> Only thing which works for me is populate (so get_pages) at create time. But
> >> again with no guarantees they are still there at use time clearly
> >> documented.
> > 
> > Populate is exactly as racy as probe. We don't support pinned userptr
> > anymore.
> 
> Yes, wrote so myself - "..again with no guarantees they are still there 
> at use time..".
> 
> Perhaps I don't understand what problem is probe supposed to solve. It 
> doesn't deal 1:1 with set_domain removal since that one actually did 
> get_pages so that would be populate. But fact remains regardless that if 
> userspace is given a pointer it doesn't trust, _and_ wants the check it 
> for this reason or that, then probe solves nothing. Unless there is 
> actually at minimum some protocol to reply to whoever sent the pointer 
> like "not that pointer please".

That's exactly the point.  GL_AMD_pinned_memory requires us the OpenGL
implementation to return an error for "not that pointer, please", at the
time when said pointer is supplied - not at first use.

Sure, there can be reasons why it might seem fine up front, and not work
later.  But an early check of "just no, you're doing it totally wrong"
at the right moment can be helpful for application developers.  While it
shouldn't really happen, if it ever did, it would be a lot more obvious
to debug than "much later on, when something randomly flushed the GPU
commands we were building, something went wrong, and we don't know why."

--Ken

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-07-15 18:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 10:15 [Intel-gfx] [PATCH 0/4] Some DG1 uAPI cleanup Matthew Auld
2021-07-15 10:15 ` [Intel-gfx] [PATCH 1/4] drm/i915/uapi: reject caching ioctls for discrete Matthew Auld
2021-07-15 10:15 ` [Intel-gfx] [PATCH 2/4] drm/i915/uapi: convert drm_i915_gem_userptr to kernel doc Matthew Auld
2021-07-15 12:09   ` Maarten Lankhorst
2021-07-15 10:15 ` [Intel-gfx] [PATCH 3/4] drm/i915/userptr: Probe existence of backing struct pages upon creation Matthew Auld
2021-07-15 10:33   ` Tvrtko Ursulin
2021-07-15 11:07     ` Daniel Vetter
2021-07-15 11:27       ` Tvrtko Ursulin
2021-07-15 18:21         ` Kenneth Graunke [this message]
2021-07-15 19:18           ` Jason Ekstrand
2021-07-16  8:20           ` Tvrtko Ursulin
2021-07-16 14:50           ` Daniel Vetter
2021-07-15 11:09     ` Matthew Auld
2021-07-15 11:33       ` Tvrtko Ursulin
2021-07-16 14:36   ` Tvrtko Ursulin
2021-07-21 19:18   ` Kenneth Graunke
2021-07-21 19:21   ` Kenneth Graunke
2021-07-21 20:27   ` Jason Ekstrand
2021-07-22  8:43     ` Matthew Auld
2021-07-22 13:29       ` Jason Ekstrand
2021-07-15 10:15 ` [Intel-gfx] [PATCH 4/4] drm/i915/uapi: reject set_domain for discrete Matthew Auld
2021-07-16 14:52   ` Tvrtko Ursulin
2021-07-16 15:23     ` Jason Ekstrand
2021-07-19  9:00       ` Tvrtko Ursulin
2021-07-19  9:09       ` Matthew Auld
2021-07-19 19:57         ` Jason Ekstrand
2021-07-16 19:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success for Some DG1 uAPI cleanup Patchwork
2021-07-17  1:36 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

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=2516720.Dzi6zm1QmA@mizzik \
    --to=kenneth@whitecape.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tvrtko.ursulin@linux.intel.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).