Linux Media Controller development
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <christian.koenig@amd.com>
Cc: <phasta@kernel.org>, <simona@ffwll.ch>, <sumit.semwal@linaro.org>,
	<tvrtko.ursulin@igalia.com>, <dakr@kernel.org>,
	<dri-devel@lists.freedesktop.org>, <linux-media@vger.kernel.org>,
	<linaro-mm-sig@lists.linaro.org>
Subject: Re: [PATCH 06/10] drm/xe: stop using dma_fence_is_signaled_locked
Date: Wed, 24 Jun 2026 17:44:05 -0700	[thread overview]
Message-ID: <ajx51f6y9t3ER0te@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260624122917.2483-7-christian.koenig@amd.com>

On Wed, Jun 24, 2026 at 01:13:30PM +0200, Christian König wrote:
> This use case is a bit more complicated since the irq worker is
> actually the one signaling the fence.
> 
> The patch should not indroduce any functional change, but the code can
> probably be cleaned up quite a bit after the full patch set lands.
> 

Most likely - this is pretty old code largely untouched from the
original Xe implementation - will look at this after this series lands.

> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/xe/xe_hw_fence.c | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hw_fence.c b/drivers/gpu/drm/xe/xe_hw_fence.c
> index 14720623ad00..a4e0278559b8 100644
> --- a/drivers/gpu/drm/xe/xe_hw_fence.c
> +++ b/drivers/gpu/drm/xe/xe_hw_fence.c
> @@ -16,6 +16,8 @@
>  
>  static struct kmem_cache *xe_hw_fence_slab;
>  
> +static struct xe_hw_fence *to_xe_hw_fence(struct dma_fence *fence);
> +
>  int __init xe_hw_fence_module_init(void)
>  {
>  	xe_hw_fence_slab = kmem_cache_create("xe_hw_fence",
> @@ -47,6 +49,16 @@ static void fence_free(struct rcu_head *rcu)
>  		kmem_cache_free(xe_hw_fence_slab, fence);
>  }
>  
> +static bool xe_hw_fence_signaled(struct dma_fence *dma_fence)

Maybe just forward declare this function to keep git blame intact?

Matt

> +{
> +	struct xe_hw_fence *fence = to_xe_hw_fence(dma_fence);
> +	struct xe_device *xe = fence->xe;
> +	u32 seqno = xe_map_rd(xe, &fence->seqno_map, 0, u32);
> +
> +	return dma_fence->error ||
> +		!__dma_fence_is_later(dma_fence, dma_fence->seqno, seqno);
> +}
> +
>  static void hw_fence_irq_run_cb(struct irq_work *work)
>  {
>  	struct xe_hw_fence_irq *irq = container_of(work, typeof(*irq), work);
> @@ -60,7 +72,9 @@ static void hw_fence_irq_run_cb(struct irq_work *work)
>  			struct dma_fence *dma_fence = &fence->dma;
>  
>  			trace_xe_hw_fence_try_signal(fence);
> -			if (dma_fence_is_signaled_locked(dma_fence)) {
> +			if (dma_fence_test_signaled_flag(dma_fence) ||
> +			    xe_hw_fence_signaled(dma_fence)) {
> +				dma_fence_signal_locked(dma_fence);
>  				trace_xe_hw_fence_signal(fence);
>  				list_del_init(&fence->irq_link);
>  				dma_fence_put(dma_fence);
> @@ -120,8 +134,6 @@ void xe_hw_fence_ctx_finish(struct xe_hw_fence_ctx *ctx)
>  {
>  }
>  
> -static struct xe_hw_fence *to_xe_hw_fence(struct dma_fence *fence);
> -
>  static struct xe_hw_fence_irq *xe_hw_fence_irq(struct xe_hw_fence *fence)
>  {
>  	return container_of(fence->dma.extern_lock, struct xe_hw_fence_irq,
> @@ -142,16 +154,6 @@ static const char *xe_hw_fence_get_timeline_name(struct dma_fence *dma_fence)
>  	return fence->name;
>  }
>  
> -static bool xe_hw_fence_signaled(struct dma_fence *dma_fence)
> -{
> -	struct xe_hw_fence *fence = to_xe_hw_fence(dma_fence);
> -	struct xe_device *xe = fence->xe;
> -	u32 seqno = xe_map_rd(xe, &fence->seqno_map, 0, u32);
> -
> -	return dma_fence->error ||
> -		!__dma_fence_is_later(dma_fence, dma_fence->seqno, seqno);
> -}
> -
>  static bool xe_hw_fence_enable_signaling(struct dma_fence *dma_fence)
>  {
>  	struct xe_hw_fence *fence = to_xe_hw_fence(dma_fence);
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-06-25  0:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 11:13 dma_fence cleanup/rework Christian König
2026-06-24 11:13 ` [PATCH 01/10] dma-buf: rename dma_fence_enable_sw_signaling Christian König
2026-06-25  0:39   ` Matthew Brost
2026-06-24 11:13 ` [PATCH 02/10] dma-buf: use dma_fence_test_signaled_flag() Christian König
2026-06-24 11:13 ` [PATCH 03/10] drm/amdgpu: " Christian König
2026-06-24 11:13 ` [PATCH 04/10] drm/nouveau: " Christian König
2026-06-24 11:13 ` [PATCH 05/10] drm/sched: " Christian König
2026-06-24 11:13 ` [PATCH 06/10] drm/xe: stop using dma_fence_is_signaled_locked Christian König
2026-06-25  0:44   ` Matthew Brost [this message]
2026-06-24 11:13 ` [PATCH 07/10] dma-buf: remove dma_fence_is_signaled_locked() Christian König
2026-06-24 11:13 ` [PATCH 08/10] dma-buf: remove signaling from dma_fence_is_signaled() Christian König
2026-06-24 11:13 ` [PATCH 09/10] dma-buf: remove signaling from dma_fence_enable_signaling() Christian König
2026-06-24 11:13 ` [PATCH 10/10] dma-buf: move locking into dma_fence_ops.enable_signaling Christian König
2026-06-25  7:25 ` dma_fence cleanup/rework Philipp Stanner

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=ajx51f6y9t3ER0te@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=phasta@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.org \
    --cc=tvrtko.ursulin@igalia.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