[PATCH v2] drm/xe: Remove unwanted mutex locking

Randhawa, Jagmeet jagmeet.randhawa at intel.com
Wed May 29 18:49:44 UTC 2024


On 5/29/2024 11:33 AM, 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.
>
> 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
>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
> Reviewed-by: Matthew Brost <matthew.brost at 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);
Reviewed-by: Jagmeet Randhawa <jagmeet.randhawa at intel.com>


More information about the Intel-xe mailing list