
From: Hanjun Guo <guohanjun@huawei.com> hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I46CWD?from=project-issue CVE: NA ----------------------------------------------- Build error: /builds/linux/kernel/sched/debug.c: In function 'print_cpu_tidy': /builds/linux/kernel/sched/debug.c:812:21: error: 'sched_debug_lock' undeclared (first use in this function); did you mean 'sched_debug_show'? 812 | spin_lock_irqsave(&sched_debug_lock, flags); | ^~~~~~~~~~~~~~~~ /builds/linux/include/linux/spinlock.h:241:34: note: in definition of macro 'raw_spin_lock_irqsave' 241 | flags = _raw_spin_lock_irqsave(lock); \ | ^~~~ /builds/linux/kernel/sched/debug.c:812:2: note: in expansion of macro 'spin_lock_irqsave' 812 | spin_lock_irqsave(&sched_debug_lock, flags); | ^~~~~~~~~~~~~~~~~ /builds/linux/kernel/sched/debug.c:812:21: note: each undeclared identifier is reported only once for each function it appears in 812 | spin_lock_irqsave(&sched_debug_lock, flags); | ^~~~~~~~~~~~~~~~ /builds/linux/include/linux/spinlock.h:241:34: note: in definition of macro 'raw_spin_lock_irqsave' 241 | flags = _raw_spin_lock_irqsave(lock); \ | ^~~~ /builds/linux/kernel/sched/debug.c:812:2: note: in expansion of macro 'spin_lock_irqsave' 812 | spin_lock_irqsave(&sched_debug_lock, flags); | ^~~~~~~~~~~~~~~~~ make[3]: *** [/builds/linux/scripts/Makefile.build:303: kernel/sched/debug.o] Error 1 make[3]: Target '__build' not remade because of errors. This is because we backported stable commit "sched/debug: Fix cgroup_path[] serialization", and that commit move the sched_debug_lock into #ifdef CONFIG_CGROUP_SCHED .. #endif, which will raise compile error when we set CONFIG_CGROUP_SCHED to n. The purpose of sched_debug_lock is to serialize the use of the global cgroup_path[] buffer in print_cpu(). The rests of the printk calls don't need serialization from sched_debug_lock. Fix it by removing the sched_debug_lock in print_cpu_tidy(). Signed-off-by: Hanjun Guo <guohanjun@huawei.com> Reviewed-by: Xie XiuQi <xiexiuqi@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- kernel/sched/debug.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 3353a2f936f33..fcf2a07ece055 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -806,15 +806,10 @@ void sysrq_sched_debug_show(void) static void print_cpu_tidy(struct seq_file *m, int cpu) { struct rq *run_queue = cpu_rq(cpu); - unsigned long flags; SEQ_printf(m, "cpu#%d\n", cpu); - spin_lock_irqsave(&sched_debug_lock, flags); - print_rq(m, run_queue, cpu); - spin_unlock_irqrestore(&sched_debug_lock, flags); SEQ_printf(m, "\n"); - } void sysrq_sched_debug_tidy(void) -- 2.25.1