AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
@ 2023-09-15  2:52 YuBiao Wang
  2023-09-15  6:50 ` Christian König
  0 siblings, 1 reply; 6+ messages in thread
From: YuBiao Wang @ 2023-09-15  2:52 UTC (permalink / raw)
  To: amd-gfx
  Cc: YuBiao Wang, Feifei Xu, horace.chen, Kevin Wang, Tuikov Luben,
	Deucher Alexander, Christian König, Monk Liu, Hawking Zhang

Directly use tbo's start address will miss the domain start offset. Need
to use gpu_offset instead.

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

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 77159b03a422..36e7171ad9a7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -216,7 +216,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
 
 	if (q->wptr_bo) {
 		wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1);
-		queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off;
+		queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) + wptr_addr_off;
 	}
 
 	queue_input.is_kfd_process = 1;
-- 
2.34.1


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

* Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
  2023-09-15  2:52 [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr YuBiao Wang
@ 2023-09-15  6:50 ` Christian König
  2023-09-15 14:53   ` Felix Kuehling
  0 siblings, 1 reply; 6+ messages in thread
From: Christian König @ 2023-09-15  6:50 UTC (permalink / raw)
  To: YuBiao Wang, amd-gfx, Kuehling, Felix, Sharma, Shashank
  Cc: Feifei Xu, horace.chen, Kevin Wang, Tuikov Luben,
	Deucher Alexander, Monk Liu, Hawking Zhang

Am 15.09.23 um 04:52 schrieb YuBiao Wang:
> Directly use tbo's start address will miss the domain start offset. Need
> to use gpu_offset instead.
>
> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>

Felix and/or Shashank should probably take a look as well, but of hand 
that looks like the correct fix.

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

> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 77159b03a422..36e7171ad9a7 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -216,7 +216,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
>   
>   	if (q->wptr_bo) {
>   		wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1);
> -		queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off;
> +		queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) + wptr_addr_off;
>   	}
>   
>   	queue_input.is_kfd_process = 1;


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

* Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
  2023-09-15  6:50 ` Christian König
@ 2023-09-15 14:53   ` Felix Kuehling
  2023-09-18  2:14     ` Wang, YuBiao
  2023-09-18  8:23     ` Christian König
  0 siblings, 2 replies; 6+ messages in thread
From: Felix Kuehling @ 2023-09-15 14:53 UTC (permalink / raw)
  To: Christian König, YuBiao Wang, amd-gfx, Sharma, Shashank
  Cc: Feifei Xu, horace.chen, Kevin Wang, Tuikov Luben,
	Deucher Alexander, Monk Liu, Hawking Zhang

On 2023-09-15 2:50, Christian König wrote:
> Am 15.09.23 um 04:52 schrieb YuBiao Wang:
>> Directly use tbo's start address will miss the domain start offset. Need
>> to use gpu_offset instead.
>>
>> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
>
> Felix and/or Shashank should probably take a look as well, but of hand 
> that looks like the correct fix.

Looks reasonable to me. Why did this not cause problems before? Are we 
just lucky that the domain start offset is 0 on the GPUs we've tested so 
far?

Regards,
   Felix


>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
>> ---
>>   drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
>> b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> index 77159b03a422..36e7171ad9a7 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> @@ -216,7 +216,7 @@ static int add_queue_mes(struct 
>> device_queue_manager *dqm, struct queue *q,
>>         if (q->wptr_bo) {
>>           wptr_addr_off = (uint64_t)q->properties.write_ptr & 
>> (PAGE_SIZE - 1);
>> -        queue_input.wptr_mc_addr = 
>> ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + 
>> wptr_addr_off;
>> +        queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) 
>> + wptr_addr_off;
>>       }
>>         queue_input.is_kfd_process = 1;
>

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

* RE: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
  2023-09-15 14:53   ` Felix Kuehling
@ 2023-09-18  2:14     ` Wang, YuBiao
  2023-09-18 16:11       ` Felix Kuehling
  2023-09-18  8:23     ` Christian König
  1 sibling, 1 reply; 6+ messages in thread
From: Wang, YuBiao @ 2023-09-18  2:14 UTC (permalink / raw)
  To: Kuehling, Felix, Koenig, Christian, amd-gfx@lists.freedesktop.org,
	Sharma, Shashank
  Cc: Xu, Feifei, Chen, Horace, Kevin Wang, Tuikov, Luben,
	Deucher, Alexander, Liu, Monk, Zhang, Hawking

[AMD Official Use Only - General]

Hi Felix,

Yeah, I believe that we were always set gart domain start as 0 before.

Regards,
Yubiao

-----Original Message-----
From: Kuehling, Felix <Felix.Kuehling@amd.com>
Sent: Friday, September 15, 2023 10:54 PM
To: Koenig, Christian <Christian.Koenig@amd.com>; Wang, YuBiao <YuBiao.Wang@amd.com>; amd-gfx@lists.freedesktop.org; Sharma, Shashank <Shashank.Sharma@amd.com>
Cc: Chen, Horace <Horace.Chen@amd.com>; Tuikov, Luben <Luben.Tuikov@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Kevin Wang <Kevin1.Wang@amd.com>
Subject: Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr

On 2023-09-15 2:50, Christian König wrote:
> Am 15.09.23 um 04:52 schrieb YuBiao Wang:
>> Directly use tbo's start address will miss the domain start offset.
>> Need to use gpu_offset instead.
>>
>> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
>
> Felix and/or Shashank should probably take a look as well, but of hand
> that looks like the correct fix.

Looks reasonable to me. Why did this not cause problems before? Are we just lucky that the domain start offset is 0 on the GPUs we've tested so far?

Regards,
   Felix


>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
>> ---
>>   drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> index 77159b03a422..36e7171ad9a7 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> @@ -216,7 +216,7 @@ static int add_queue_mes(struct
>> device_queue_manager *dqm, struct queue *q,
>>         if (q->wptr_bo) {
>>           wptr_addr_off = (uint64_t)q->properties.write_ptr &
>> (PAGE_SIZE - 1);
>> -        queue_input.wptr_mc_addr =
>> ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) +
>> wptr_addr_off;
>> +        queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo)
>> +wptr_addr_off;
>>       }
>>         queue_input.is_kfd_process = 1;
>

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

* Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
  2023-09-15 14:53   ` Felix Kuehling
  2023-09-18  2:14     ` Wang, YuBiao
@ 2023-09-18  8:23     ` Christian König
  1 sibling, 0 replies; 6+ messages in thread
