AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/sched: Add device pointer to drm_gpu_scheduler
@ 2022-02-16  7:22 Jiawei Gu
  2022-02-16  7:22 ` [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr Jiawei Gu
  0 siblings, 1 reply; 5+ messages in thread
From: Jiawei Gu @ 2022-02-16  7:22 UTC (permalink / raw)
  To: amd-gfx, Andrey.Grodzovsky, Monk.Liu, Emily.Deng, Horace.Chen; +Cc: Jiawei Gu

Add device pointer so scheduler's printing can use
DRM_DEV_ERROR() instead, which makes life easier under multiple GPU

v2: remove drm_sched_init() interface change to avoid compatibility
issue

Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 6 +++---
 include/drm/gpu_scheduler.h            | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 3e0bbc797eaa..83bc3fc2ad53 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -489,7 +489,7 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery)
 			if (r == -ENOENT)
 				drm_sched_job_done(s_job);
 			else if (r)
-				DRM_ERROR("fence add callback failed (%d)\n",
+				DRM_DEV_ERROR(sched->dev, "fence add callback failed (%d)\n",
 					  r);
 		} else
 			drm_sched_job_done(s_job);
@@ -815,7 +815,7 @@ static int drm_sched_main(void *param)
 			if (r == -ENOENT)
 				drm_sched_job_done(sched_job);
 			else if (r)
-				DRM_ERROR("fence add callback failed (%d)\n",
+				DRM_DEV_ERROR(sched->dev, "fence add callback failed (%d)\n",
 					  r);
 			dma_fence_put(fence);
 		} else {
@@ -872,7 +872,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
 	if (IS_ERR(sched->thread)) {
 		ret = PTR_ERR(sched->thread);
 		sched->thread = NULL;
-		DRM_ERROR("Failed to create scheduler for %s.\n", name);
+		DRM_DEV_ERROR(sched->dev, "Failed to create scheduler for %s.\n", name);
 		return ret;
 	}
 
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index d18af49fd009..2d034c9a9299 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -302,6 +302,7 @@ struct drm_gpu_scheduler {
 	atomic_t                        _score;
 	bool				ready;
 	bool				free_guilty;
+	struct device			*dev;
 };
 
 int drm_sched_init(struct drm_gpu_scheduler *sched,
-- 
2.17.1


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

* [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr
  2022-02-16  7:22 [PATCH 1/2] drm/sched: Add device pointer to drm_gpu_scheduler Jiawei Gu
@ 2022-02-16  7:22 ` Jiawei Gu
  2022-02-16 11:17   ` Christian König
  0 siblings, 1 reply; 5+ messages in thread
From: Jiawei Gu @ 2022-02-16  7:22 UTC (permalink / raw)
  To: amd-gfx, Andrey.Grodzovsky, Monk.Liu, Emily.Deng, Horace.Chen; +Cc: Jiawei Gu

Now scheduler contains device ptr. Add it so scheduler printing can be
more reader-friendly under multiple GPU scenario.

Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 4787cb3acaed..da53983c93f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -506,6 +506,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 		break;
 	}
 
+	ring->sched.dev = adev->dev;
 	r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
 			   num_hw_submission, amdgpu_job_hang_limit,
 			   timeout, sched_score, ring->name);
-- 
2.17.1


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

* Re: [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr
  2022-02-16  7:22 ` [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr Jiawei Gu
@ 2022-02-16 11:17   ` Christian König
  2022-02-17  2:46     ` Gu, JiaWei (Will)
  0 siblings, 1 reply; 5+ messages in thread
From: Christian König @ 2022-02-16 11:17 UTC (permalink / raw)
  To: Jiawei Gu, amd-gfx, Andrey.Grodzovsky, Monk.Liu, Emily.Deng,
	Horace.Chen



Am 16.02.22 um 08:22 schrieb Jiawei Gu:
> Now scheduler contains device ptr. Add it so scheduler printing can be
> more reader-friendly under multiple GPU scenario.
>
> Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 4787cb3acaed..da53983c93f9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -506,6 +506,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
>   		break;
>   	}
>   
> +	ring->sched.dev = adev->dev;

That should probably be a parameter to drm_sched_init() instead and I'm 
not sure what happens in the print when this is NULL.

So make sure to update all other drivers which want to use 
drm_sched_init() as well.

Regards,
Christian.

>   	r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
>   			   num_hw_submission, amdgpu_job_hang_limit,
>   			   timeout, sched_score, ring->name);


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

* RE: [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr
  2022-02-16 11:17   ` Christian König
@ 2022-02-17  2:46     ` Gu, JiaWei (Will)
  2022-02-17  7:39       ` Christian König
  0 siblings, 1 reply; 5+ messages in thread
From: Gu, JiaWei (Will) @ 2022-02-17  2:46 UTC (permalink / raw)
  To: Koenig, Christian, amd-gfx@lists.freedesktop.org,
	Grodzovsky,  Andrey, Liu, Monk, Deng, Emily, Chen, Horace

[AMD Official Use Only]

Hi Christian,

My same concern is that an additional parameter may affects other drivers which want to use public drm_sched_init(), and I want to reduce the scope of affection.
Will it avoid potential compatibility issues if we keep the interface unchanged and let driver fill device pointer by itself?

And DRM_DEV_ERROR() print is fine with NULL device pointer, there's a NULL pointer check inside of it already.

Best regards,
Jiawei

-----Original Message-----
From: Koenig, Christian <Christian.Koenig@amd.com> 
Sent: Wednesday, February 16, 2022 7:17 PM
To: Gu, JiaWei (Will) <JiaWei.Gu@amd.com>; amd-gfx@lists.freedesktop.org; Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Deng, Emily <Emily.Deng@amd.com>; Chen, Horace <Horace.Chen@amd.com>
Subject: Re: [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr



Am 16.02.22 um 08:22 schrieb Jiawei Gu:
> Now scheduler contains device ptr. Add it so scheduler printing can be 
> more reader-friendly under multiple GPU scenario.
>
> Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 4787cb3acaed..da53983c93f9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -506,6 +506,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
>   		break;
>   	}
>   
> +	ring->sched.dev = adev->dev;

That should probably be a parameter to drm_sched_init() instead and I'm not sure what happens in the print when this is NULL.

So make sure to update all other drivers which want to use
drm_sched_init() as well.

Regards,
Christian.

>   	r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
>   			   num_hw_submission, amdgpu_job_hang_limit,
>   			   timeout, sched_score, ring->name);

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

* Re: [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr
  2022-02-17  2:46     ` Gu, JiaWei (Will)
@ 2022-02-17  7:39       ` Christian König
  0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2022-02-17  7:39 UTC (permalink / raw)
  To: Gu, JiaWei (Will), amd-gfx@lists.freedesktop.org,
	Grodzovsky, Andrey, Liu, Monk, Deng, Emily, Chen, Horace

Am 17.02.22 um 03:46 schrieb Gu, JiaWei (Will):
> [AMD Official Use Only]
>
> Hi Christian,
>
> My same concern is that an additional parameter may affects other drivers which want to use public drm_sched_init(), and I want to reduce the scope of affection.
> Will it avoid potential compatibility issues if we keep the interface unchanged and let driver fill device pointer by itself?

No, that will just cause confusion. We keep all drivers in a single 
Linux kernel exactly to avoid stuff like that.

Regards,
Christian.

>
> And DRM_DEV_ERROR() print is fine with NULL device pointer, there's a NULL pointer check inside of it already.
>
> Best regards,
> Jiawei
>
> -----Original Message-----
> From: Koenig, Christian <Christian.Koenig@amd.com>
> Sent: Wednesday, February 16, 2022 7:17 PM
> To: Gu, JiaWei (Will) <JiaWei.Gu@amd.com>; amd-gfx@lists.freedesktop.org; Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Deng, Emily <Emily.Deng@amd.com>; Chen, Horace <Horace.Chen@amd.com>
> Subject: Re: [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr
>
>
>
> Am 16.02.22 um 08:22 schrieb Jiawei Gu:
>> Now scheduler contains device ptr. Add it so scheduler printing can be
>> more reader-friendly under multiple GPU scenario.
>>
>> Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
>> ---
>>    drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 1 +
>>    1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> index 4787cb3acaed..da53983c93f9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> @@ -506,6 +506,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
>>    		break;
>>    	}
>>    
>> +	ring->sched.dev = adev->dev;
> That should probably be a parameter to drm_sched_init() instead and I'm not sure what happens in the print when this is NULL.
>
> So make sure to update all other drivers which want to use
> drm_sched_init() as well.
>
> Regards,
> Christian.
>
>>    	r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
>>    			   num_hw_submission, amdgpu_job_hang_limit,
>>    			   timeout, sched_score, ring->name);


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

end of thread, other threads:[~2022-02-17  7:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-16  7:22 [PATCH 1/2] drm/sched: Add device pointer to drm_gpu_scheduler Jiawei Gu
2022-02-16  7:22 ` [PATCH 2/2] drm/amdgpu: fill scheduler with device ptr Jiawei Gu
2022-02-16 11:17   ` Christian König
2022-02-17  2:46     ` Gu, JiaWei (Will)
2022-02-17  7:39       ` 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