[Intel-gfx] [PATCH 1/2] drm/i915/userptr: Probe existence of backing struct pages upon creation

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 9 16:22:03 UTC 2017


Quoting Tvrtko Ursulin (2017-11-09 16:10:47)
> 
> On 08/11/2017 18:51, Chris Wilson wrote:
> > 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...
> 
> First reaction is that it sounds like a bad idea. Well maybe not bad, 
> but a bit questionable since if the userspace doesn't know, then there 
> are no guarantees the result of probe will remain valid until the time 
> to actually instantiate the backing store comes.
> 
> The populate idea from the next patch sounds okay on the other hand. So 
> is there an use case where extremely controlling userspace would benefit 
> from probe rather than just using populate?

Populate has exactly the same inconsistency as probe. Neither is
absolute and the answer may change before use. The advantage for
userspace is in the question of whether it can reject bad calls before
committing itself. For which it currently uses set-domain after userptr.

From the pov of the code, doing the populate early is a synchronous
operations, but a late populate can be done asynchronously in parallel
to the client preparing the next request.

However, since userspace already has the controls to do a populate
itself, the only real improvement here is in a cheap probe.
-Chris


More information about the Intel-gfx mailing list