All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com,
	Christian Koenig <christian.koenig@amd.com>,
	 Lijo.Lazar@amd.com, Mario.Novales@amd.com, Manu.Rastogi@amd.com,
	 Jiongyu.Zhu@amd.com
Subject: Re: [PATCH v4 07/13] drm/amdgpu/userq: add a helper to signal the fences of a queue up to a point
Date: Thu, 19 Nov 2026 12:36:27 +0100	[thread overview]
Message-ID: <cf1a09e421c89f74bd484a5140c46d63d1eb3199.camel@gmail.com> (raw)
In-Reply-To: <20261105030612.726542-7-Jesse.Zhang@amd.com>

On Thu, 2026-11-05 at 11:05 +0800, Jesse Zhang wrote:
> The fence value of a user queue is the write pointer of the queue
> when
> the work was submitted. amdgpu_userq_fence_driver_force_completion()
> signals all the fences of a queue, as after a reset that dropped all
> its
> work.
> 
> Add amdgpu_userq_fence_driver_force_completion_with_seqno(), which
> only
> signals the fences of the work up to a write pointer, with an error,
> for
> a reset that drops only part of the work of a queue: the work
> submitted
> after that write pointer still runs.
> 
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>

> ---
>  .../gpu/drm/amd/amdgpu/amdgpu_userq_fence.c   | 31
> +++++++++++++++++++
>  .../gpu/drm/amd/amdgpu/amdgpu_userq_fence.h   |  2 ++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> index dd976a50e053..d20dce32168b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -460,6 +460,37 @@
> amdgpu_userq_fence_driver_force_completion(struct
> amdgpu_usermode_queue *userq)
>  	}
>  }
>  
> +/*
> + * Signal the fences of @userq with a seqno up to @seqno with -
> ECANCELED, eg.
> + * when a reset dropped the work that would have signaled them.
> + */
> +void
> +amdgpu_userq_fence_driver_force_completion_with_seqno(struct
> amdgpu_usermode_queue *userq,
> +						      u64 seqno)
> +{
> +	struct amdgpu_userq_fence_driver *fence_drv = userq-
> >fence_drv;
> +	struct amdgpu_userq_fence *fence;
> +	unsigned long flags;
> +
> +	if (!fence_drv)
> +		return;
> +
> +	spin_lock_irqsave(&fence_drv->fence_list_lock, flags);
> +	list_for_each_entry(fence, &fence_drv->fences, link) {
> +		if (fence->base.seqno > seqno)
> +			break;
> +		spin_lock(dma_fence_spinlock(&fence->base));
> +		if (!dma_fence_is_signaled_locked(&fence->base))
> +			dma_fence_set_error(&fence->base, -
> ECANCELED);
> +		spin_unlock(dma_fence_spinlock(&fence->base));
> +	}
> +	if (amdgpu_userq_fence_read(fence_drv) < seqno)
> +		amdgpu_userq_fence_write(fence_drv, seqno);
> +	spin_unlock_irqrestore(&fence_drv->fence_list_lock, flags);
> +
> +	amdgpu_userq_fence_driver_process(fence_drv);
> +}
> +
>  int amdgpu_userq_signal_ioctl(struct drm_device *dev, void *data,
>  			      struct drm_file *filp)
>  {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.h
> index 0bd51616cef1..0407c8c2575f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.h
> @@ -65,6 +65,8 @@ int amdgpu_userq_fence_driver_alloc(struct
> amdgpu_device *adev,
>  void amdgpu_userq_fence_driver_free(struct amdgpu_usermode_queue
> *userq);
>  int amdgpu_userq_fence_driver_process(struct
> amdgpu_userq_fence_driver *fence_drv);
>  void amdgpu_userq_fence_driver_force_completion(struct
> amdgpu_usermode_queue *userq);
> +void amdgpu_userq_fence_driver_force_completion_with_seqno(struct
> amdgpu_usermode_queue *userq,
> +							   u64
> seqno);
>  void amdgpu_userq_fence_driver_destroy(struct kref *ref);
>  int amdgpu_userq_signal_ioctl(struct drm_device *dev, void *data,
>  			      struct drm_file *filp);

  reply	other threads:[~2026-11-19 11:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  3:05 [PATCH v4 01/13] drm/amdgpu: pass the device to the multi ring reset helpers Jesse Zhang
2026-11-05  3:05 ` [PATCH v4 02/13] drm/amdgpu/ring: During multi-queue reset, only call begin helper if needed Jesse Zhang
2026-11-11 23:52   ` Daniel Campos Ramos
2026-11-19 11:34   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 03/13] drm/amdgpu: add an engine scope to the IP block soft reset Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 04/13] drm/amdgpu/gfx: add callbacks to save and restore a gfx HQD Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 05/13] drm/amdgpu/gfx12: " Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 06/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 07/13] drm/amdgpu/userq: add a helper to signal the fences of a queue up to a point Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf [this message]
2026-11-05  3:05 ` [PATCH v4 08/13] drm/amdgpu/userq: add helpers to keep the user queues of one engine across a reset Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 09/13] drm/amdgpu/gfx12: add a gfx engine soft reset Jesse Zhang
2026-11-19 11:42   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 10/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 11/13] drm/amdgpu/userq: reset the gfx engine when a gfx user queue reset fails Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 12/13] drm/amdgpu/gfx12: enable the gfx engine soft reset Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 13/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-10  2:06 ` [PATCH v4 01/13] drm/amdgpu: pass the device to the multi ring reset helpers Zhang, Jesse(Jie)
2026-11-11 15:28   ` Timur Kristóf
2026-11-19 11:33 ` Timur Kristóf

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=cf1a09e421c89f74bd484a5140c46d63d1eb3199.camel@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=Jiongyu.Zhu@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=Manu.Rastogi@amd.com \
    --cc=Mario.Novales@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.