drm/xe: Deny unbinds if uapi ufence pending
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Thu, 15 Feb 2024 18:11:52 +0000 (20:11 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 28 Feb 2024 12:47:57 +0000 (13:47 +0100)
commit158900ade92cce5ab85a06d618eb51e6c7ffb28a
tree394b818fd94659fa4ac6eeda2ca55324620c2dc6
parent977e5b82e0901480bc201342d39f855fc0a2ef47
drm/xe: Deny unbinds if uapi ufence pending

If user fence was provided for MAP in vm_bind_ioctl
and it has still not been signalled, deny UNMAP of said
vma with EBUSY as long as unsignalled fence exists.

This guarantees that MAP vs UNMAP sequences won't
escape under the radar if we ever want to track the
client's state wrt to completed and accessible MAPs.
By means of intercepting the ufence release signalling.

v2: find ufence with num_fences > 1 (Matt)
v3: careful on clearing vma ufence (Matt)

Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1159
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240215181152.450082-3-mika.kuoppala@linux.intel.com
drivers/gpu/drm/xe/xe_vm.c
drivers/gpu/drm/xe/xe_vm_types.h