* [PATCH] x86/itmt: Keep ITMT enabled when debugfs is unavailable
@ 2026-04-11 0:41 Cao Ruichuang
0 siblings, 0 replies; 2+ messages in thread
From: Cao Ruichuang @ 2026-04-11 0:41 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86
Cc: H. Peter Anvin, linux-kernel
SCHED_MC_PRIO should not depend on DEBUG_FS for its runtime behavior.
debugfs_create_file*() intentionally returns -ENODEV when CONFIG_DEBUG_FS
is disabled so callers can distinguish "debugfs unavailable" from a real
error. sched_set_itmt_support() currently treats that case as fatal and
returns an error before enabling ITMT support.
As a result, systems built with SCHED_MC_PRIO=y and DEBUG_FS=n silently
lose ITMT scheduling support even though the two debugfs files created in
itmt.c are only a debug toggle and a debug view of core priorities.
Treat -ENODEV from the debugfs helpers as "no debugfs support" and keep
going. Continue to fail on real debugfs creation errors.
Reported-by: akinzler <bugzilla@kernel.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=220638
Signed-off-by: Cao Ruichuang <create0818@163.com>
---
arch/x86/kernel/itmt.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
index 243a769fdd9..c3e40df7da7 100644
--- a/arch/x86/kernel/itmt.c
+++ b/arch/x86/kernel/itmt.c
@@ -100,6 +100,8 @@ static struct dentry *dfs_sched_core_prio;
*/
int sched_set_itmt_support(void)
{
+ int ret;
+
guard(mutex)(&itmt_update_mutex);
if (sched_itmt_capable)
@@ -110,16 +112,29 @@ int sched_set_itmt_support(void)
arch_debugfs_dir,
&sysctl_sched_itmt_enabled,
&dfs_sched_itmt_fops);
- if (IS_ERR_OR_NULL(dfs_sched_itmt)) {
+ if (IS_ERR(dfs_sched_itmt)) {
+ ret = PTR_ERR(dfs_sched_itmt);
dfs_sched_itmt = NULL;
+ if (ret != -ENODEV)
+ return ret;
+ } else if (!dfs_sched_itmt) {
return -ENOMEM;
}
dfs_sched_core_prio = debugfs_create_file("sched_core_priority", 0644,
arch_debugfs_dir, NULL,
&sched_core_priority_fops);
- if (IS_ERR_OR_NULL(dfs_sched_core_prio)) {
+ if (IS_ERR(dfs_sched_core_prio)) {
+ ret = PTR_ERR(dfs_sched_core_prio);
dfs_sched_core_prio = NULL;
+ if (ret != -ENODEV) {
+ debugfs_remove(dfs_sched_itmt);
+ dfs_sched_itmt = NULL;
+ return ret;
+ }
+ } else if (!dfs_sched_core_prio) {
+ debugfs_remove(dfs_sched_itmt);
+ dfs_sched_itmt = NULL;
return -ENOMEM;
}
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] x86/itmt: Keep ITMT enabled when debugfs is unavailable
@ 2026-04-11 11:17 Cao Ruichuang
0 siblings, 0 replies; 2+ messages in thread
From: Cao Ruichuang @ 2026-04-11 11:17 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H . Peter Anvin, linux-kernel
Cc: akinzler
SCHED_MC_PRIO should not depend on DEBUG_FS for its runtime behavior.
debugfs_create_file*() intentionally returns -ENODEV when CONFIG_DEBUG_FS
is disabled so callers can distinguish "debugfs unavailable" from a real
error. sched_set_itmt_support() currently treats that case as fatal and
returns an error before enabling ITMT support.
As a result, systems built with SCHED_MC_PRIO=y and DEBUG_FS=n silently
lose ITMT scheduling support even though the two debugfs files created in
itmt.c are only a debug toggle and a debug view of core priorities.
Treat -ENODEV from the debugfs helpers as "no debugfs support" and keep
going. Continue to fail on real debugfs creation errors.
Fixes: d04013a4b21b ("x86/itmt: Move the "sched_itmt_enabled" sysctl to debugfs")
Reported-by: akinzler <bugzilla@kernel.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220638
Signed-off-by: Cao Ruichuang <create0818@163.com>
---
Testing:
- latest-tree local compile validation with `CONFIG_DEBUG_FS=n` succeeded
(`CC arch/x86/kernel/itmt.o`)
Note:
- meaningful local runtime validation is not currently possible here because
the available host and guest CPUs are older Ivy Bridge parts, not
ITMT-capable Intel hybrid systems
arch/x86/kernel/itmt.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
index 243a769fdd9..c3e40df7da7 100644
--- a/arch/x86/kernel/itmt.c
+++ b/arch/x86/kernel/itmt.c
@@ -100,6 +100,8 @@ static struct dentry *dfs_sched_core_prio;
*/
int sched_set_itmt_support(void)
{
+ int ret;
+
guard(mutex)(&itmt_update_mutex);
if (sched_itmt_capable)
@@ -110,16 +112,29 @@ int sched_set_itmt_support(void)
arch_debugfs_dir,
&sysctl_sched_itmt_enabled,
&dfs_sched_itmt_fops);
- if (IS_ERR_OR_NULL(dfs_sched_itmt)) {
+ if (IS_ERR(dfs_sched_itmt)) {
+ ret = PTR_ERR(dfs_sched_itmt);
dfs_sched_itmt = NULL;
+ if (ret != -ENODEV)
+ return ret;
+ } else if (!dfs_sched_itmt) {
return -ENOMEM;
}
dfs_sched_core_prio = debugfs_create_file("sched_core_priority", 0644,
arch_debugfs_dir, NULL,
&sched_core_priority_fops);
- if (IS_ERR_OR_NULL(dfs_sched_core_prio)) {
+ if (IS_ERR(dfs_sched_core_prio)) {
+ ret = PTR_ERR(dfs_sched_core_prio);
dfs_sched_core_prio = NULL;
+ if (ret != -ENODEV) {
+ debugfs_remove(dfs_sched_itmt);
+ dfs_sched_itmt = NULL;
+ return ret;
+ }
+ } else if (!dfs_sched_core_prio) {
+ debugfs_remove(dfs_sched_itmt);
+ dfs_sched_itmt = NULL;
return -ENOMEM;
}
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-11 11:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11 11:17 [PATCH] x86/itmt: Keep ITMT enabled when debugfs is unavailable Cao Ruichuang
-- strict thread matches above, loose matches on Subject: below --
2026-04-11 0:41 Cao Ruichuang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox