Skip to content
Snippets Groups Projects
Commit 42412d30 authored by Hanjun Guo's avatar Hanjun Guo Committed by Yang Yingliang
Browse files

sched/debug: Fix 'sched_debug_lock' undeclared error

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: default avatarHanjun Guo <guohanjun@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent ad13dcaf
No related branches found
Tags 4.19.90-2104.1.0
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment