Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>, <matthew.auld@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/3] drm/xe/gt_stats: Detect and log overflow
Date: Tue, 25 Feb 2025 18:34:46 +0100	[thread overview]
Message-ID: <Z73_NsccUSG3FjNj@fdugast-desk> (raw)
In-Reply-To: <u2rjimcjpdknreojf22kyb3s6j4b7h6ki2zr6455nxgqxj4xzn@jpb6jxsp3chy>

On Tue, Feb 25, 2025 at 09:41:15AM -0600, Lucas De Marchi wrote:
> On Tue, Feb 25, 2025 at 02:17:04PM +0100, Francois Dugast wrote:
> > Check if the atomic counter limit has been reached and if that is the
> > case, set the counter value to the new increment to prevent keeping
> > a garbage value, and notify it in the kernel log as below:
> > 
> >    [drm:xe_gt_stats_incr [xe]] GT0: stats vma_pagefault_bytes overflow, resetting
> > 
> > Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_gt_stats.c | 18 ++++++++++++------
> > 1 file changed, 12 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c b/drivers/gpu/drm/xe/xe_gt_stats.c
> > index 2e9879ea4674..753c081b68a6 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> > @@ -8,8 +8,15 @@
> > #include <drm/drm_print.h>
> > 
> > #include "xe_gt.h"
> > +#include "xe_gt_printk.h"
> > #include "xe_gt_stats.h"
> > 
> > +static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
> > +	"tlb_inval_count",
> > +	"vma_pagefault_count",
> > +	"vma_pagefault_bytes",
> > +};
> > +
> > /**
> >  * xe_gt_stats_incr - Increments the specified stats counter
> >  * @gt: GT structure
> > @@ -24,13 +31,12 @@ void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr)
> > 		return;
> > 
> > 	atomic_add(incr, &gt->stats.counters[id]);
> > -}
> > 
> > -static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
> > -	"tlb_inval_count",
> > -	"vma_pagefault_count",
> > -	"vma_pagefault_bytes",
> > -};
> > +	if (atomic_read(&gt->stats.counters[id]) < 0) {
> 
> why are we not using unsigned logic? it stops being atomic when you
> update/read/set.

That is right, thanks for catching this.

@Matt: with the 2 other patches of the series, the counter limit was increased
so much that the purpose of this patch is much less relevant. Is it fine with
you if I retain your RB and merge the 2 other patches of this series, without
this one?

Francois

> 
> Lucas De Marchi
> 
> > +		xe_gt_dbg(gt, "stats %s overflow, resetting\n", stat_description[id]);
> > +		atomic_set(&gt->stats.counters[id], incr);
> > +	}
> > +}
> > 
> > /**
> >  * xe_gt_stats_print_info - Print the GT stats
> > -- 
> > 2.43.0
> > 

  parent reply	other threads:[~2025-02-25 17:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25 13:17 [PATCH 0/3] Minor improvements to GT stats Francois Dugast
2025-02-25 13:17 ` [PATCH 1/3] drm/xe/gt_stats: Detect and log overflow Francois Dugast
2025-02-25 14:07   ` Matthew Auld
2025-02-25 15:41   ` Lucas De Marchi
2025-02-25 15:46     ` Lucas De Marchi
2025-02-25 17:34     ` Francois Dugast [this message]
2025-02-25 17:37       ` Matthew Auld
2025-02-25 13:17 ` [PATCH 2/3] drm/xe/gt_stats: Use atomic64_t for counters Francois Dugast
2025-02-25 13:54   ` Matthew Auld
2025-02-25 13:17 ` [PATCH 3/3] drm/xe/gt_pagefault: Change vma_pagefault unit to kilobyte Francois Dugast
2025-02-25 14:04   ` Matthew Auld
2025-02-25 13:49 ` ✓ CI.Patch_applied: success for Minor improvements to GT stats Patchwork
2025-02-25 13:49 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-25 13:50 ` ✓ CI.KUnit: success " Patchwork
2025-02-25 14:07 ` ✓ CI.Build: " Patchwork
2025-02-25 14:09 ` ✓ CI.Hooks: " Patchwork
2025-02-25 14:11 ` ✓ CI.checksparse: " Patchwork
2025-02-25 14:30 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-25 20:27 ` ✗ Xe.CI.Full: 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=Z73_NsccUSG3FjNj@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.auld@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