amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync
@ 2021-08-17  9:50 YuBiao Wang
  2021-08-17 16:54 ` Andrey Grodzovsky
  2021-08-18  8:06 ` Christian König
  0 siblings, 2 replies; 3+ messages in thread
From: YuBiao Wang @ 2021-08-17  9:50 UTC (permalink / raw)
  To: amd-gfx
  Cc: Andrey Grodzovsky, Evan Quan, horace.chen, Tuikov Luben,
	Christian König, Deucher Alexander, Jack Xiao,
	Hawking Zhang, Monk Liu, Feifei Xu, Kevin Wang, YuBiao Wang

[Why]
In some cases when we unload driver, warning call trace
will show up in vram_mgr_fini which claims that LRU is not empty, caused
by the ttm bo inside delay deleted queue.

[How]
We should flush delayed work to make sure the delay deleting is done.

Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4d266c40382c..0b5764aa98a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3824,8 +3824,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
 {
 	dev_info(adev->dev, "amdgpu: finishing device.\n");
 	flush_delayed_work(&adev->delayed_init_work);
-	if (adev->mman.initialized)
+	if (adev->mman.initialized) {
+		flush_delayed_work(&adev->mman.bdev.wq);
 		ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
+	}
 	adev->shutdown = true;
 
 	/* make sure IB test finished before entering exclusive mode
-- 
2.25.1


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

* Re: [PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync
  2021-08-17  9:50 [PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync YuBiao Wang
@ 2021-08-17 16:54 ` Andrey Grodzovsky
  2021-08-18  8:06 ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Grodzovsky @ 2021-08-17 16:54 UTC (permalink / raw)
  To: YuBiao Wang, amd-gfx
  Cc: Evan Quan, horace.chen, Tuikov Luben, Christian König,
	Deucher Alexander, Jack Xiao, Hawking Zhang, Monk Liu, Feifei Xu,
	Kevin Wang

Looks reasonable to me.

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

Andrey

On 2021-08-17 5:50 a.m., YuBiao Wang wrote:
> [Why]
> In some cases when we unload driver, warning call trace
> will show up in vram_mgr_fini which claims that LRU is not empty, caused
> by the ttm bo inside delay deleted queue.
>
> [How]
> We should flush delayed work to make sure the delay deleting is done.
>
> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 4d266c40382c..0b5764aa98a4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3824,8 +3824,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
>   {
>   	dev_info(adev->dev, "amdgpu: finishing device.\n");
>   	flush_delayed_work(&adev->delayed_init_work);
> -	if (adev->mman.initialized)
> +	if (adev->mman.initialized) {
> +		flush_delayed_work(&adev->mman.bdev.wq);
>   		ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
> +	}
>   	adev->shutdown = true;
>   
>   	/* make sure IB test finished before entering exclusive mode

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

* Re: [PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync
  2021-08-17  9:50 [PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync YuBiao Wang
  2021-08-17 16:54 ` Andrey Grodzovsky
@ 2021-08-18  8:06 ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2021-08-18  8:06 UTC (permalink / raw)
  To: YuBiao Wang, amd-gfx
  Cc: Andrey Grodzovsky, Evan Quan, horace.chen, Tuikov Luben,
	Christian König, Deucher Alexander, Jack Xiao,
	Hawking Zhang, Monk Liu, Feifei Xu, Kevin Wang



Am 17.08.21 um 11:50 schrieb YuBiao Wang:
> [Why]
> In some cases when we unload driver, warning call trace
> will show up in vram_mgr_fini which claims that LRU is not empty, caused
> by the ttm bo inside delay deleted queue.
>
> [How]
> We should flush delayed work to make sure the delay deleting is done.
>
> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 4d266c40382c..0b5764aa98a4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3824,8 +3824,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
>   {
>   	dev_info(adev->dev, "amdgpu: finishing device.\n");
>   	flush_delayed_work(&adev->delayed_init_work);
> -	if (adev->mman.initialized)
> +	if (adev->mman.initialized) {
> +		flush_delayed_work(&adev->mman.bdev.wq);
>   		ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
> +	}

If you flush the delayed work you can drop the call to 
ttm_bo_lock_delayed_workqueue().

It would also be nice to have to wrap this into a 
ttm_bo_flush_delayed_workqueue() function.

Apart from that looks good to me,
Christian.

>   	adev->shutdown = true;
>   
>   	/* make sure IB test finished before entering exclusive mode


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

end of thread, other threads:[~2021-08-18  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  9:50 [PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync YuBiao Wang
2021-08-17 16:54 ` Andrey Grodzovsky
2021-08-18  8:06 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).