[Intel-gfx] [PATCH] drm/i915: Fix userptr so we do not have to worry about obj->mm.lock, v8.

Daniel Vetter daniel at ffwll.ch
Thu Mar 25 10:27:27 UTC 2021


On Thu, Mar 25, 2021 at 10:55:11AM +0100, Thomas Hellström (Intel) wrote:
> 
> On 3/25/21 10:23 AM, Maarten Lankhorst wrote:
> > Instead of doing what we do currently, which will never work with
> > PROVE_LOCKING, do the same as AMD does, and something similar to
> > relocation slowpath. When all locks are dropped, we acquire the
> > pages for pinning. When the locks are taken, we transfer those
> > pages in .get_pages() to the bo. As a final check before installing
> > the fences, we ensure that the mmu notifier was not called; if it is,
> > we return -EAGAIN to userspace to signal it has to start over.
> > 
> > Changes since v1:
> > - Unbinding is done in submit_init only. submit_begin() removed.
> > - MMU_NOTFIER -> MMU_NOTIFIER
> > Changes since v2:
> > - Make i915->mm.notifier a spinlock.
> > Changes since v3:
> > - Add WARN_ON if there are any page references left, should have been 0.
> > - Return 0 on success in submit_init(), bug from spinlock conversion.
> > - Release pvec outside of notifier_lock (Thomas).
> > Changes since v4:
> > - Mention why we're clearing eb->[i + 1].vma in the code. (Thomas)
> > - Actually check all invalidations in eb_move_to_gpu. (Thomas)
> > - Do not wait when process is exiting to fix gem_ctx_persistence.userptr.
> > Changes since v5:
> > - Clarify why check on PF_EXITING is (temporarily) required.
> > Changes since v6:
> > - Ensure userptr validity is checked in set_domain through a special path.
> > Changes since v7:
> > - Chane kvfree to kvfree().
> 
> v8: Change "Chane kvfree to kvfree()" to "Change kfree() to kvfree()" ? :)

Luckily the fix I've done got that part right :-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list