* [PATCH] drm/xe: Remove unwanted mutex locking
@ 2024-05-29 18:08 Niranjana Vishwanathapura
2024-05-29 18:20 ` Matthew Brost
0 siblings, 1 reply; 2+ messages in thread
From: Niranjana Vishwanathapura @ 2024-05-29 18:08 UTC (permalink / raw)
To: intel-xe
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.
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
---
drivers/gpu/drm/xe/xe_device.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index f04b11e45c2d..4cca16f2d4ed 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -96,12 +96,11 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
struct xe_exec_queue *q;
unsigned long idx;
- mutex_lock(&xef->exec_queue.lock);
+ /* No locking needed here */
xa_for_each(&xef->exec_queue.xa, idx, q) {
xe_exec_queue_kill(q);
xe_exec_queue_put(q);
}
- mutex_unlock(&xef->exec_queue.lock);
xa_destroy(&xef->exec_queue.xa);
mutex_destroy(&xef->exec_queue.lock);
mutex_lock(&xef->vm.lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/xe: Remove unwanted mutex locking
2024-05-29 18:08 [PATCH] drm/xe: Remove unwanted mutex locking Niranjana Vishwanathapura
@ 2024-05-29 18:20 ` Matthew Brost
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Brost @ 2024-05-29 18:20 UTC (permalink / raw)
To: Niranjana Vishwanathapura; +Cc: intel-xe
On Wed, May 29, 2024 at 11:08:51AM -0700, Niranjana Vishwanathapura wrote:
> 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.
>
To be uniform, we should also drop the xef->vm.lock in this function
too. Can be done in a follow up.
Also mention that this lock protects the lookup plus taking a reference
which doesn't apply to this code path. Maybe also say if FD is closing,
IOCTLs presumably can't be modifying the xarray.
With an updated commit message:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
> ---
> drivers/gpu/drm/xe/xe_device.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index f04b11e45c2d..4cca16f2d4ed 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -96,12 +96,11 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
> struct xe_exec_queue *q;
> unsigned long idx;
>
> - mutex_lock(&xef->exec_queue.lock);
> + /* No locking needed here */
> xa_for_each(&xef->exec_queue.xa, idx, q) {
> xe_exec_queue_kill(q);
> xe_exec_queue_put(q);
> }
> - mutex_unlock(&xef->exec_queue.lock);
> xa_destroy(&xef->exec_queue.xa);
> mutex_destroy(&xef->exec_queue.lock);
> mutex_lock(&xef->vm.lock);
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-29 18:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29 18:08 [PATCH] drm/xe: Remove unwanted mutex locking Niranjana Vishwanathapura
2024-05-29 18:20 ` Matthew Brost
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox