From: Matthew Brost <matthew.brost@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v4 3/6] drm/xe/guc: add uninterruptible suspend wait for cross-process cleanup
Date: Mon, 13 Jul 2026 09:17:53 -0700 [thread overview]
Message-ID: <alUPsce7S3Kh+YY1@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260713030005.2123322-11-niranjana.vishwanathapura@intel.com>
On Sun, Jul 12, 2026 at 08:00:07PM -0700, Niranjana Vishwanathapura wrote:
> Add a suspend_wait_blocking() exec queue op: an uninterruptible variant
> of suspend_wait() for callers that must complete a suspend on behalf of a
> queue that may belong to a different process than the calling task (e.g.
> cleanup/undo paths). An interruptible suspend_wait() returns -ERESTARTSYS
> when the calling task is signalled, which would leave the other process's
> queue suspended forever - a cross-process DoS.
>
> The blocking variant waits uninterruptibly and, on a genuine GuC timeout,
> bans and tears down the queue like suspend_wait() (shared via
> guc_exec_queue_suspend_timeout_ban()). It deliberately does not handle VF
> recovery since a blocking caller cannot retry.
>
> Assisted-by: Github-Copilot:Claude-opus-4.8
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_exec_queue_types.h | 9 ++++++
> drivers/gpu/drm/xe/xe_execlist.c | 1 +
> drivers/gpu/drm/xe/xe_guc_submit.c | 39 ++++++++++++++++++++++++
> 3 files changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue_types.h b/drivers/gpu/drm/xe/xe_exec_queue_types.h
> index dbb2ee8eb5de..0aa0823cbdaa 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue_types.h
> +++ b/drivers/gpu/drm/xe/xe_exec_queue_types.h
> @@ -322,6 +322,15 @@ struct xe_exec_queue_ops {
> * avoidance mechanism.
> */
> int (*suspend_wait)(struct xe_exec_queue *q);
> + /**
> + * @suspend_wait_blocking: Like @suspend_wait, but waits uninterruptibly
> + * (does not abort on the calling task's signals). For cleanup/undo paths
> + * that must complete a suspend on behalf of a queue that may belong to a
> + * different process than the caller: a signal to the caller must not
> + * abandon the wait, which would leave the other process's queue
> + * suspended forever (cross-process DoS). A timeout bans like suspend_wait.
> + */
> + int (*suspend_wait_blocking)(struct xe_exec_queue *q);
> /**
> * @resume: Resume exec queue execution, exec queue must be in a suspended
> * state and dma fence returned from most recent suspend call must be
> diff --git a/drivers/gpu/drm/xe/xe_execlist.c b/drivers/gpu/drm/xe/xe_execlist.c
> index 6b86b4f9cc1c..cc33ae80e8cf 100644
> --- a/drivers/gpu/drm/xe/xe_execlist.c
> +++ b/drivers/gpu/drm/xe/xe_execlist.c
> @@ -468,6 +468,7 @@ static const struct xe_exec_queue_ops execlist_exec_queue_ops = {
> .set_preempt_timeout = execlist_exec_queue_set_preempt_timeout,
> .suspend = execlist_exec_queue_suspend,
> .suspend_wait = execlist_exec_queue_suspend_wait,
> + .suspend_wait_blocking = execlist_exec_queue_suspend_wait,
> .resume = execlist_exec_queue_resume,
> .reset_status = execlist_exec_queue_reset_status,
> };
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 3ece51451f86..de9c131fc62d 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -2290,6 +2290,44 @@ static int guc_exec_queue_suspend_wait(struct xe_exec_queue *q)
> return ret < 0 ? ret : 0;
> }
>
> +static int guc_exec_queue_suspend_wait_blocking(struct xe_exec_queue *q)
> +{
> + struct xe_guc *guc = exec_queue_to_guc(q);
> + struct xe_device *xe = guc_to_xe(guc);
> + int ret;
> +
> + /*
> + * Uninterruptible variant of guc_exec_queue_suspend_wait() for callers
> + * that must complete the wait on behalf of a queue possibly owned by a
> + * different process (e.g. cleanup/undo paths). An interruptible wait
> + * could return -ERESTARTSYS if the calling task is signalled, leaving
> + * that queue suspended forever (cross-process DoS).
> + *
> + * A timeout is still a real per-queue fault, so it bans and cleans up
> + * like suspend_wait(). VF recovery is deliberately not handled (no
> + * -EAGAIN) since a blocking caller cannot retry.
> + */
> + q = xe_exec_queue_multi_queue_primary(q);
> +
> +#define WAIT_COND \
> + (!READ_ONCE(q->guc->suspend_pending) || exec_queue_killed(q) || \
> + xe_guc_read_stopped(guc))
> +
> + if (IS_SRIOV_VF(xe))
> + ret = wait_event_timeout(guc->ct.wq, WAIT_COND, HZ * 5);
> + else
> + ret = wait_event_timeout(q->guc->suspend_wait, WAIT_COND, HZ * 5);
> +
> +#undef WAIT_COND
> +
> + if (!ret) {
> + guc_exec_queue_suspend_timeout_ban(q);
> + return -ETIME;
> + }
> +
> + return 0;
> +}
> +
> static void guc_exec_queue_resume(struct xe_exec_queue *q)
> {
> struct xe_gpu_scheduler *sched = &q->guc->sched;
> @@ -2329,6 +2367,7 @@ static const struct xe_exec_queue_ops guc_exec_queue_ops = {
> .set_multi_queue_priority = guc_exec_queue_set_multi_queue_priority,
> .suspend = guc_exec_queue_suspend,
> .suspend_wait = guc_exec_queue_suspend_wait,
> + .suspend_wait_blocking = guc_exec_queue_suspend_wait_blocking,
> .resume = guc_exec_queue_resume,
> .reset_status = guc_exec_queue_reset_status,
> };
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-07-13 16:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 3:00 [PATCH v4 0/6] drm/xe: balance exec queue suspend/resume Niranjana Vishwanathapura
2026-07-13 3:00 ` [PATCH v4 1/6] drm/xe: only resume exec queues that were actually suspended Niranjana Vishwanathapura
2026-07-13 3:00 ` [PATCH v4 2/6] drm/xe/guc: ban exec queue on suspend timeout Niranjana Vishwanathapura
2026-07-13 16:15 ` Matthew Brost
2026-07-13 3:00 ` [PATCH v4 3/6] drm/xe/guc: add uninterruptible suspend wait for cross-process cleanup Niranjana Vishwanathapura
2026-07-13 16:17 ` Matthew Brost [this message]
2026-07-13 3:00 ` [PATCH v4 4/6] drm/xe/hw_engine_group: propagate suspend failures during mode switch Niranjana Vishwanathapura
2026-07-13 16:20 ` Matthew Brost
2026-07-13 3:00 ` [PATCH v4 5/6] drm/xe/guc: Add suspend refcount to exec queue ops Niranjana Vishwanathapura
2026-07-13 3:00 ` [PATCH v4 6/6] drm/xe/multi_queue: preempt primary on queue group suspend Niranjana Vishwanathapura
2026-07-13 3:06 ` ✗ CI.checkpatch: warning for drm/xe: balance exec queue suspend/resume (rev6) Patchwork
2026-07-13 3:07 ` ✓ CI.KUnit: success " Patchwork
2026-07-13 3:43 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-13 4:52 ` ✓ Xe.CI.FULL: " 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=alUPsce7S3Kh+YY1@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=niranjana.vishwanathapura@intel.com \
--cc=thomas.hellstrom@linux.intel.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.