Mm, wants a build bandaid for !CONFIG_LOCKDEP

kernel/cpu.c: In function ‘_cpu_down’:
kernel/cpu.c:720:43: error: ‘cpuhp_state_down_key’ undeclared (first use in 
this function)
  lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-down",
                                           ^
kernel/cpu.c:720:43: note: each undeclared identifier is reported only once for 
each function it appears in
kernel/cpu.c: In function ‘_cpu_up’:
kernel/cpu.c:836:41: error: ‘cpuhp_state_up_key’ undeclared (first use in this 
function)
  lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-up",
                                         ^
scripts/Makefile.build:311: recipe for target 'kernel/cpu.o' failed
make[1]: *** [kernel/cpu.o] Error 1
Makefile:1666: recipe for target 'kernel/cpu.o' failed
make: *** [kernel/cpu.o] Error 2

(mine below, fold or vaporize as you see fit)

---
 kernel/cpu.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -545,7 +545,7 @@ void __init cpuhp_threads_init(void)
  * Must be macro to ensure we have two different call sites.
  */
 #ifdef CONFIG_LOCKDEP
-#define lockdep_reinit_st_done()                               \
+#define lockdep_reinit_st_done(up)                             \
 do {                                                           \
        int __cpu;                                              \
        for_each_possible_cpu(__cpu) {                          \
@@ -553,9 +553,17 @@ do {                                                       
        \
                        per_cpu_ptr(&cpuhp_state, __cpu);       \
                init_completion(&st->done);                     \
        }                                                       \
+       if (up)                                                 \
+               lockdep_init_map(&cpuhp_state_lock_map,         \
+                                "cpuhp_state-up",              \
+                                &cpuhp_state_up_key, 0);       \
+       else                                                    \
+               lockdep_init_map(&cpuhp_state_lock_map,         \
+                                "cpuhp_state-down",            \
+                                &cpuhp_state_down_key, 0);     \
 } while(0)
 #else
-#define lockdep_reinit_st_done()
+#define lockdep_reinit_st_done(up)
 #endif
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -716,9 +724,7 @@ static int __ref _cpu_down(unsigned int
 
        cpus_write_lock();
 
-       lockdep_reinit_st_done();
-       lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-down",
-                        &cpuhp_state_down_key, 0);
+       lockdep_reinit_st_done(0);
 
        cpuhp_tasks_frozen = tasks_frozen;
 
@@ -832,9 +838,7 @@ static int _cpu_up(unsigned int cpu, int
 
        cpus_write_lock();
 
-       lockdep_reinit_st_done();
-       lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-up",
-                        &cpuhp_state_up_key, 0);
+       lockdep_reinit_st_done(1);
 
        if (!cpu_present(cpu)) {
                ret = -EINVAL;

Reply via email to