[PATCH 1/1] drm/amdkfd: Don't take process mutex for svm ioctls

Felix Kuehling felix.kuehling at amd.com
Tue Jan 25 18:40:47 UTC 2022


Am 2022-01-25 um 13:04 schrieb Philip Yang:
> SVM ioctls take proper svms->lock to handle race conditions, don't need
> take process mutex to serialize ioctls. This also fixes circular locking
> warning:
>
> WARNING: possible circular locking dependency detected
>
>    Possible unsafe locking scenario:
>
>          CPU0                    CPU1
>          ----                    ----
>     lock((work_completion)(&svms->deferred_list_work));
>                                  lock(&process->mutex);
>                       lock((work_completion)(&svms->deferred_list_work));
>     lock(&process->mutex);
>
>     *** DEADLOCK ***
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index 337953af7c2f..70122978bdd0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -1846,13 +1846,9 @@ static int kfd_ioctl_svm(struct file *filep, struct kfd_process *p, void *data)
>   	if (!args->start_addr || !args->size)
>   		return -EINVAL;
>   
> -	mutex_lock(&p->mutex);
> -
>   	r = svm_ioctl(p, args->op, args->start_addr, args->size, args->nattr,
>   		      args->attrs);
>   
> -	mutex_unlock(&p->mutex);
> -
>   	return r;
>   }
>   #else


More information about the amd-gfx mailing list