Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>
Cc: "Purkait, Soham" <soham.purkait@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Nilawar, Badal" <badal.nilawar@intel.com>,
	"Poosa, Karthik" <karthik.poosa@intel.com>,
	 "De Marchi, Lucas" <lucas.demarchi@intel.com>,
	"Dixit, Ashutosh" <ashutosh.dixit@intel.com>,
	"Tauro, Riana" <riana.tauro@intel.com>
Subject: Re: [PATCH 2/4] drm/xe/xe_debugfs: Exposure of G8 residency counter
Date: Wed, 14 May 2025 12:27:49 -0400	[thread overview]
Message-ID: <aCTEhUCSIxVJJSNT@intel.com> (raw)
In-Reply-To: <CY5PR11MB6211DB2EB721F392610831779591A@CY5PR11MB6211.namprd11.prod.outlook.com>

On Wed, May 14, 2025 at 04:44:14AM -0400, Gupta, Anshuman wrote:
> 
> 
> > -----Original Message-----
> > From: Purkait, Soham <soham.purkait@intel.com>
> > Sent: Wednesday, May 14, 2025 1:37 PM
> > To: intel-xe@lists.freedesktop.org; Gupta, Anshuman
> > <anshuman.gupta@intel.com>; Nilawar, Badal <badal.nilawar@intel.com>;
> > Poosa, Karthik <karthik.poosa@intel.com>
> > Cc: De Marchi, Lucas <lucas.demarchi@intel.com>; Purkait, Soham
> > <soham.purkait@intel.com>; Dixit, Ashutosh <ashutosh.dixit@intel.com>;
> > Tauro, Riana <riana.tauro@intel.com>
> > Subject: [PATCH 2/4] drm/xe/xe_debugfs: Exposure of G8 residency counter
> > 
> > Add a debugfs node named g8_residency in order to obtain the G8 residency
> > counter value.
> IMO better to expose all such residencies under a debugfs called dgfx_pkgc_residencies 
> CC @Vivi, Rodrigo for naming suggestion. 
> Context: This is similar to cpu PC8~PC10 residencies. i.e  /sys/kernel/debug/pmc_core/package_cstate_show 

I'm with Anshuman here. I'm bad with naming though.

Perhaps dgfx_package_cstate_show ?

And format something like this as well:

$ sudo cat /sys/kernel/debug/pmc_core/package_cstate_show
Package C2 : 3250051350
Package C3 : 19056503
Package C6 : 929010443
Package C7 : 0
Package C8 : 2718
Package C9 : 0
Package C10 : 0

But of course, just adding the ones that are relevant to us.

And dgfx_pkgc_residencies also works for me... no preference to either one

