Skip to content

Commit f126821

Browse files
superm1bp3tk0v
authored andcommitted
x86/itmt: Add debugfs file to show core priorities
Multiple drivers can report priorities to ITMT. To aid in debugging any issues with the values reported by drivers introduce a debugfs file to read out the values. Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent 13bc67a commit f126821

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

arch/x86/kernel/itmt.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ static ssize_t sched_itmt_enabled_write(struct file *filp,
5959
return result;
6060
}
6161

62+
static int sched_core_priority_show(struct seq_file *s, void *unused)
63+
{
64+
int cpu;
65+
66+
seq_puts(s, "CPU #\tPriority\n");
67+
for_each_possible_cpu(cpu)
68+
seq_printf(s, "%d\t%d\n", cpu, arch_asym_cpu_priority(cpu));
69+
70+
return 0;
71+
}
72+
DEFINE_SHOW_ATTRIBUTE(sched_core_priority);
73+
6274
static const struct file_operations dfs_sched_itmt_fops = {
6375
.read = debugfs_read_file_bool,
6476
.write = sched_itmt_enabled_write,
@@ -67,6 +79,7 @@ static const struct file_operations dfs_sched_itmt_fops = {
6779
};
6880

6981
static struct dentry *dfs_sched_itmt;
82+
static struct dentry *dfs_sched_core_prio;
7083

7184
/**
7285
* sched_set_itmt_support() - Indicate platform supports ITMT
@@ -102,6 +115,14 @@ int sched_set_itmt_support(void)
102115
return -ENOMEM;
103116
}
104117

118+
dfs_sched_core_prio = debugfs_create_file("sched_core_priority", 0644,
119+
arch_debugfs_dir, NULL,
120+
&sched_core_priority_fops);
121+
if (IS_ERR_OR_NULL(dfs_sched_core_prio)) {
122+
dfs_sched_core_prio = NULL;
123+
return -ENOMEM;
124+
}
125+
105126
sched_itmt_capable = true;
106127

107128
sysctl_sched_itmt_enabled = 1;
@@ -133,6 +154,8 @@ void sched_clear_itmt_support(void)
133154

134155
debugfs_remove(dfs_sched_itmt);
135156
dfs_sched_itmt = NULL;
157+
debugfs_remove(dfs_sched_core_prio);
158+
dfs_sched_core_prio = NULL;
136159

137160
if (sysctl_sched_itmt_enabled) {
138161
/* disable sched_itmt if we are no longer ITMT capable */

0 commit comments

Comments
 (0)