Skip to contentSkip to conversation

drm/amdgpu: reserve the pd while cleaning up PRTs

PATCH In review Christian König 2 participants 2 messages Feb 7, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: reserve the pd while cleaning up PRTs

We want to have lockdep annotation here, so make sure that we reserve the PD while removing PRTs even if it isn't strictly necessary since the VM object is about to be destroyed anyway.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -2
index efd13898c83e..9f985bd463be 100644
@@ -1194,8 +1194,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 	if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_VCE) != NULL)
 		amdgpu_vce_free_handles(adev, file_priv);
 
-	amdgpu_vm_bo_del(adev, fpriv->prt_va);
-
 	if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
 		/* TODO: how to handle reserve failure */
 		BUG_ON(amdgpu_bo_reserve(adev->virt.csa_obj, true));
@@ -1206,6 +1204,10 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 
 	pasid = fpriv->vm.pasid;
 	pd = amdgpu_bo_ref(fpriv->vm.root.bo);
+	if (!WARN_ON(amdgpu_bo_reserve(pd, true))) {
+		amdgpu_vm_bo_del(adev, fpriv->prt_va);
+		amdgpu_bo_unreserve(pd);
+	}
 
 	amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
 	amdgpu_vm_fini(adev, &fpriv->vm);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Am 2022-02-07 um 03:07 schrieb Christian König:

Quoted 5 lines

We want to have lockdep annotation here, so make sure that we reserve the PD while removing PRTs even if it isn't strictly necessary since the VM object is about to be destroyed anyway.

Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -2
index efd13898c83e..9f985bd463be 100644
@@ -1194,8 +1194,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
  	if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_VCE) != NULL)
  		amdgpu_vce_free_handles(adev, file_priv);
 
-	amdgpu_vm_bo_del(adev, fpriv->prt_va);
-
  	if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
  		/* TODO: how to handle reserve failure */
  		BUG_ON(amdgpu_bo_reserve(adev->virt.csa_obj, true));
@@ -1206,6 +1204,10 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 
  	pasid = fpriv->vm.pasid;
  	pd = amdgpu_bo_ref(fpriv->vm.root.bo);
+	if (!WARN_ON(amdgpu_bo_reserve(pd, true))) {
+		amdgpu_vm_bo_del(adev, fpriv->prt_va);
+		amdgpu_bo_unreserve(pd);
+	}
 
  	amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
  	amdgpu_vm_fini(adev, &fpriv->vm);