Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/pf: Don't show GGTT/LMEM debugfs files under media GT
Date: Mon, 14 Apr 2025 11:13:33 +0200	[thread overview]
Message-ID: <8b12a377-b4f3-4184-82ad-96885d384e2a@linux.intel.com> (raw)
In-Reply-To: <20250411193030.1865-1-michal.wajdeczko@intel.com>



On 4/11/2025 9:30 PM, Michal Wajdeczko wrote:
> Most of the PF's debugfs files (and their implementations) are
> based on the GT hierarchy even if files are related to GGTT or
> LMEM data, that are related to the tile.
> 
> While we could reach the tile data from any GT, to avoid potential
> misuse, some functions allow to be used on the primary GT only,
> and may use asserts to enforce that.
> 
> In our case, the following assert could be seen when reading the
> /sys/kernel/debug/dri/0000:00:02.0/gt1/pf/ggtt_available
> 
>   [ ] xe 0000:00:02.0: [drm] Assertion `!xe_gt_is_media_type(gt)` failed!
>   [ ] WARNING: CPU: 4 PID: 10609 at drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c:379 pf_get_spare_ggtt+0x256/0x4e0 [xe]
>   [ ] RIP: 0010:pf_get_spare_ggtt+0x256/0x4e0 [xe]
>   [ ] Call Trace:
>   [ ]  <TASK>
>   [ ]  xe_gt_sriov_pf_config_print_available_ggtt+0xb7/0x480 [xe]
>   [ ]  ? __memcg_slab_post_alloc_hook+0x12f/0x3f0
>   [ ]  xe_gt_debugfs_simple_show+0x7b/0xb0 [xe]
>   [ ]  ? __pfx___drm_printfn_seq_file+0x10/0x10
>   [ ]  ? __pfx___drm_puts_seq_file+0x10/0x10
>   [ ]  seq_read_iter+0x139/0x4e0
>   [ ]  seq_read+0x11d/0x160
>   [ ]  full_proxy_read+0x6b/0xb0
>   [ ]  vfs_read+0xfa/0x390
> 
> Fix that by moving GGTT/LMEM debugfs attributes to separate lists
> and register them only when applicable (on primary GT, on DGFX).
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c | 66 +++++++++++++++------
>   1 file changed, 49 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> index b2521dd6ec42..0fe47f41b63c 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> @@ -51,26 +51,17 @@ static unsigned int extract_vfid(struct dentry *d)
>    *      /sys/kernel/debug/dri/0/
>    *      ├── gt0
>    *      │   ├── pf
> - *      │   │   ├── ggtt_available
> - *      │   │   ├── ggtt_provisioned
>    *      │   │   ├── contexts_provisioned
>    *      │   │   ├── doorbells_provisioned
>    *      │   │   ├── runtime_registers
>    *      │   │   ├── negotiated_versions
>    *      │   │   ├── adverse_events
> + *      ├── gt1
> + *      │   ├── pf
> + *      │   │   ├── ...
>    */
>   
>   static const struct drm_info_list pf_info[] = {
> -	{
> -		"ggtt_available",
> -		.show = xe_gt_debugfs_simple_show,
> -		.data = xe_gt_sriov_pf_config_print_available_ggtt,
> -	},
> -	{
> -		"ggtt_provisioned",
> -		.show = xe_gt_debugfs_simple_show,
> -		.data = xe_gt_sriov_pf_config_print_ggtt,
> -	},
>   	{
>   		"contexts_provisioned",
>   		.show = xe_gt_debugfs_simple_show,
> @@ -81,11 +72,6 @@ static const struct drm_info_list pf_info[] = {
>   		.show = xe_gt_debugfs_simple_show,
>   		.data = xe_gt_sriov_pf_config_print_dbs,
>   	},
> -	{
> -		"lmem_provisioned",
> -		.show = xe_gt_debugfs_simple_show,
> -		.data = xe_gt_sriov_pf_config_print_lmem,
> -	},
>   	{
>   		"runtime_registers",
>   		.show = xe_gt_debugfs_simple_show,
> @@ -103,6 +89,42 @@ static const struct drm_info_list pf_info[] = {
>   	},
>   };
>   
> +/*
> + *      /sys/kernel/debug/dri/0/
> + *      ├── gt0
> + *      │   ├── pf
> + *      │   │   ├── ggtt_available
> + *      │   │   ├── ggtt_provisioned
> + */
> +
> +static const struct drm_info_list pf_ggtt_info[] = {
> +	{
> +		"ggtt_available",
> +		.show = xe_gt_debugfs_simple_show,
> +		.data = xe_gt_sriov_pf_config_print_available_ggtt,
> +	},
> +	{
> +		"ggtt_provisioned",
> +		.show = xe_gt_debugfs_simple_show,
> +		.data = xe_gt_sriov_pf_config_print_ggtt,
> +	},
> +};
> +
> +/*
> + *      /sys/kernel/debug/dri/0/
> + *      ├── gt0
> + *      │   ├── pf
> + *      │   │   ├── lmem_provisioned
> + */
> +
> +static const struct drm_info_list pf_lmem_info[] = {
> +	{
> +		"lmem_provisioned",
> +		.show = xe_gt_debugfs_simple_show,
> +		.data = xe_gt_sriov_pf_config_print_lmem,
> +	},
> +};
> +
>   /*
>    *      /sys/kernel/debug/dri/0/
>    *      ├── gt0
> @@ -532,6 +554,16 @@ void xe_gt_sriov_pf_debugfs_register(struct xe_gt *gt, struct dentry *root)
>   	pfdentry->d_inode->i_private = gt;
>   
>   	drm_debugfs_create_files(pf_info, ARRAY_SIZE(pf_info), pfdentry, minor);
> +	if (!xe_gt_is_media_type(gt)) {
> +		drm_debugfs_create_files(pf_ggtt_info,
> +					 ARRAY_SIZE(pf_ggtt_info),
> +					 pfdentry, minor);
> +		if (IS_DGFX(gt_to_xe(gt)))
> +			drm_debugfs_create_files(pf_lmem_info,
> +						 ARRAY_SIZE(pf_lmem_info),
> +						 pfdentry, minor);
> +	}
> +
>   	pf_add_policy_attrs(gt, pfdentry);
>   	pf_add_config_attrs(gt, pfdentry, PFID);
>   
LGTM,
Tested with igt@intel_sysfs_debugfs@xe-debugfs-read-all-entries.

Tested-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>


      parent reply	other threads:[~2025-04-14  9:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 19:30 [PATCH] drm/xe/pf: Don't show GGTT/LMEM debugfs files under media GT Michal Wajdeczko
2025-04-11 21:03 ` ✓ CI.Patch_applied: success for " Patchwork
2025-04-11 21:04 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-11 21:05 ` ✓ CI.KUnit: success " Patchwork
2025-04-11 21:13 ` ✓ CI.Build: " Patchwork
2025-04-11 21:15 ` ✓ CI.Hooks: " Patchwork
2025-04-11 21:17 ` ✓ CI.checksparse: " Patchwork
2025-04-11 22:02 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-11 23:59 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-14 10:41   ` Michal Wajdeczko
2025-04-14  9:13 ` Bernatowicz, Marcin [this message]

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=8b12a377-b4f3-4184-82ad-96885d384e2a@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@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