drm/i915/gem: Atomically invalidate userptr on mmu-notifier
authorJonathan Cavitt <jonathan.cavitt@intel.com>
Tue, 28 Nov 2023 16:25:05 +0000 (08:25 -0800)
committerAndi Shyti <andi.shyti@linux.intel.com>
Tue, 19 Dec 2023 15:56:39 +0000 (16:56 +0100)
commit86ceaaaec59707b06216a15b3852867fa2f1574e
tree9f9c68198e3aba89790e2b9e083e2dde9f5d626b
parent31accc37eaee98a90b25809ed58c6ee4956ab642
drm/i915/gem: Atomically invalidate userptr on mmu-notifier

Never block for outstanding work on userptr object upon receipt of a
mmu-notifier. The reason we originally did so was to immediately unbind
the userptr and unpin its pages, but since that has been dropped in
commit b4b9731b02c3c ("drm/i915: Simplify userptr locking"), we never
return the pages to the system i.e. never drop our page->mapcount and so
do not allow the page and CPU PTE to be revoked. Based on this history,
we know we are safe to drop the wait entirely.

Upon return from mmu-notifier, we will still have the userptr pages
pinned preventing the following PTE operation (such as try_to_unmap)
adjusting the vm_area_struct, so it is safe to keep the pages around for
as long as we still have i/o pending.

We do not have any means currently to asynchronously revalidate the
userptr pages, that is always prior to next use.

Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231128162505.3493942-1-jonathan.cavitt@intel.com
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
drivers/gpu/drm/i915/gem/i915_gem_userptr.h [deleted file]
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c