On 26-03-2026 05:38 pm, Christian König wrote:
On 3/26/26 09:55, Sunil Khatri wrote:
In function amdgpu_userq_evict use the function return
value in the if condition instead.

Signed-off-by: Sunil Khatri<[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index aa0e6eea9436..2a1832fce6d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -1308,17 +1308,13 @@ void
  amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr)
  {
        struct amdgpu_device *adev = uq_mgr->adev;
-       int ret;
/* Wait for any pending userqueue fence work to finish */
-       ret = amdgpu_userq_wait_for_signal(uq_mgr);
-       if (ret)
+       if (amdgpu_userq_wait_for_signal(uq_mgr))
                dev_err(adev->dev, "Not evicting userqueue, timeout waiting for 
work\n");
That actually looks like a pretty bad idea. Instead we should start printing 
the error code.
Sure could add an error code in the logging.

But before we do that I would rather like to know why 
amdgpu_userq_wait_for_signal() can fail?
dma_fence_wait_timeout is what could fail and we are returning -ETIMEDOUT. We could totally avoid checking for the error here completely as we are already printing the error in
the called function below.
ret=dma_fence_wait_timeout(f, true, msecs_to_jiffies(100));
if(ret<=0) {
drm_file_err(uq_mgr->file, "Timed out waiting for fence=%llu:%llu\n",
f->context, f->seqno);
return-ETIMEDOUT;
                }
That should never happen in the first place.

Regards,
Christian.

- ret = amdgpu_userq_evict_all(uq_mgr);
-       if (ret)
+       if (amdgpu_userq_evict_all(uq_mgr))
                dev_err(adev->dev, "Failed to evict userqueue\n");
Here also the below function returns error and printing error too. We could avoid the return value here too as we are already printing the error.
amdgpu_userq_preempt_helper(queue);
if(r)
ret=r;


Regards
Sunil Khatri

-
  }
int amdgpu_userq_mgr_init(struct amdgpu_userq_mgr *userq_mgr, struct drm_file *file_priv,

Reply via email to