From: Matthew Brost <matthew.brost@intel.com>
To: Varun Gupta <varun.gupta@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <stuart.summers@intel.com>,
<szymon.markiewicz@intel.com>, <himal.prasad.ghimiray@intel.com>
Subject: Re: [PATCH v3] drm/xe: Guard page-fault worker with runtime PM check
Date: Fri, 4 Sep 2026 11:00:29 -0700 [thread overview]
Message-ID: <apsHPQlxIPVf/qBW@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260904091656.374036-2-varun.gupta@intel.com>
On Fri, Sep 04, 2026 at 02:46:57PM +0530, Varun Gupta wrote:
> During VM teardown, the VM's runtime PM reference is dropped
> asynchronously, allowing the device to autosuspend while stale page
> faults belonging to the now-dead VM are still queued. When the
> page-fault worker later tries to ack one of these, it calls into
> guc_ct_send_locked() on an already-suspended device, tripping:
>
> Assertion `!xe_pm_runtime_suspended(xe)` failed!
> WARNING at xe_device.c:1267 xe_device_assert_mem_access+0x11c/0x140 [xe]
>
> A live VM/exec queue always holds a PM reference while it has
> outstanding work, so if the device is suspended at ack time, the
> owning context is already gone and the fault is stale.
>
> Take a runtime PM reference across the entire pagefault
> queue worker to safely deliver acks for torn-down VMs.
>
> v3:
> - Move PM ref to the generic xe_pagefault_queue_work using
> guard(xe_pm_runtime)(xe) instead of tracking it in the GuC
> backend(Matt Brost).
>
> v2:
> - Hold PM ref across the entire batch (begin/end) instead of per-ack.
> This prevents the device from autosuspending mid-batch, which would
> leave write_only acks written but the end flush skipped, and skip
> counter++, desyncing the cadence check.(Himal)
> - Add a comment explaining stale faults.(Himal)
>
> Fixes: f289f7807119 ("drm/xe: Add xe_guc_pagefault layer")
> Reported-by: Szymon Markiewicz <szymon.markiewicz@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Varun Gupta <varun.gupta@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pagefault.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> index 2e415995f067..3e8e8f7f5f40 100644
> --- a/drivers/gpu/drm/xe/xe_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> @@ -17,6 +17,7 @@
> #include "xe_log.h"
> #include "xe_pagefault.h"
> #include "xe_pagefault_types.h"
> +#include "xe_pm.h"
> #include "xe_svm.h"
> #include "xe_trace_bo.h"
> #include "xe_vm.h"
> @@ -604,6 +605,13 @@ static void xe_pagefault_queue_work(struct work_struct *w)
> u64 cache_start = XE_PAGEFAULT_CACHE_START_INVALID, cache_end = 0;
> u32 cache_asid = 0;
>
> + /*
> + * A live VM holds a PM reference, but a torn-down VM does not.
> + * Guard the entire worker loop to safely drain stale faults and
> + * prevent autosuspends from desyncing batched CT flushes.
> + */
> + guard(xe_pm_runtime)(xe);
> +
> #define USM_QUEUE_MAX_RUNTIME_MS 20
> threshold = jiffies + msecs_to_jiffies(USM_QUEUE_MAX_RUNTIME_MS);
>
> --
> 2.43.0
>
prev parent reply other threads:[~2026-09-04 18:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 6:27 [PATCH] drm/xe/guc: Guard page-fault ack with runtime PM check Varun Gupta
2026-09-03 6:33 ` ✗ CI.checkpatch: warning for " Patchwork
2026-09-03 6:35 ` ✓ CI.KUnit: success " Patchwork
2026-09-03 7:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-03 18:53 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-04 9:16 ` [PATCH v3] drm/xe: Guard page-fault worker " Varun Gupta
2026-09-04 18:00 ` Matthew Brost [this message]
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=apsHPQlxIPVf/qBW@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=stuart.summers@intel.com \
--cc=szymon.markiewicz@intel.com \
--cc=varun.gupta@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox