From: Varun Gupta <varun.gupta@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: stuart.summers@intel.com, matthew.brost@intel.com,
himal.prasad.ghimiray@intel.com, szymon.markiewicz@intel.com
Subject: [PATCH v2] drm/xe/guc: Guard page-fault ack with runtime PM check
Date: Fri, 4 Sep 2026 13:35:06 +0530 [thread overview]
Message-ID: <20260904080505.4159219-2-varun.gupta@intel.com> (raw)
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 page-fault ack batch
preventing mid-batch suspends.
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>
Signed-off-by: Varun Gupta <varun.gupta@intel.com>
---
drivers/gpu/drm/xe/xe_guc_pagefault.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_guc_pagefault.c b/drivers/gpu/drm/xe/xe_guc_pagefault.c
index 8f8210a732e9..9c9cd6e056fb 100644
--- a/drivers/gpu/drm/xe/xe_guc_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_guc_pagefault.c
@@ -9,12 +9,21 @@
#include "xe_guc_pagefault.h"
#include "xe_pagefault.h"
#include "xe_pagefault_types.h"
+#include "xe_pm.h"
#define XE_GUC_PAGEFAULT_FLUSH_PERIOD BIT(4) /* Sixteen */
static void guc_ack_fault_begin(void *private)
{
struct xe_guc *guc = private;
+ struct xe_device *xe = guc_to_xe(guc);
+
+ /*
+ * Live VMs hold a PM ref, so faults during suspend are stale.
+ * Hold a PM ref across the entire batch to safely drain them
+ * and prevent mid-batch autosuspend from desyncing CT flushes.
+ */
+ xe_pm_runtime_get(xe);
xe_guc_ct_lock(&guc->ct);
@@ -62,10 +71,13 @@ static void guc_ack_fault(struct xe_pagefault *pf, int err)
static void guc_ack_fault_end(void *private)
{
struct xe_guc *guc = private;
+ struct xe_device *xe = guc_to_xe(guc);
if ((guc->pagefault_ack_counter & (XE_GUC_PAGEFAULT_FLUSH_PERIOD - 1)) != 1)
xe_guc_ct_send_flush(&guc->ct);
xe_guc_ct_unlock(&guc->ct);
+
+ xe_pm_runtime_put(xe);
}
static const struct xe_pagefault_ops guc_pagefault_ops = {
--
2.43.0
next reply other threads:[~2026-09-04 8:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 8:05 Varun Gupta [this message]
2026-09-04 8:25 ` ✗ CI.checkpatch: warning for drm/xe/guc: Guard page-fault ack with runtime PM check (rev2) Patchwork
2026-09-04 8:27 ` ✓ CI.KUnit: success " Patchwork
2026-09-04 8:30 ` [PATCH v2] drm/xe/guc: Guard page-fault ack with runtime PM check Matthew Brost
2026-09-04 8:53 ` Ghimiray, Himal Prasad
2026-09-04 9:05 ` ✓ Xe.CI.BAT: success for drm/xe/guc: Guard page-fault ack with runtime PM check (rev2) Patchwork
2026-09-04 19:34 ` ✓ 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=20260904080505.4159219-2-varun.gupta@intel.com \
--to=varun.gupta@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=stuart.summers@intel.com \
--cc=szymon.markiewicz@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