]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/xe/pxp: Don't kill queues while holding PXP locks
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Tue, 25 Feb 2025 23:53:28 +0000 (15:53 -0800)
committerDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Wed, 26 Feb 2025 21:14:19 +0000 (13:14 -0800)
commita33c9699e73456d08182ad7b87a4af52ac24f779
tree490de0ad057e16fbb2e82a42354ab1c10c001b15
parente67a35bc953a873881a2a8c1ea27ede5870f5f42
drm/xe/pxp: Don't kill queues while holding PXP locks

xe_exec_queue_kill can sleep, so we can't call it from under a spinlock.
We can instead move the queues to a separate list and then kill them all
after we release the spinlock.

Furthermore, xe_exec_queue_kill can take the VM lock so we can't call it
while holding the PXP mutex because the mutex is taken under VM lock at
queue creation time. Note that while it is safe to call the kill without
holding the mutex, we must call it after the PXP state has been updated,
otherwise an app might be able to create a queue between the
invalidation and the state update, which would break the state machine.

Since being in the list is used to track whether RPM cleanup is needed,
we can no longer defer that to queue_destroy, so we perform it
immediately instead.

v2: also avoid calling kill() under pxp->mutex.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/intel-xe/34aaced9-4a9d-4e8c-900a-b8f73452e35c@stanley.mountain/
Fixes: f8caa80154c4 ("drm/xe/pxp: Add PXP queue tracking and session start")
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250225235328.2895877-1-daniele.ceraolospurio@intel.com
drivers/gpu/drm/xe/xe_pxp.c