> 
> Thanks,
> Anshuman.
> > 
> > Signed-off-by: Soham Purkait <soham.purkait@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_debugfs.c | 37
> > +++++++++++++++++++++++++++++++++
> > drivers/gpu/drm/xe/xe_debugfs.h |  2 ++
> >  2 files changed, 39 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_debugfs.c
> > b/drivers/gpu/drm/xe/xe_debugfs.c index d0503959a8ed..f9ab6a03af29
> > 100644
> > --- a/drivers/gpu/drm/xe/xe_debugfs.c
> > +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> > @@ -11,16 +11,19 @@
> > 
> >  #include <drm/drm_debugfs.h>
> > 
> > +#include "regs/xe_pmt.h"
> >  #include "xe_bo.h"
> >  #include "xe_device.h"
> >  #include "xe_force_wake.h"
> >  #include "xe_gt_debugfs.h"
> >  #include "xe_gt_printk.h"
> >  #include "xe_guc_ads.h"
> > +#include "xe_mmio.h"
> >  #include "xe_pm.h"
> >  #include "xe_pxp_debugfs.h"
> >  #include "xe_sriov.h"
> >  #include "xe_step.h"
> > +#include "xe_vsec.h"
> > 
> >  #ifdef CONFIG_DRM_XE_DEBUG
> >  #include "xe_bo_evict.h"
> > @@ -185,12 +188,43 @@ static ssize_t wedged_mode_set(struct file *f,
> > const char __user *ubuf,
> >  	return size;
> >  }
> > 
> > +static ssize_t g8_residency_show(struct file *f, char __user *ubuf,
> > +				 size_t size, loff_t *pos)
> > +{
> > +	u64 reg_val;
> > +	char buf[32];
> > +	int len = 0;
> > +	int ret = 0;
> > +	struct xe_device *xe;
> > +	struct xe_mmio *mmio;
> > +
> > +	xe = file_inode(f)->i_private;
> > +	mmio = xe_root_tile_mmio(xe);
> > +	ret = xe_pmt_telem_read(to_pci_dev(xe->drm.dev),
> > +				xe_mmio_read32(mmio,
> > PUNIT_TELEMETRY_GUID),
> > +				&reg_val,
> > +				BMG_G8_RESIDENCY_OFFSET,
> > +				sizeof(reg_val));
> > +
> > +	drm_warn(&xe->drm, "G8 Residency read from mbx 0x%016llx, ret
> > %d\n",
> > +		 reg_val, ret);
> > +
> > +	len = scnprintf(buf, sizeof(buf), "%llu\n", reg_val);
> > +
> > +	return simple_read_from_buffer(ubuf, size, pos, buf, len); }
> > +
> >  static const struct file_operations wedged_mode_fops = {
> >  	.owner = THIS_MODULE,
> >  	.read = wedged_mode_show,
> >  	.write = wedged_mode_set,
> >  };
> > 
> > +static const struct file_operations g8_residency_fops = {
> > +	.owner = THIS_MODULE,
> > +	.read = g8_residency_show,
> > +};
> > +
> >  void xe_debugfs_register(struct xe_device *xe)  {
> >  	struct ttm_device *bdev = &xe->ttm;
> > @@ -211,6 +245,9 @@ void xe_debugfs_register(struct xe_device *xe)
> >  	debugfs_create_file("wedged_mode", 0600, root, xe,
> >  			    &wedged_mode_fops);
> > 
> > +	debugfs_create_file("g8_residency", 0444, root, xe,
> > +			    &g8_residency_fops);
> > +
> >  	for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1;
> > ++mem_type) {
> >  		man = ttm_manager_type(bdev, mem_type);
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_debugfs.h
> > b/drivers/gpu/drm/xe/xe_debugfs.h index 17f4c2f1b5e4..86868a3cd379
> > 100644
> > --- a/drivers/gpu/drm/xe/xe_debugfs.h
> > +++ b/drivers/gpu/drm/xe/xe_debugfs.h
> > @@ -8,6 +8,8 @@
> > 
> >  struct xe_device;
> > 
> > +#define BMG_G8_RESIDENCY_OFFSET			(0x540)
> > +
> >  #ifdef CONFIG_DEBUG_FS
> >  void xe_debugfs_register(struct xe_device *xe);  #else
> > --
> > 2.34.1
> 

  reply	other threads:[~2025-05-14 16:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14  8:07 [PATCH 0/4] Add debugfs to expose G8, G10 and ModS residency Soham Purkait
2025-05-14  8:07 ` [PATCH 1/4] Utility function and macro for telemetry reading Soham Purkait
2025-05-14  9:27   ` Jani Nikula
2025-05-14 17:06     ` Poosa, Karthik
2025-05-14 17:18       ` Jani Nikula
2025-05-14  8:07 ` [PATCH 2/4] drm/xe/xe_debugfs: Exposure of G8 residency counter Soham Purkait
2025-05-14  8:44   ` Gupta, Anshuman
2025-05-14 16:27     ` Rodrigo Vivi [this message]
2025-05-14 11:07   ` Riana Tauro
2025-05-14  8:07 ` [PATCH 3/4] drm/xe/xe_debugfs: Exposure of G10 " Soham Purkait
2025-05-14  8:07 ` [PATCH 4/4] drm/xe/xe_debugfs: Exposure of Mods " Soham Purkait
2025-05-14 11:10   ` Riana Tauro
2025-05-14 21:16 ` ✗ CI.Patch_applied: failure for Add debugfs to expose G8, G10 and ModS residency Patchwork
2025-05-27  0:53 ` 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=aCTEhUCSIxVJJSNT@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=soham.purkait@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