From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: stuart.summers@intel.com, arvind.yadav@intel.com,
himal.prasad.ghimiray@intel.com,
thomas.hellstrom@linux.intel.com, francois.dugast@intel.com
Subject: [PATCH v2 10/12] drm/xe: Add debugfs pagefault_info
Date: Wed, 25 Feb 2026 10:47:11 -0800 [thread overview]
Message-ID: <20260225184713.2606772-11-matthew.brost@intel.com> (raw)
In-Reply-To: <20260225184713.2606772-1-matthew.brost@intel.com>
Add a debugfs entry to dump Xe page fault queue state. The output
includes queue geometry (entry size, total size, head/tail), per-entry
allocation state counts, and whether each page fault worker cache is
currently valid.
This is intended to help debug page fault storms, chaining, and retry
behaviour without needing tracing.
Assisted-by: Chat-GPT # Documentation
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_debugfs.c | 11 ++++++
drivers/gpu/drm/xe/xe_pagefault.c | 62 +++++++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_pagefault.h | 3 ++
3 files changed, 76 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index 844cfafe1ec7..f02481be2501 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -19,6 +19,7 @@
#include "xe_gt_printk.h"
#include "xe_guc_ads.h"
#include "xe_mmio.h"
+#include "xe_pagefault.h"
#include "xe_pm.h"
#include "xe_psmi.h"
#include "xe_pxp_debugfs.h"
@@ -109,6 +110,15 @@ static int sriov_info(struct seq_file *m, void *data)
return 0;
}
+static int pagefault_info(struct seq_file *m, void *data)
+{
+ struct xe_device *xe = node_to_xe(m->private);
+ struct drm_printer p = drm_seq_file_printer(m);
+
+ xe_pagefault_print_info(xe, &p);
+ return 0;
+}
+
static int workarounds(struct xe_device *xe, struct drm_printer *p)
{
guard(xe_pm_runtime)(xe);
@@ -184,6 +194,7 @@ static const struct drm_info_list debugfs_list[] = {
{"info", info, 0},
{ .name = "sriov_info", .show = sriov_info, },
{ .name = "workarounds", .show = workaround_info, },
+ { .name = "pagefault_info", .show = pagefault_info, },
};
static const struct drm_info_list debugfs_residencies[] = {
diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
index c497dd8d9724..2cfda29321c9 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_pagefault.c
@@ -97,6 +97,7 @@ enum xe_pagefault_alloc_state {
XE_PAGEFAULT_ALLOC_STATE_QUEUED = 1,
XE_PAGEFAULT_ALLOC_STATE_CHAINED = 2,
XE_PAGEFAULT_ALLOC_STATE_ACTIVE = 3,
+ XE_PAGEFAULT_ALLOC_STATE_COUNT = 4,
};
static int xe_pagefault_entry_size(void)
@@ -846,3 +847,64 @@ int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf)
return full ? -ENOSPC : 0;
}
+
+/**
+ * xe_pagefault_print_info() - dump page fault queue/cache debug information
+ * @xe: Xe device
+ * @p: DRM printer to emit output to
+ *
+ * Print a snapshot of the page fault queue state for debugging. The output
+ * includes queue parameters (entry size, total size, head/tail), a histogram
+ * of per-entry allocation state values, and the validity of each per-worker
+ * page fault cache.
+ *
+ * This function is intended for debugfs and similar diagnostics. It acquires
+ * the page fault queue spinlock internally to serialize against IRQ-side
+ * producers and the worker consumer path, so callers must not hold the queue
+ * lock.
+ */
+void xe_pagefault_print_info(struct xe_device *xe, struct drm_printer *p)
+{
+ struct xe_pagefault_queue *pf_queue = &xe->usm.pf_queue;
+ struct xe_pagefault_work *pf_work;
+ static const char * const alloc_state_names[] = {
+ [XE_PAGEFAULT_ALLOC_STATE_FREE] = "free",
+ [XE_PAGEFAULT_ALLOC_STATE_QUEUED] = "queued",
+ [XE_PAGEFAULT_ALLOC_STATE_CHAINED] = "chained",
+ [XE_PAGEFAULT_ALLOC_STATE_ACTIVE] = "active",
+ };
+ u32 i, counts[XE_PAGEFAULT_ALLOC_STATE_COUNT] = {};
+
+ guard(spinlock_irq)(&pf_queue->lock);
+
+ drm_printf(p, "pagefault size: %u\n", xe_pagefault_entry_size());
+ drm_printf(p, "pagefault queue size: %u\n", pf_queue->size);
+ drm_printf(p, "pagefault queue head: %u\n", pf_queue->head);
+ drm_printf(p, "pagefault queue tail: %u\n", pf_queue->tail);
+
+ for (i = 0; i < pf_queue->size; i += xe_pagefault_entry_size()) {
+ struct xe_pagefault *pf = pf_queue->data + i;
+
+ if (pf->consumer.alloc_state >=
+ XE_PAGEFAULT_ALLOC_STATE_COUNT) {
+ drm_printf(p, "pagefault[%u] corrupted alloc_state=%u\n",
+ i, pf->consumer.alloc_state);
+ continue;
+ }
+
+ counts[pf->consumer.alloc_state]++;
+ }
+
+ for (i = 0; i < XE_PAGEFAULT_ALLOC_STATE_COUNT; ++i)
+ drm_printf(p, "pagefault queue %s count: %u\n",
+ alloc_state_names[i], counts[i]);
+
+ for (i = 0, pf_work = xe->usm.pf_workers;
+ i < xe->info.num_pf_work; ++i, ++pf_work) {
+ if (pf_work->cache.start == XE_PAGEFAULT_CACHE_START_INVALID)
+ drm_printf(p, "pagefault work[%u] cache invalid\n", i);
+ else
+ drm_printf(p, "pagefault work[%u] cache valid\n", i);
+
+ }
+}
diff --git a/drivers/gpu/drm/xe/xe_pagefault.h b/drivers/gpu/drm/xe/xe_pagefault.h
index feaf2a69674a..e9c5d1f03760 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.h
+++ b/drivers/gpu/drm/xe/xe_pagefault.h
@@ -8,6 +8,7 @@
#include "xe_pagefault_types.h"
+struct drm_printer;
struct xe_device;
struct xe_gt;
struct xe_pagefault;
@@ -18,6 +19,8 @@ void xe_pagefault_reset(struct xe_device *xe, struct xe_gt *gt);
int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf);
+void xe_pagefault_print_info(struct xe_device *xe, struct drm_printer *p);
+
#define XE_PAGEFAULT_END_ADDR_MASK (~0xfffull)
/**
--
2.34.1
next prev parent reply other threads:[~2026-02-25 18:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 18:47 [PATCH v2 00/12] Fine grained fault locking, threaded prefetch, storm cache Matthew Brost
2026-02-25 18:47 ` [PATCH v2 01/12] drm/xe: Fine grained page fault locking Matthew Brost
2026-02-25 18:47 ` [PATCH v2 02/12] drm/xe: Allow prefetch-only VM bind IOCTLs to use VM read lock Matthew Brost
2026-02-25 18:47 ` [PATCH v2 03/12] drm/xe: Thread prefetch of SVM ranges Matthew Brost
2026-02-25 18:47 ` [PATCH v2 04/12] drm/xe: Use a single page-fault queue with multiple workers Matthew Brost
2026-02-25 18:47 ` [PATCH v2 05/12] drm/xe: Add num_pf_work modparam Matthew Brost
2026-02-25 18:47 ` [PATCH v2 06/12] drm/xe: Engine class and instance into a u8 Matthew Brost
2026-02-25 18:47 ` [PATCH v2 07/12] drm/xe: Track pagefault worker runtime Matthew Brost
2026-02-25 18:47 ` [PATCH v2 08/12] drm/xe: Chain page faults via queue-resident cache to avoid fault storms Matthew Brost
2026-02-25 18:47 ` [PATCH v2 09/12] drm/xe: Add pagefault chaining stats Matthew Brost
2026-02-25 18:47 ` Matthew Brost [this message]
2026-02-25 18:47 ` [PATCH v2 11/12] drm/xe: batch CT pagefault acks with periodic flush Matthew Brost
2026-02-25 18:47 ` [PATCH v2 12/12] drm/xe: Track parallel page fault activity in GT stats Matthew Brost
2026-02-25 19:45 ` ✗ CI.checkpatch: warning for Fine grained fault locking, threaded prefetch, storm cache Patchwork
2026-02-25 19:45 ` ✗ CI.KUnit: 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=20260225184713.2606772-11-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=arvind.yadav@intel.com \
--cc=francois.dugast@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=stuart.summers@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox