All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix vram recover doesn't work after whole GPU reset
@ 2023-05-05  3:46 Lin.Cao
  2023-05-05  8:24 ` Christian König
  2023-05-05 13:19 ` Hamza Mahfooz
  0 siblings, 2 replies; 3+ messages in thread
From: Lin.Cao @ 2023-05-05  3:46 UTC (permalink / raw)
  To: amd-gfx; +Cc: zhenguo.yin, jingwen.chen2, christian.koenig, 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")'
Signed-off-by: Lin.Cao <lincao12@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 750eaffa81ba..0581b4fec001 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -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.25.1


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

* Re: [PATCH] drm/amdgpu: Fix vram recover doesn't work after whole GPU reset
  2023-05-05  3:46 [PATCH] drm/amdgpu: Fix vram recover doesn't work after whole GPU reset Lin.Cao
@ 2023-05-05  8:24 ` Christian König
  2023-05-05 13:19 ` Hamza Mahfooz
  1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2023-05-05  8:24 UTC (permalink / raw)
  To: Lin.Cao, amd-gfx; +Cc: zhenguo.yin, jingwen.chen2, christian.koenig

Am 05.05.23 um 05:46 schrieb 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")'
> Signed-off-by: Lin.Cao <lincao12@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 750eaffa81ba..0581b4fec001 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -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 ||


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

* Re: [PATCH] drm/amdgpu: Fix vram recover doesn't work after whole GPU reset
  2023-05-05  3:46 [PATCH] drm/amdgpu: Fix vram recover doesn't work after whole GPU reset Lin.Cao
  2023-05-05  8:24 ` Christian König
@ 2023-05-05 13:19 ` Hamza Mahfooz
  1 sibling, 0 replies; 3+ messages in thread
From: Hamza Mahfooz @ 2023-05-05 13:19 UTC (permalink / raw)
  To: Lin.Cao, amd-gfx; +Cc: zhenguo.yin, jingwen.chen2, christian.koenig

On 5/4/23 23:46, Lin.Cao wrote:
> 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")

> Signed-off-by: Lin.Cao <lincao12@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 750eaffa81ba..0581b4fec001 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -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 ||
-- 
Hamza


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

end of thread, other threads:[~2023-05-05 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-05  3:46 [PATCH] drm/amdgpu: Fix vram recover doesn't work after whole GPU reset Lin.Cao
2023-05-05  8:24 ` Christian König
2023-05-05 13:19 ` Hamza Mahfooz

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.