[Intel-gfx] [FIXES 2/3] drm/i915/userptr: Handle unlocked gup retries

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 11 14:27:16 UTC 2019


Quoting Tvrtko Ursulin (2019-11-11 14:19:31)
> 
> On 11/11/2019 13:32, Chris Wilson wrote:
> > Enable gup to retry and fault the pages outside of the mmap_sem lock in
> > our worker. As we are inside our worker, outside of any critical path,
> > we can allow the mmap_sem lock to be dropped in order to service a page
> > fault; this in turn allows the mm to populate the page using a slow
> > fault handler.
> > 
> > Testcase: igt/gem_userptr/userfault
> 
> There are no references or explanation on what does this fix?

gup simply fails if it is not allowed to drop the lock for some faults,

__get_user_pages_locked:
                ret = __get_user_pages(tsk, mm, start, nr_pages, flags, pages,
                                       vmas, locked);
                if (!locked)
                        /* VM_FAULT_RETRY couldn't trigger, bypass */
                        return ret;

userfault being the first time I discovered this even existed. Since we
are only holding the mmap_sem for the gup (and not protecting anything
else) we can simply allow gup to drop the lock if it needs to.
-Chris


More information about the Intel-gfx mailing list