All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized.
@ 2021-08-05  2:37 YuBiao Wang
  2021-08-05 12:35 ` Christian König
  2021-08-09  9:49 ` Deng, Emily
  0 siblings, 2 replies; 4+ messages in thread
From: YuBiao Wang @ 2021-08-05  2:37 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

When init failed in early init stage, amdgpu_object has
not been initialized, so hasn't the ttm delayed queue functions.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 9e53ff851496..4c33985542ed 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3825,7 +3825,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
 {
 	dev_info(adev->dev, "amdgpu: finishing device.\n");
 	flush_delayed_work(&adev->delayed_init_work);
-	ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
+	if (adev->mman.initialized)
+		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] 4+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized.
  2021-08-05  2:37 [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized YuBiao Wang
@ 2021-08-05 12:35 ` Christian König
  2021-08-06  6:01   ` Wang, YuBiao
  2021-08-09  9:49 ` Deng, Emily
  1 sibling, 1 reply; 4+ messages in thread
From: Christian König @ 2021-08-05 12:35 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 05.08.21 um 04:37 schrieb YuBiao Wang:
> When init failed in early init stage, amdgpu_object has
> not been initialized, so hasn't the ttm delayed queue functions.
>
> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 9e53ff851496..4c33985542ed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3825,7 +3825,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
>   {
>   	dev_info(adev->dev, "amdgpu: finishing device.\n");
>   	flush_delayed_work(&adev->delayed_init_work);
> -	ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
> +	if (adev->mman.initialized)
> +		ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);

I'm really wondering why we have that here in the first place.

This just disabled the delayed delete queue which is part of the sw 
stack and not related to hardware in any way possible.

I think it would be much cleaner to move this into amdgpu_ttm_fini().

Christian.

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


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

* RE: [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized.
  2021-08-05 12:35 ` Christian König
@ 2021-08-06  6:01   ` Wang, YuBiao
  0 siblings, 0 replies; 4+ messages in thread
From: Wang, YuBiao @ 2021-08-06  6:01 UTC (permalink / raw)
  To: Christian König, amd-gfx
  Cc: Grodzovsky, Andrey, Quan, Evan, Chen, Horace, Tuikov, Luben,
	Koenig, Christian, Deucher, Alexander, Xiao, Jack, Zhang,
	Hawking, Liu, Monk, Xu, Feifei, Wang, Kevin(Yang)

[AMD Official Use Only]

Hi Christian,

This part is added by a commit which stated that:
When unloading driver after killing some applications, it will hit sdma flush tlb job timeout which is called by ttm_bo_delay_delete. So to avoid the job submit after fence driver fini, call ttm_bo_lock_delayed_workqueue
before fence driver fini. And also put drm_sched_fini before waiting fence.

As fence driver fini is before amdgpu ip fini process, so I think I shouldn't move it into ttm_fini.

Best Regards,
Yubiao Wang



-----Original Message-----
From: Christian König <ckoenig.leichtzumerken@gmail.com> 
Sent: Thursday, August 5, 2021 8:36 PM
To: Wang, YuBiao <YuBiao.Wang@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com>; Quan, Evan <Evan.Quan@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Tuikov, Luben <Luben.Tuikov@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com>
Subject: Re: [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized.

Am 05.08.21 um 04:37 schrieb YuBiao Wang:
> When init failed in early init stage, amdgpu_object has not been 
> initialized, so hasn't the ttm delayed queue functions.
>
> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 9e53ff851496..4c33985542ed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3825,7 +3825,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
>   {
>   	dev_info(adev->dev, "amdgpu: finishing device.\n");
>   	flush_delayed_work(&adev->delayed_init_work);
> -	ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
> +	if (adev->mman.initialized)
> +		ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);

I'm really wondering why we have that here in the first place.

This just disabled the delayed delete queue which is part of the sw stack and not related to hardware in any way possible.

I think it would be much cleaner to move this into amdgpu_ttm_fini().

Christian.

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

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

* RE: [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized.
  2021-08-05  2:37 [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized YuBiao Wang
  2021-08-05 12:35 ` Christian König
@ 2021-08-09  9:49 ` Deng, Emily
  1 sibling, 0 replies; 4+ messages in thread
From: Deng, Emily @ 2021-08-09  9:49 UTC (permalink / raw)
  To: Wang, YuBiao, amd-gfx
  Cc: Grodzovsky, Andrey, Quan, Evan, Chen, Horace, Tuikov, Luben,
	Koenig, Christian, Deucher, Alexander, Xiao, Jack, Zhang,
	Hawking, Liu, Monk, Xu, Feifei, Wang, Kevin(Yang),
	Wang, YuBiao

[AMD Official Use Only]

Reviewed-by: Emily.Deng <Emily.Deng@amd.com>

>-----Original Message-----
>From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
>YuBiao Wang
>Sent: Thursday, August 5, 2021 10:38 AM
>To: amd-gfx@lists.freedesktop.org
>Cc: Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com>; Quan, Evan
><Evan.Quan@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Tuikov,
>Luben <Luben.Tuikov@amd.com>; Koenig, Christian
><Christian.Koenig@amd.com>; Deucher, Alexander
><Alexander.Deucher@amd.com>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang,
>Hawking <Hawking.Zhang@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Xu,
>Feifei <Feifei.Xu@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com>;
>Wang, YuBiao <YuBiao.Wang@amd.com>
>Subject: [PATCH] drm/amd/amdgpu: skip locking delayed work if not
>initialized.
>
>When init failed in early init stage, amdgpu_object has not been initialized,
>so hasn't the ttm delayed queue functions.
>
>Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
>---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>index 9e53ff851496..4c33985542ed 100644
>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>@@ -3825,7 +3825,8 @@ void amdgpu_device_fini_hw(struct
>amdgpu_device *adev)  {
>       dev_info(adev->dev, "amdgpu: finishing device.\n");
>       flush_delayed_work(&adev->delayed_init_work);
>-      ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
>+      if (adev->mman.initialized)
>+              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	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-09  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  2:37 [PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized YuBiao Wang
2021-08-05 12:35 ` Christian König
2021-08-06  6:01   ` Wang, YuBiao
2021-08-09  9:49 ` Deng, Emily

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.