Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: Maciej Patelczyk <maciej.patelczyk@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>,
	<intel-xe@lists.freedesktop.org>,  <stuart.summers@intel.com>,
	<arvind.yadav@intel.com>, <himal.prasad.ghimiray@intel.com>,
	<thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v4 09/12] drm/xe: Add pagefault chaining stats
Date: Thu, 7 May 2026 15:52:47 +0200	[thread overview]
Message-ID: <afyZL1FY75IAkl4H@fdugast-desk> (raw)
In-Reply-To: <68a2f0a3-3f22-43a0-9604-b27ff3b5a65e@intel.com>

On Thu, May 07, 2026 at 03:15:12PM +0200, Maciej Patelczyk wrote:
> On 26/02/2026 05:28, Matthew Brost wrote:
> 
> > Add GT stats to quantify pagefault chaining behavior during fault storms.
> > 
> > Track total chained faults, faults chained directly from the IRQ
> > handler, cases where IRQ chaining also drained the queue, chained faults
> > that had to be requeued due to range mismatch, and cases where the last
> > serviced range allowed immediate ack.
> > 
> > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> > ---
> >   drivers/gpu/drm/xe/xe_gt_stats.c       |  5 +++++
> >   drivers/gpu/drm/xe/xe_gt_stats_types.h |  5 +++++
> >   drivers/gpu/drm/xe/xe_pagefault.c      | 18 ++++++++++++++++--
> >   3 files changed, 26 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c b/drivers/gpu/drm/xe/xe_gt_stats.c
> > index c1af3ecb429b..cdd467dfb46d 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> > @@ -54,6 +54,11 @@ void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr)
> >   #define DEF_STAT_STR(ID, name) [XE_GT_STATS_ID_##ID] = name
> >   static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
> > +	DEF_STAT_STR(CHAIN_PAGEFAULT_COUNT, "chain_pagefault_count"),
> > +	DEF_STAT_STR(CHAIN_IRQ_PAGEFAULT_COUNT, "chain_irq_pagefault_count"),
> > +	DEF_STAT_STR(CHAIN_DRAIN_IRQ_PAGEFAULT_COUNT, "chain_drain_irq_pagefault_count"),
> > +	DEF_STAT_STR(CHAIN_MISMATCH_PAGEFAULT_COUNT, "chain_mismatch_pagefault_count"),
> > +	DEF_STAT_STR(LAST_PAGEFAULT_COUNT, "last_pagefault_count"),
> >   	DEF_STAT_STR(SVM_PAGEFAULT_COUNT, "svm_pagefault_count"),
> >   	DEF_STAT_STR(TLB_INVAL, "tlb_inval_count"),
> >   	DEF_STAT_STR(SVM_TLB_INVAL_COUNT, "svm_tlb_inval_count"),
> > diff --git a/drivers/gpu/drm/xe/xe_gt_stats_types.h b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> > index 129260bfdfe6..591e614e1cfc 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_stats_types.h
> > +++ b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> > @@ -9,6 +9,11 @@
> >   #include <linux/types.h>
> >   enum xe_gt_stats_id {
> > +	XE_GT_STATS_ID_CHAIN_PAGEFAULT_COUNT,
> > +	XE_GT_STATS_ID_CHAIN_IRQ_PAGEFAULT_COUNT,
> > +	XE_GT_STATS_ID_CHAIN_DRAIN_IRQ_PAGEFAULT_COUNT,
> > +	XE_GT_STATS_ID_CHAIN_MISMATCH_PAGEFAULT_COUNT,
> > +	XE_GT_STATS_ID_LAST_PAGEFAULT_COUNT,
> >   	XE_GT_STATS_ID_SVM_PAGEFAULT_COUNT,
> >   	XE_GT_STATS_ID_TLB_INVAL,
> >   	XE_GT_STATS_ID_SVM_TLB_INVAL_COUNT,
> > diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> > index 9c14f9505faf..c497dd8d9724 100644
> > --- a/drivers/gpu/drm/xe/xe_pagefault.c
> > +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> > @@ -364,6 +364,7 @@ xe_pagefault_queue_requeue(struct xe_pagefault_queue *pf_queue,
> >   					    usm.pf_queue);
> >   	struct xe_pagefault *next = pf->consumer.next, *lpf;
> > +	xe_gt_stats_incr(gt, XE_GT_STATS_ID_CHAIN_MISMATCH_PAGEFAULT_COUNT, 1);
> >   	xe_assert(xe, pf->consumer.alloc_state ==
> >   		  XE_PAGEFAULT_ALLOC_STATE_CHAINED);
> > @@ -423,6 +424,10 @@ static bool xe_pagefault_cache_hit(struct xe_pagefault_queue *pf_queue,
> >   			xe_assert(xe, pf_work->cache.pf->consumer.alloc_state ==
> >   				  XE_PAGEFAULT_ALLOC_STATE_ACTIVE);
> > +			xe_gt_stats_incr(pf->gt,
> > +					 XE_GT_STATS_ID_CHAIN_PAGEFAULT_COUNT,
> > +					 1);
> > +
> >   			pf->consumer.alloc_state =
> >   				XE_PAGEFAULT_ALLOC_STATE_CHAINED;
> >   			pf->consumer.next = pf_work->cache.pf->consumer.next;
> > @@ -559,8 +564,10 @@ static void xe_pagefault_queue_work(struct work_struct *w)
> >   		/* Last fault same address, ack immediately */
> >   		if (xe_pagefault_cache_match(pf, cache_start, cache_end,
> > -					     cache_asid))
> > +					     cache_asid)) {
> > +			xe_gt_stats_incr(gt, XE_GT_STATS_ID_LAST_PAGEFAULT_COUNT, 1);
> >   			goto ack_fault;
> > +		}
> >   		err = xe_pagefault_service(pf);
> > @@ -816,8 +823,15 @@ int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf)
> >   		lpf->consumer.next = NULL;
> >   		if (xe_pagefault_cache_hit(pf_queue, lpf)) {
> > -			if (empty)
> > +			xe_gt_stats_incr(pf->gt,
> > +					 XE_GT_STATS_ID_CHAIN_IRQ_PAGEFAULT_COUNT,
> > +					 1);
> > +			if (empty) {
> >   				xe_pagefault_queue_advance(pf_queue);
> > +				xe_gt_stats_incr(pf->gt,
> > +						 XE_GT_STATS_ID_CHAIN_DRAIN_IRQ_PAGEFAULT_COUNT,
> > +						 1);
> > +			}
> >   		} else {
> >   			int work_index = xe_pagefault_work_index(xe);
> 
> Looks good,
> 
> Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
> 
> 

Actually the patch now causes this warning during build:

    drivers/gpu/drm/xe/xe_gt_stats_types.h:186 Enum value 'XE_GT_STATS_ID_PAGEFAULT_US' not described in enum 'xe_gt_stats_id'

So please add a description in the kernel doc, like for other GT stats entries.

Francois

  reply	other threads:[~2026-05-07 13:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  4:28 [PATCH v4 00/12] Fine grained fault locking, threaded prefetch, storm cache Matthew Brost
2026-02-26  4:28 ` [PATCH v4 01/12] drm/xe: Fine grained page fault locking Matthew Brost
2026-02-26  4:28 ` [PATCH v4 02/12] drm/xe: Allow prefetch-only VM bind IOCTLs to use VM read lock Matthew Brost
2026-02-26  4:28 ` [PATCH v4 03/12] drm/xe: Thread prefetch of SVM ranges Matthew Brost
2026-02-26  4:28 ` [PATCH v4 04/12] drm/xe: Use a single page-fault queue with multiple workers Matthew Brost
2026-05-06 15:46   ` Maciej Patelczyk
2026-05-06 19:42     ` Matthew Brost
2026-05-07 12:41       ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 05/12] drm/xe: Add num_pf_work modparam Matthew Brost
2026-05-06 15:59   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 06/12] drm/xe: Engine class and instance into a u8 Matthew Brost
2026-05-06 16:04   ` Maciej Patelczyk
2026-05-07 16:20     ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 07/12] drm/xe: Track pagefault worker runtime Matthew Brost
2026-05-07 12:51   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 08/12] drm/xe: Chain page faults via queue-resident cache to avoid fault storms Matthew Brost
2026-05-08 12:03   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 09/12] drm/xe: Add pagefault chaining stats Matthew Brost
2026-05-07 13:15   ` Maciej Patelczyk
2026-05-07 13:52     ` Francois Dugast [this message]
2026-02-26  4:28 ` [PATCH v4 10/12] drm/xe: Add debugfs pagefault_info Matthew Brost
2026-05-07 10:07   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 11/12] drm/xe: batch CT pagefault acks with periodic flush Matthew Brost
2026-05-08  9:24   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 12/12] drm/xe: Track parallel page fault activity in GT stats Matthew Brost
2026-05-07 13:56   ` Maciej Patelczyk
2026-05-07 14:23     ` Francois Dugast
2026-02-26  4:35 ` ✗ CI.checkpatch: warning for Fine grained fault locking, threaded prefetch, storm cache (rev4) Patchwork
2026-02-26  4:36 ` ✓ CI.KUnit: success " Patchwork
2026-02-26  5:26 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-02-26  8:59 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-26 13:43 ` [PATCH v4 00/12] Fine grained fault locking, threaded prefetch, storm cache Thomas Hellström
2026-02-26 19:36   ` Matthew Brost

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=afyZL1FY75IAkl4H@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=maciej.patelczyk@intel.com \
    --cc=matthew.brost@intel.com \
    --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