Skip to contentSkip to conversation

drm/amdgpu: Fix vram recover doesn't work after whole GPU reset

PATCH In review Lin.Cao 3 participants 3 messages May 5, 2023

Subsystems (2)
lore
Share & tools
lore

Lin.Cao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix vram recover doesn't work after whole GPU reset

v1: Vmbo->shadow is used to back vram bo up when vram lost. So that we should set shadow as vmbo->shadow to recover vmbo->bo
v2: Modify if(vmbo->shadow) shadow = vmbo->shadow as if(!vmbo->shadow) continue;

Fix: 'commit e18aaea733da ("drm/amdgpu: move shadow_list to amdgpu_bo_vm")'

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -1
index 750eaffa81ba..0581b4fec001 100644
@@ -4514,7 +4514,12 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 	dev_info(adev->dev, "recover vram bo from shadow start\n");
 	mutex_lock(&adev->shadow_list_lock);
 	list_for_each_entry(vmbo, &adev->shadow_list, shadow_list) {
-		shadow = &vmbo->bo;
+
+		/* If vm is compute context or adev is APU, shadow will be NULL */
+		if (!vmbo->shadow)
+			continue;
+		shadow = vmbo->shadow;
+
 		/* No need to recover an evicted BO */
 		if (shadow->tbo.resource->mem_type != TTM_PL_TT ||
 		    shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Am 05.05.23 um 05:46 schrieb Lin.Cao:

Quoted 7 lines

v1: Vmbo->shadow is used to back vram bo up when vram lost. So that we should set shadow as vmbo->shadow to recover vmbo->bo
v2: Modify if(vmbo->shadow) shadow = vmbo->shadow as if(!vmbo->shadow) continue;

Fix: 'commit e18aaea733da ("drm/amdgpu: move shadow_list to amdgpu_bo_vm")'

Quoted 22 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -1
index 750eaffa81ba..0581b4fec001 100644
@@ -4514,7 +4514,12 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
  	dev_info(adev->dev, "recover vram bo from shadow start\n");
  	mutex_lock(&adev->shadow_list_lock);
  	list_for_each_entry(vmbo, &adev->shadow_list, shadow_list) {
-		shadow = &vmbo->bo;
+
+		/* If vm is compute context or adev is APU, shadow will be NULL */
+		if (!vmbo->shadow)
+			continue;
+		shadow = vmbo->shadow;
+
  		/* No need to recover an evicted BO */
  		if (shadow->tbo.resource->mem_type != TTM_PL_TT ||
  		    shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||
#2 lore raw
In reply to Lin.Cao
Quoted 6 lines · Lin.Cao

v1: Vmbo->shadow is used to back vram bo up when vram lost. So that we should set shadow as vmbo->shadow to recover vmbo->bo
v2: Modify if(vmbo->shadow) shadow = vmbo->shadow as if(!vmbo->shadow) continue;

Fix: 'commit e18aaea733da ("drm/amdgpu: move shadow_list to amdgpu_bo_vm")'

Please change the previous line to:

Fixes e18aaea733da ("drm/amdgpu: move shadow_list to amdgpu_bo_vm")
Quoted 23 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -1
index 750eaffa81ba..0581b4fec001 100644
@@ -4514,7 +4514,12 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
  	dev_info(adev->dev, "recover vram bo from shadow start\n");
  	mutex_lock(&adev->shadow_list_lock);
  	list_for_each_entry(vmbo, &adev->shadow_list, shadow_list) {
-		shadow = &vmbo->bo;
+
+		/* If vm is compute context or adev is APU, shadow will be NULL */
+		if (!vmbo->shadow)
+			continue;
+		shadow = vmbo->shadow;
+
  		/* No need to recover an evicted BO */
  		if (shadow->tbo.resource->mem_type != TTM_PL_TT ||
  		    shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||
Signature · 1 line
Hamza