From: Matthew Brost <matthew.brost@intel.com>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2] drm/xe: Make exec_queue_kill safe to call twice
Date: Wed, 14 Aug 2024 21:29:10 +0000 [thread overview]
Message-ID: <Zr0hpvLC7W0Hyc54@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20240814205654.1716586-1-daniele.ceraolospurio@intel.com>
On Wed, Aug 14, 2024 at 01:56:54PM -0700, Daniele Ceraolo Spurio wrote:
> An upcoming PXP patch will kill queues at runtime when a PXP
> invalidation event occurs, so we need exec_queue_kill to be safe to call
> multiple times.
>
> v2: Add documentation (Matt B)
>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_exec_queue.c | 9 +++++++++
> drivers/gpu/drm/xe/xe_vm.c | 8 ++++++--
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
> index 971e1234b8ea..7d170d37fdbe 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> @@ -770,6 +770,15 @@ void xe_exec_queue_update_run_ticks(struct xe_exec_queue *q)
> xef->run_ticks[q->class] += (new_ts - old_ts) * q->width;
> }
>
> +/**
> + * xe_exec_queue_kill - permanently stop all execution from an exec queue
> + * @q: The exec queue
> + *
> + * This function permanently stops all activity on an exec queue. If the queue
> + * is actively executing on the HW, it will be kicked off the engine; any
> + * pending jobs are discarded and all future submissions are rejected.
> + * This function is safe to call multiple times.
> + */
> void xe_exec_queue_kill(struct xe_exec_queue *q)
> {
> struct xe_exec_queue *eq = q, *next;
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 22add5167564..6dd76f77b504 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -275,6 +275,8 @@ int xe_vm_add_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
> * xe_vm_remove_compute_exec_queue() - Remove compute exec queue from VM
> * @vm: The VM.
> * @q: The exec_queue
> + *
> + * Note that this function might be called multiple times on the same queue.
> */
> void xe_vm_remove_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
> {
> @@ -282,8 +284,10 @@ void xe_vm_remove_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
> return;
>
> down_write(&vm->lock);
> - list_del(&q->lr.link);
> - --vm->preempt.num_exec_queues;
> + if (!list_empty(&q->lr.link)) {
> + list_del_init(&q->lr.link);
> + --vm->preempt.num_exec_queues;
> + }
> if (q->lr.pfence) {
> dma_fence_enable_sw_signaling(q->lr.pfence);
> dma_fence_put(q->lr.pfence);
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-08-14 21:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 20:56 [PATCH v2] drm/xe: Make exec_queue_kill safe to call twice Daniele Ceraolo Spurio
2024-08-14 21:02 ` ✓ CI.Patch_applied: success for " Patchwork
2024-08-14 21:02 ` ✓ CI.checkpatch: " Patchwork
2024-08-14 21:03 ` ✓ CI.KUnit: " Patchwork
2024-08-14 21:15 ` ✓ CI.Build: " Patchwork
2024-08-14 21:18 ` ✓ CI.Hooks: " Patchwork
2024-08-14 21:19 ` ✓ CI.checksparse: " Patchwork
2024-08-14 21:29 ` Matthew Brost [this message]
2024-08-14 21:41 ` ✓ CI.BAT: " Patchwork
2024-08-15 6:21 ` ✗ CI.FULL: failure " Patchwork
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=Zr0hpvLC7W0Hyc54@DUT025-TGLU.fm.intel.com \
--to=matthew.brost@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=intel-xe@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