From: Christian König @ 2023-09-18  8:23 UTC (permalink / raw)
  To: Felix Kuehling, Christian König, YuBiao Wang, amd-gfx,
	Sharma, Shashank
  Cc: Feifei Xu, horace.chen, Kevin Wang, Tuikov Luben,
	Deucher Alexander, Monk Liu, Hawking Zhang

Am 15.09.23 um 16:53 schrieb Felix Kuehling:
> On 2023-09-15 2:50, Christian König wrote:
>> Am 15.09.23 um 04:52 schrieb YuBiao Wang:
>>> Directly use tbo's start address will miss the domain start offset. 
>>> Need
>>> to use gpu_offset instead.
>>>
>>> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
>>
>> Felix and/or Shashank should probably take a look as well, but of 
>> hand that looks like the correct fix.
>
> Looks reasonable to me. Why did this not cause problems before? Are we 
> just lucky that the domain start offset is 0 on the GPUs we've tested 
> so far?

By coincident the GART ended up being placed at 0 before. Now Alex has 
to move it to work around other issues.

Regards,
Christian.

>
> Regards,
>   Felix
>
>
>>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
>>
>>> ---
>>>   drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
>>> b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> index 77159b03a422..36e7171ad9a7 100644
>>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> @@ -216,7 +216,7 @@ static int add_queue_mes(struct 
>>> device_queue_manager *dqm, struct queue *q,
>>>         if (q->wptr_bo) {
>>>           wptr_addr_off = (uint64_t)q->properties.write_ptr & 
>>> (PAGE_SIZE - 1);
>>> -        queue_input.wptr_mc_addr = 
>>> ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + 
>>> wptr_addr_off;
>>> +        queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) 
>>> + wptr_addr_off;
>>>       }
>>>         queue_input.is_kfd_process = 1;
>>


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

* Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
  2023-09-18  2:14     ` Wang, YuBiao
@ 2023-09-18 16:11       ` Felix Kuehling
  0 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2023-09-18 16:11 UTC (permalink / raw)
  To: Wang, YuBiao, Koenig, Christian, amd-gfx@lists.freedesktop.org,
	Sharma, Shashank
  Cc: Xu, Feifei, Chen, Horace, Kevin Wang, Tuikov, Luben,
	Deucher, Alexander, Liu, Monk, Zhang, Hawking

On 2023-09-17 22:14, Wang, YuBiao wrote:
> [AMD Official Use Only - General]
>
> Hi Felix,
>
> Yeah, I believe that we were always set gart domain start as 0 before.

Thanks for confirming that. The patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


>
> Regards,
> Yubiao
>
> -----Original Message-----
> From: Kuehling, Felix <Felix.Kuehling@amd.com>
> Sent: Friday, September 15, 2023 10:54 PM
> To: Koenig, Christian <Christian.Koenig@amd.com>; Wang, YuBiao <YuBiao.Wang@amd.com>; amd-gfx@lists.freedesktop.org; Sharma, Shashank <Shashank.Sharma@amd.com>
> Cc: Chen, Horace <Horace.Chen@amd.com>; Tuikov, Luben <Luben.Tuikov@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Kevin Wang <Kevin1.Wang@amd.com>
> Subject: Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
>
> On 2023-09-15 2:50, Christian König wrote:
>> Am 15.09.23 um 04:52 schrieb YuBiao Wang:
>>> Directly use tbo's start address will miss the domain start offset.
>>> Need to use gpu_offset instead.
>>>
>>> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
>> Felix and/or Shashank should probably take a look as well, but of hand
>> that looks like the correct fix.
> Looks reasonable to me. Why did this not cause problems before? Are we just lucky that the domain start offset is 0 on the GPUs we've tested so far?
>
> Regards,
>     Felix
>
>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
>>
>>> ---
>>>    drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> index 77159b03a422..36e7171ad9a7 100644
>>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> @@ -216,7 +216,7 @@ static int add_queue_mes(struct
>>> device_queue_manager *dqm, struct queue *q,
>>>          if (q->wptr_bo) {
>>>            wptr_addr_off = (uint64_t)q->properties.write_ptr &
>>> (PAGE_SIZE - 1);
>>> -        queue_input.wptr_mc_addr =
>>> ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) +
>>> wptr_addr_off;
>>> +        queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo)
>>> +wptr_addr_off;
>>>        }
>>>          queue_input.is_kfd_process = 1;

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

end of thread, other threads:[~2023-09-18 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15  2:52 [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr YuBiao Wang
2023-09-15  6:50 ` Christian König
2023-09-15 14:53   ` Felix Kuehling
2023-09-18  2:14     ` Wang, YuBiao
2023-09-18 16:11       ` Felix Kuehling
2023-09-18  8:23     ` 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