drm/amdkfd: Use gpu_offset for user queue's wptr
Subsystems (3)
PATCH 1/1 drm/amdkfd: Use gpu_offset for user queue's wptr
Directly use tbo's start address will miss the domain start offset. Need to use gpu_offset instead.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -1
@@ -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 ;
Signature · 1 line
2.34.1
Am 15.09.23 um 04:52 schrieb YuBiao Wang:
Quoted 4 lines
Directly use tbo's start address will miss the domain start offset. Need to use
gpu_offsetinstead.Signed-off-by YuBiao Wang <[email protected]>
Felix and/or Shashank should probably take a look as well, but of hand that looks like the correct fix.
Quoted 17 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-1@@ -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 ;
Felix Kuehling
maintainerQuoted 7 lines · Christian König
Am 15.09.23 um 04:52 schrieb YuBiao Wang:
Quoted 4 lines
Directly use tbo's start address will miss the domain start offset. Need to use
gpu_offsetinstead.Signed-off-by YuBiao Wang <[email protected]>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
Quoted 22 lines
Reviewed-by Christian König <[email protected]>Quoted 18 lines
---
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1@@ -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;
[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 <[email protected]>
Sent: Friday, September 15, 2023 10:54 PM
To: Koenig, Christian <[email protected]>; Wang, YuBiao <[email protected]>; [email protected]; Sharma, Shashank <[email protected]>
Cc: Chen, Horace <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Liu, Monk <[email protected]>; Xu, Feifei <[email protected]>; Kevin Wang <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr
Quoted 8 lines · Christian König
Am 15.09.23 um 04:52 schrieb YuBiao Wang:
Quoted 4 lines
Directly use tbo's start address will miss the domain start offset. Need to use
gpu_offsetinstead.Signed-off-by YuBiao Wang <[email protected]>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
Quoted 25 lines
Reviewed-by Christian König <[email protected]>Quoted 21 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-1@@ -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;drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-0+ queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) +wptr_addr_off; } queue_input.is_kfd_process =1 ;
Quoted 5 lines · YuBiao
[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
Quoted 48 lines
Regards,
Yubiao-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, September 15, 2023 10:54 PM
To: Koenig, Christian <[email protected]>; Wang, YuBiao <[email protected]>; [email protected]; Sharma, Shashank <[email protected]>
Cc: Chen, Horace <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Liu, Monk <[email protected]>; Xu, Feifei <[email protected]>; Kevin Wang <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: Usegpu_offsetfor user queue's wptrQuoted 7 lines · Christian König
Am 15.09.23 um 04:52 schrieb YuBiao Wang:
Quoted 4 lines
Directly use tbo's start address will miss the domain start offset. Need to use
gpu_offsetinstead.Signed-off-by YuBiao Wang <[email protected]>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,
FelixQuoted 23 lines
Reviewed-by Christian König <[email protected]>Quoted 21 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-1@@ -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;drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-0+ queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) +wptr_addr_off; } queue_input.is_kfd_process =1 ;
Am 15.09.23 um 16:53 schrieb Felix Kuehling:
Quoted 10 lines · Christian König
Quoted 7 lines
Am 15.09.23 um 04:52 schrieb YuBiao Wang:
Quoted 4 lines
Directly use tbo's start address will miss the domain start offset. Need to use
gpu_offsetinstead.Signed-off-by YuBiao Wang <[email protected]>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.
Quoted 27 lines
Regards,
FelixQuoted 22 lines
Reviewed-by Christian König <[email protected]>Quoted 18 lines
---
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1@@ -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;