drm/amdgpu/userq: use fence_val instead or rptr
Subsystems (2)
PATCH v2 1/2 drm/amdgpu/userq: use fence_val instead or rptr
rptr is a confusing variable name as it is a fence value written by the cp in the fence address and no where related to the rptr.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +3 -3
@@ -148,13 +148,13 @@ amdgpu_userq_fence_driver_process(struct amdgpu_userq_fence_driver *fence_drv)LIST_HEAD (to_be_signaled);struct dma_fence *fence;unsigned long flags; -u64 rptr; +u64 fence_val;spin_lock_irqsave (&fence_drv->fence_list_lock, flags); - rptr =amdgpu_userq_fence_read (fence_drv); + fence_val =amdgpu_userq_fence_read (fence_drv);list_for_each_entry (userq_fence, &fence_drv->fences, link) { -if (rptr < userq_fence->base.seqno) +if (fence_val < userq_fence->base.seqno)break ; }
Signature · 1 line
2.34.1
PATCH v2 2/2 drm/amdgpu/userq: use fence_val instead or rptr
rptr is a confusing variabile name as it is a fence value written by the cp in the fence address and no where related to the rptr.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +3 -3
@@ -316,12 +316,12 @@ static bool amdgpu_userq_fence_signaled(struct dma_fence *f) {struct amdgpu_userq_fence *fence =to_amdgpu_userq_fence (f);struct amdgpu_userq_fence_driver *fence_drv = fence->fence_drv; -u64 rptr, wptr; +u64 fence_val, wptr; - rptr =amdgpu_userq_fence_read (fence_drv); + fence_val =amdgpu_userq_fence_read (fence_drv); wptr = fence->base.seqno; -if (rptr >= wptr) +if (fence_val >= wptr)return true;return false;
Signature · 1 line
2.34.1
AMD General
Quoted 10 lines
-----Original Message-----
From: Sunil Khatri <[email protected]>
Sent: Wednesday, August 26, 2026 1:59 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]; Khatri, Sunil <[email protected]>
Subject: [PATCH v2 1/2] drm/amdgpu/userq: usefence_valinstead or rptrrptr is a confusing variable name as it is a fence value written by the cp in the fence address and no where related to the rptr.
For a little history, the fence value is the actually wptr written by the application when it submits the protected fence packet. The firmware writes the rptr that is aligned to that wptr as the fence value. But in this case, I agree that it is confusing, especially for someone without the history. Patches are:
Quoted 31 lines
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +3
-4@@ -148,13 +148,13 @@ amdgpu_userq_fence_driver_process(struct amdgpu_userq_fence_driver *fence_drv)LIST_HEAD (to_be_signaled );struct dma_fence *fence;unsigned long flags; -u64 rptr; +u64 fence_val;spin_lock_irqsave (&fence_drv->fence_list_lock, flags); - rptr =amdgpu_userq_fence_read (fence_drv); + fence_val =amdgpu_userq_fence_read (fence_drv);list_for_each_entry (userq_fence, &fence_drv->fences, link) { -if (rptr < userq_fence->base.seqno) +if (fence_val < userq_fence->base.seqno)break ; } --2.34.1
Quoted 10 lines · Alexander
AMD General
Quoted 8 lines
-----Original Message-----
From: Sunil Khatri <[email protected]>
Sent: Wednesday, August 26, 2026 1:59 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]; Khatri, Sunil <[email protected]>
Subject: [PATCH v2 1/2] drm/amdgpu/userq: usefence_valinstead or rptr
Quoted 4 lines
Quoted 2 lines
rptr is a confusing variable name as it is a fence value written by the cp in the fence address and no where related to the rptr.
For a little history, the fence value is the actually wptr written by the application when it submits the protected fence packet. The firmware writes the rptr that is aligned to that wptr as the fence value. But in this case, I agree that it is confusing, especially for someone without the history. Patches are:
Reviewed-by Alex Deucher <[email protected]>
Totally agree with that. I knew its the wptr value that is written in the fence address but i was confused so many times while debugging the sdma issue. Thanks for the quick review on these.
Regards
Sunil Khatri
Quoted 31 lines
Quoted 31 lines
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +3
-4@@ -148,13 +148,13 @@ amdgpu_userq_fence_driver_process(struct amdgpu_userq_fence_driver *fence_drv)LIST_HEAD (to_be_signaled );struct dma_fence *fence;unsigned long flags; -u64 rptr; +u64 fence_val;spin_lock_irqsave (&fence_drv->fence_list_lock, flags); - rptr =amdgpu_userq_fence_read (fence_drv); + fence_val =amdgpu_userq_fence_read (fence_drv);list_for_each_entry (userq_fence, &fence_drv->fences, link) { -if (rptr < userq_fence->base.seqno) +if (fence_val < userq_fence->base.seqno)break ; } --2.34.1
Quoted 5 lines · Sunil Khatri
rptr is a confusing variable name as it is a fence value written by the cp in the fence address and no where related to the rptr.
Signed-off-by Sunil Khatri <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +3
-3@@ -148,13 +148,13 @@ amdgpu_userq_fence_driver_process(struct amdgpu_userq_fence_driver *fence_drv)LIST_HEAD (to_be_signaled);struct dma_fence *fence;unsigned long flags; -u64 rptr; +u64 fence_val;spin_lock_irqsave (&fence_drv->fence_list_lock, flags); - rptr =amdgpu_userq_fence_read (fence_drv); + fence_val =amdgpu_userq_fence_read (fence_drv);list_for_each_entry (userq_fence, &fence_drv->fences, link) { -if (rptr < userq_fence->base.seqno) +if (fence_val < userq_fence->base.seqno)break ; }