drm/amdgpu: Recover vram from vmbo->shadow rather than vmbo->bo
Subsystems (2)
PATCH 1/1 drm/amdgpu: Recover vram from vmbo->shadow rather than vmbo->bo
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.
Fix: 'commit e18aaea733da ("drm/amdgpu: move shadow_list to amdgpu_bo_vm")'
Signed-off-by Lin.Cao <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -1
@@ -4501,7 +4501,13 @@ 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) + shadow = vmbo->shadow; +else +continue ; +/* 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
Christian König
maintainerAm 27.04.23 um 05:23 schrieb Lin.Cao:
Quoted 2 lines
Vmbo->shadowis used to back vram bo up when vram lost. So that we should set shadow asvmbo->shadowto recovervmbo->bo.
Good catch.
Quoted 13 lines
Fix: 'commit
e18aaea733da("drm/amdgpu: moveshadow_listtoamdgpu_bo_vm")'Signed-off-by Lin.Cao <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · line 4509
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-1@@ -4501,7 +4501,13 @@ 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) + shadow = vmbo->shadow; +else +continue ;
Better write that as "if (!vmbo->shadow) continue;", apart from that looks good to me.
Christian.
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+/* No need to recover an evicted BO */ if (shadow->tbo.resource->mem_type != TTM_PL_TT || shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||