Skip to content

Commit 84d3763

Browse files
committed
drm/xe/pf: Don't show GGTT/LMEM debugfs files under media GT
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> Tested-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com> Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com> Link: https://lore.kernel.org/r/20250411193030.1865-1-michal.wajdeczko@intel.com
1 parent d11c5a9 commit 84d3763

File tree

1 file changed

+49
-17
lines changed

1 file changed

+49
-17
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,17 @@ static unsigned int extract_vfid(struct dentry *d)
5151
* /sys/kernel/debug/dri/0/
5252
* ├── gt0
5353
* │   ├── pf
54-
* │   │   ├── ggtt_available
55-
* │   │   ├── ggtt_provisioned
5654
* │   │   ├── contexts_provisioned
5755
* │   │   ├── doorbells_provisioned
5856
* │   │   ├── runtime_registers
5957
* │   │   ├── negotiated_versions
6058
* │   │   ├── adverse_events
59+
* ├── gt1
60+
* │   ├── pf
61+
* │   │   ├── ...
6162
*/
6263

6364
static const struct drm_info_list pf_info[] = {
64-
{
65-
"ggtt_available",
66-
.show = xe_gt_debugfs_simple_show,
67-
.data = xe_gt_sriov_pf_config_print_available_ggtt,
68-
},
69-
{
70-
"ggtt_provisioned",
71-
.show = xe_gt_debugfs_simple_show,
72-
.data = xe_gt_sriov_pf_config_print_ggtt,
73-
},
7465
{
7566
"contexts_provisioned",
7667
.show = xe_gt_debugfs_simple_show,
@@ -81,11 +72,6 @@ static const struct drm_info_list pf_info[] = {
8172
.show = xe_gt_debugfs_simple_show,
8273
.data = xe_gt_sriov_pf_config_print_dbs,
8374
},
84-
{
85-
"lmem_provisioned",
86-
.show = xe_gt_debugfs_simple_show,
87-
.data = xe_gt_sriov_pf_config_print_lmem,
88-
},
8975
{
9076
"runtime_registers",
9177
.show = xe_gt_debugfs_simple_show,
@@ -103,6 +89,42 @@ static const struct drm_info_list pf_info[] = {
10389
},
10490
};
10591

92+
/*
93+
* /sys/kernel/debug/dri/0/
94+
* ├── gt0
95+
* │   ├── pf
96+
* │   │   ├── ggtt_available
97+
* │   │   ├── ggtt_provisioned
98+
*/
99+
100+
static const struct drm_info_list pf_ggtt_info[] = {
101+
{
102+
"ggtt_available",
103+
.show = xe_gt_debugfs_simple_show,
104+
.data = xe_gt_sriov_pf_config_print_available_ggtt,
105+
},
106+
{
107+
"ggtt_provisioned",
108+
.show = xe_gt_debugfs_simple_show,
109+
.data = xe_gt_sriov_pf_config_print_ggtt,
110+
},
111+
};
112+
113+
/*
114+
* /sys/kernel/debug/dri/0/
115+
* ├── gt0
116+
* │   ├── pf
117+
* │   │   ├── lmem_provisioned
118+
*/
119+
120+
static const struct drm_info_list pf_lmem_info[] = {
121+
{
122+
"lmem_provisioned",
123+
.show = xe_gt_debugfs_simple_show,
124+
.data = xe_gt_sriov_pf_config_print_lmem,
125+
},
126+
};
127+
106128
/*
107129
* /sys/kernel/debug/dri/0/
108130
* ├── gt0
@@ -532,6 +554,16 @@ void xe_gt_sriov_pf_debugfs_register(struct xe_gt *gt, struct dentry *root)
532554
pfdentry->d_inode->i_private = gt;
533555

534556
drm_debugfs_create_files(pf_info, ARRAY_SIZE(pf_info), pfdentry, minor);
557+
if (!xe_gt_is_media_type(gt)) {
558+
drm_debugfs_create_files(pf_ggtt_info,
559+
ARRAY_SIZE(pf_ggtt_info),
560+
pfdentry, minor);
561+
if (IS_DGFX(gt_to_xe(gt)))
562+
drm_debugfs_create_files(pf_lmem_info,
563+
ARRAY_SIZE(pf_lmem_info),
564+
pfdentry, minor);
565+
}
566+
535567
pf_add_policy_attrs(gt, pfdentry);
536568
pf_add_config_attrs(gt, pfdentry, PFID);
537569

0 commit comments

Comments
 (0)