Skip to content

Commit 0568a40

Browse files
nvishwa1mbrost05
authored andcommitted
drm/xe: Remove unwanted mutex locking
Do not hold xef->exec_queue.lock mutex while parsing the xarray xef->exec_queue.xa in xe_file_close() as it is not needed and will cause an unwanted dependency between this lock and the vm->lock. This lock protects the exec queue lookup and reference taking which doesn't apply to this code path. When FD is closing, IOCTLs presumably can't be modifying the xarray. v2: Update commit text (Matt Brost) v3: Add more code comment (Rodrigo Vivi) v4: Further expand code comment (Rodirgo Vivi) Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Jagmeet Randhawa <jagmeet.randhawa@intel.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240529221639.23117-1-niranjana.vishwanathapura@intel.com
1 parent 37ea1ae commit 0568a40

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/xe/xe_device.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,16 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
9595
struct xe_exec_queue *q;
9696
unsigned long idx;
9797

98-
mutex_lock(&xef->exec_queue.lock);
98+
/*
99+
* No need for exec_queue.lock here as there is no contention for it
100+
* when FD is closing as IOCTLs presumably can't be modifying the
101+
* xarray. Taking exec_queue.lock here causes undue dependency on
102+
* vm->lock taken during xe_exec_queue_kill().
103+
*/
99104
xa_for_each(&xef->exec_queue.xa, idx, q) {
100105
xe_exec_queue_kill(q);
101106
xe_exec_queue_put(q);
102107
}
103-
mutex_unlock(&xef->exec_queue.lock);
104108
xa_destroy(&xef->exec_queue.xa);
105109
mutex_destroy(&xef->exec_queue.lock);
106110
mutex_lock(&xef->vm.lock);

0 commit comments

Comments
 (0)