AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Sunil Khatri <sunil.khatri@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [Patch v4 1/4] drm/amdgpu/userq: dont check return value in amdgpu_userq_evict
Date: Tue, 31 Mar 2026 13:42:27 +0200	[thread overview]
Message-ID: <6e408ee6-2855-4845-85be-296b1e6108cc@amd.com> (raw)
In-Reply-To: <20260331074943.2510941-2-sunil.khatri@amd.com>



On 3/31/26 09:49, Sunil Khatri wrote:
> In function amdgpu_userq_evict we do not need to check
> for return values and print errors as we are already
> print error in all the functions of amdgpu_userq_evict.
> 
> a. amdgpu_userq_wait_for_signal: Could timeout and we print
>    error message in the function already
> b. amdgpu_userq_evict_all: We unmap all the queues here and
>    in case of unmap failure we already print unmap error.
> 
> Suggested-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 26 +++++++++--------------
>  1 file changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index fdae8c411aaa..79ee2f6e09da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -1258,7 +1258,8 @@ amdgpu_userq_evict_all(struct amdgpu_userq_mgr *uq_mgr)
>  	}
>  
>  	if (ret)
> -		drm_file_err(uq_mgr->file, "Couldn't unmap all the queues\n");
> +		drm_file_err(uq_mgr->file,
> +			     "Couldn't unmap all the queues, eviction failed ret=%d\n", ret);
>  	return ret;
>  }
>  
> @@ -1289,13 +1290,14 @@ amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr)
>  	xa_for_each(&uq_mgr->userq_xa, queue_id, queue) {
>  		struct dma_fence *f = queue->last_fence;
>  
> -		if (!f || dma_fence_is_signaled(f))
> +		if (!f)
>  			continue;
>  
> -		ret = dma_fence_wait_timeout(f, true, msecs_to_jiffies(100));
> +		ret = dma_fence_wait(f, false);

>  		if (ret <= 0) {
> -			drm_file_err(uq_mgr->file, "Timed out waiting for fence=%llu:%llu\n",
> -				     f->context, f->seqno);
> +			drm_file_err(uq_mgr->file,
> +				     "Timed out in wait_for_signal fence=%llu:%llu ret=%d\n",
> +				     f->context, f->seqno, ret);
>  
>  			return -ETIMEDOUT;
>  		}

You can completely drop this. dma_fence_wait() will never return any error when used like this.

Apart from that the patch looks correct to me.

Regards,
Christian.


> @@ -1307,18 +1309,10 @@ amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr)
>  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)
> -		dev_err(adev->dev, "Not evicting userqueue, timeout waiting for work\n");
> -
> -	ret = amdgpu_userq_evict_all(uq_mgr);
> -	if (ret)
> -		dev_err(adev->dev, "Failed to evict userqueue\n");
> -
> +	amdgpu_userq_wait_for_signal(uq_mgr);
> +	/* unmaps all the queues */
> +	amdgpu_userq_evict_all(uq_mgr);
>  }
>  
>  int amdgpu_userq_mgr_init(struct amdgpu_userq_mgr *userq_mgr, struct drm_file *file_priv,


  reply	other threads:[~2026-03-31 11:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31  7:49 [Patch v4 0/4] Bunch of patches to fix fence timeout cleanup Sunil Khatri
2026-03-31  7:49 ` [Patch v4 1/4] drm/amdgpu/userq: dont check return value in amdgpu_userq_evict Sunil Khatri
2026-03-31 11:42   ` Christian König [this message]
2026-03-31 11:55     ` Khatri, Sunil
2026-03-31  7:49 ` [Patch v4 2/4] drm/amdgpu/userq: add the return code too in error condition Sunil Khatri
2026-03-31  7:49 ` [Patch v4 3/4] drm/amdgpu/userq: call dma_resv_wait_timeout without test for signalled Sunil Khatri
2026-03-31 11:51   ` Christian König
2026-03-31 11:57     ` Khatri, Sunil
2026-03-31  7:49 ` [Patch v4 4/4] drm/amdgpu/userq: use dma_fence_wait_timeout " Sunil Khatri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6e408ee6-2855-4845-85be-296b1e6108cc@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sunil.khatri@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox