AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Prike Liang <Prike.Liang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com
Subject: Re: [PATCH] drm/amdgpu: lock the eviction fence before signaling it
Date: Thu, 8 May 2025 15:56:00 +0200	[thread overview]
Message-ID: <d7a75e46-96ee-481b-90c3-eaa514569245@amd.com> (raw)
In-Reply-To: <20250508134428.383605-1-Prike.Liang@amd.com>



On 5/8/25 15:44, Prike Liang wrote:
> Lock and refer to the eviction fence before trying to signal it.
> 
> Signed-off-by: Prike Liang <Prike.Liang@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> index 1a7469543db5..dd272c1fcbb4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> @@ -108,13 +108,16 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
>  	struct amdgpu_eviction_fence *ev_fence;
>  
>  	mutex_lock(&uq_mgr->userq_mutex);
> -	ev_fence = evf_mgr->ev_fence;
> +	spin_lock(&evf_mgr->ev_fence_lock);
> +	ev_fence = (struct amdgpu_eviction_fence *)dma_fence_get(&evf_mgr->ev_fence->base);

That case is not a good approach, instead put the dma_fence_get on a separate line.

Apart from that it looks good to me.

Christian.

> +	spin_unlock(&evf_mgr->ev_fence_lock);
>  	if (!ev_fence)
>  		goto unlock;
>  
>  	amdgpu_userq_evict(uq_mgr, ev_fence);
>  
>  unlock:
> +	dma_fence_put(&evf_mgr->ev_fence->base);
>  	mutex_unlock(&uq_mgr->userq_mutex);
>  }
>  


  reply	other threads:[~2025-05-08 13:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 13:44 [PATCH] drm/amdgpu: lock the eviction fence before signaling it Prike Liang
2025-05-08 13:56 ` Christian König [this message]
2025-05-09  6:31   ` Liang, Prike
2025-05-09 10:38     ` Christian König

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=d7a75e46-96ee-481b-90c3-eaa514569245@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Prike.Liang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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