All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/amdgpu: unlock mutex on error
@ 2020-08-06  1:31 Dennis Li
  2020-08-06 19:21 ` Luben Tuikov
  0 siblings, 1 reply; 2+ messages in thread
From: Dennis Li @ 2020-08-06  1:31 UTC (permalink / raw
  To: amd-gfx, luben.tuikov; +Cc: Dennis Li

Make sure to unlock the mutex when error happen

v2:
1. correct syntax error in the commit comment
2. remove change-Id

Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Dennis Li <Dennis.Li@amd.com>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index a0ea663ecdbc..5e5369abc6fa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -632,13 +632,14 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
 	}
 
 	ret = amdgpu_ib_schedule(ring, 1, ib, job, &f);
+
+	up_read(&adev->reset_sem);
+
 	if (ret) {
 		DRM_ERROR("amdgpu: failed to schedule IB.\n");
 		goto err_ib_sched;
 	}
 
-	up_read(&adev->reset_sem);
-
 	ret = dma_fence_wait(f, false);
 
 err_ib_sched:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 4e017f379eb6..67a756f4337b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -545,7 +545,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 			}
 			ret = amdgpu_xgmi_update_topology(hive, tmp_adev);
 			if (ret)
-				goto exit;
+				goto exit_unlock;
 		}
 
 		/* get latest topology info for each device from psp */
@@ -558,7 +558,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 					tmp_adev->gmc.xgmi.node_id,
 					tmp_adev->gmc.xgmi.hive_id, ret);
 				/* To do : continue with some node failed or disable the whole hive */
-				goto exit;
+				goto exit_unlock;
 			}
 		}
 	}
@@ -566,7 +566,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 	if (!ret)
 		ret = amdgpu_xgmi_sysfs_add_dev_info(adev, hive);
 
-
+exit_unlock:
 	mutex_unlock(&hive->hive_lock);
 exit:
 	if (!ret)
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] drm/amdgpu: unlock mutex on error
  2020-08-06  1:31 [PATCH v2] drm/amdgpu: unlock mutex on error Dennis Li
@ 2020-08-06 19:21 ` Luben Tuikov
  0 siblings, 0 replies; 2+ messages in thread
From: Luben Tuikov @ 2020-08-06 19:21 UTC (permalink / raw
  To: Dennis Li, amd-gfx

Yes, that's fine. Thanks for fix.

Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>

On 2020-08-05 9:31 p.m., Dennis Li wrote:
> Make sure to unlock the mutex when error happen
> 
> v2:
> 1. correct syntax error in the commit comment
> 2. remove change-Id
> 
> Acked-by: Nirmoy Das <nirmoy.das@amd.com>
> Signed-off-by: Dennis Li <Dennis.Li@amd.com>
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index a0ea663ecdbc..5e5369abc6fa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -632,13 +632,14 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
>  	}
>  
>  	ret = amdgpu_ib_schedule(ring, 1, ib, job, &f);
> +
> +	up_read(&adev->reset_sem);
> +
>  	if (ret) {
>  		DRM_ERROR("amdgpu: failed to schedule IB.\n");
>  		goto err_ib_sched;
>  	}
>  
> -	up_read(&adev->reset_sem);
> -
>  	ret = dma_fence_wait(f, false);
>  
>  err_ib_sched:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> index 4e017f379eb6..67a756f4337b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> @@ -545,7 +545,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
>  			}
>  			ret = amdgpu_xgmi_update_topology(hive, tmp_adev);
>  			if (ret)
> -				goto exit;
> +				goto exit_unlock;
>  		}
>  
>  		/* get latest topology info for each device from psp */
> @@ -558,7 +558,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
>  					tmp_adev->gmc.xgmi.node_id,
>  					tmp_adev->gmc.xgmi.hive_id, ret);
>  				/* To do : continue with some node failed or disable the whole hive */
> -				goto exit;
> +				goto exit_unlock;
>  			}
>  		}
>  	}
> @@ -566,7 +566,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
>  	if (!ret)
>  		ret = amdgpu_xgmi_sysfs_add_dev_info(adev, hive);
>  
> -
> +exit_unlock:
>  	mutex_unlock(&hive->hive_lock);
>  exit:
>  	if (!ret)
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-06 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-06  1:31 [PATCH v2] drm/amdgpu: unlock mutex on error Dennis Li
2020-08-06 19:21 ` Luben Tuikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.