drm/xe/preempt_fence: enlarge the fence critical section
authorMatthew Auld <matthew.auld@intel.com>
Thu, 18 Apr 2024 14:46:31 +0000 (15:46 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Thu, 25 Apr 2024 15:52:34 +0000 (16:52 +0100)
commit3cd1585e57908b6efcd967465ef7685f40b2a294
treeb7d08dd2d3d9ba432851614a1a3042da17cfa5c1
parent7547a23cae4145836dbb94522453af4e7d0ccc92
drm/xe/preempt_fence: enlarge the fence critical section

It is really easy to introduce subtle deadlocks in
preempt_fence_work_func() since we operate on single global ordered-wq
for signalling our preempt fences behind the scenes, so even though we
signal a particular fence, everything in the callback should be in the
fence critical section, since blocking in the callback will prevent
other published fences from signalling. If we enlarge the fence critical
section to cover the entire callback, then lockdep should be able to
understand this better, and complain if we grab a sensitive lock like
vm->lock, which is also held when waiting on preempt fences.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240418144630.299531-2-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_preempt_fence.c