x86/itmt: Keep ITMT enabled when debugfs is unavailable
PATCH 1/1 x86/itmt: Keep ITMT enabled when debugfs is unavailable
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.
---
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(-)
arch/x86/kernel/itmt.c +17 -2
@@ -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 ; }
Signature · 1 line
2.39.5 (Apple Git-154)