diff options
author | Andrey Ryabinin <aryabinin@virtuozzo.com> | 2016-02-04 14:29:36 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-09 06:03:25 -0500 |
commit | 06bea3dbfe6a4c333c4333362c46bdf4d9e43504 (patch) | |
tree | b06cdf5f34a8b2c5cbbbf6e7535893f46ddc3307 | |
parent | a63f38cc4ccfa076f87fc3d0c276ee62e710f953 (diff) |
locking/lockdep: Eliminate lockdep_init()
Lockdep is initialized at compile time now. Get rid of lockdep_init().
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Krinkin <krinkin.m.u@gmail.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Cc: mm-commits@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/c6x/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 3 | ||||
-rw-r--r-- | arch/s390/kernel/early.c | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/head_64.S | 8 | ||||
-rw-r--r-- | arch/x86/lguest/boot.c | 6 | ||||
-rw-r--r-- | include/linux/lockdep.h | 2 | ||||
-rw-r--r-- | init/main.c | 5 | ||||
-rw-r--r-- | kernel/locking/lockdep.c | 59 | ||||
-rw-r--r-- | tools/lib/lockdep/common.c | 5 | ||||
-rw-r--r-- | tools/lib/lockdep/include/liblockdep/common.h | 1 | ||||
-rw-r--r-- | tools/lib/lockdep/preload.c | 2 |
13 files changed, 0 insertions, 98 deletions
diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c index 72e17f7ebd6f..786e36e2f61d 100644 --- a/arch/c6x/kernel/setup.c +++ b/arch/c6x/kernel/setup.c | |||
@@ -281,8 +281,6 @@ notrace void __init machine_init(unsigned long dt_ptr) | |||
281 | */ | 281 | */ |
282 | set_ist(_vectors_start); | 282 | set_ist(_vectors_start); |
283 | 283 | ||
284 | lockdep_init(); | ||
285 | |||
286 | /* | 284 | /* |
287 | * dtb is passed in from bootloader. | 285 | * dtb is passed in from bootloader. |
288 | * fdt is linked in blob. | 286 | * fdt is linked in blob. |
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 89a2a9394927..f31ebb5dc26c 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c | |||
@@ -130,8 +130,6 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, | |||
130 | memset(__bss_start, 0, __bss_stop-__bss_start); | 130 | memset(__bss_start, 0, __bss_stop-__bss_start); |
131 | memset(_ssbss, 0, _esbss-_ssbss); | 131 | memset(_ssbss, 0, _esbss-_ssbss); |
132 | 132 | ||
133 | lockdep_init(); | ||
134 | |||
135 | /* initialize device tree for usage in early_printk */ | 133 | /* initialize device tree for usage in early_printk */ |
136 | early_init_devtree(_fdt_start); | 134 | early_init_devtree(_fdt_start); |
137 | 135 | ||
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index ad8c9db61237..d544fa311757 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -114,8 +114,6 @@ extern unsigned int memset_nocache_branch; /* Insn to be replaced by NOP */ | |||
114 | 114 | ||
115 | notrace void __init machine_init(u64 dt_ptr) | 115 | notrace void __init machine_init(u64 dt_ptr) |
116 | { | 116 | { |
117 | lockdep_init(); | ||
118 | |||
119 | /* Enable early debugging if any specified (see udbg.h) */ | 117 | /* Enable early debugging if any specified (see udbg.h) */ |
120 | udbg_early_init(); | 118 | udbg_early_init(); |
121 | 119 | ||
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 5c03a6a9b054..f98be8383a39 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -255,9 +255,6 @@ void __init early_setup(unsigned long dt_ptr) | |||
255 | setup_paca(&boot_paca); | 255 | setup_paca(&boot_paca); |
256 | fixup_boot_paca(); | 256 | fixup_boot_paca(); |
257 | 257 | ||
258 | /* Initialize lockdep early or else spinlocks will blow */ | ||
259 | lockdep_init(); | ||
260 | |||
261 | /* -------- printk is now safe to use ------- */ | 258 | /* -------- printk is now safe to use ------- */ |
262 | 259 | ||
263 | /* Enable early debugging if any specified (see udbg.h) */ | 260 | /* Enable early debugging if any specified (see udbg.h) */ |
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index c55576bbaa1f..a0684de5a93b 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -448,7 +448,6 @@ void __init startup_init(void) | |||
448 | rescue_initrd(); | 448 | rescue_initrd(); |
449 | clear_bss_section(); | 449 | clear_bss_section(); |
450 | init_kernel_storage_key(); | 450 | init_kernel_storage_key(); |
451 | lockdep_init(); | ||
452 | lockdep_off(); | 451 | lockdep_off(); |
453 | setup_lowcore_early(); | 452 | setup_lowcore_early(); |
454 | setup_facility_list(); | 453 | setup_facility_list(); |
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S index f2d30cab5b3f..cd1f592cd347 100644 --- a/arch/sparc/kernel/head_64.S +++ b/arch/sparc/kernel/head_64.S | |||
@@ -696,14 +696,6 @@ tlb_fixup_done: | |||
696 | call __bzero | 696 | call __bzero |
697 | sub %o1, %o0, %o1 | 697 | sub %o1, %o0, %o1 |
698 | 698 | ||
699 | #ifdef CONFIG_LOCKDEP | ||
700 | /* We have this call this super early, as even prom_init can grab | ||
701 | * spinlocks and thus call into the lockdep code. | ||
702 | */ | ||
703 | call lockdep_init | ||
704 | nop | ||
705 | #endif | ||
706 | |||
707 | call prom_init | 699 | call prom_init |
708 | mov %l7, %o0 ! OpenPROM cif handler | 700 | mov %l7, %o0 ! OpenPROM cif handler |
709 | 701 | ||
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 4ba229ac3f4f..f56cc418c87d 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -1520,12 +1520,6 @@ __init void lguest_init(void) | |||
1520 | */ | 1520 | */ |
1521 | reserve_top_address(lguest_data.reserve_mem); | 1521 | reserve_top_address(lguest_data.reserve_mem); |
1522 | 1522 | ||
1523 | /* | ||
1524 | * If we don't initialize the lock dependency checker now, it crashes | ||
1525 | * atomic_notifier_chain_register, then paravirt_disable_iospace. | ||
1526 | */ | ||
1527 | lockdep_init(); | ||
1528 | |||
1529 | /* Hook in our special panic hypercall code. */ | 1523 | /* Hook in our special panic hypercall code. */ |
1530 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 1524 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
1531 | 1525 | ||
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 4dca42fd32f5..d026b190c530 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -261,7 +261,6 @@ struct held_lock { | |||
261 | /* | 261 | /* |
262 | * Initialization, self-test and debugging-output methods: | 262 | * Initialization, self-test and debugging-output methods: |
263 | */ | 263 | */ |
264 | extern void lockdep_init(void); | ||
265 | extern void lockdep_info(void); | 264 | extern void lockdep_info(void); |
266 | extern void lockdep_reset(void); | 265 | extern void lockdep_reset(void); |
267 | extern void lockdep_reset_lock(struct lockdep_map *lock); | 266 | extern void lockdep_reset_lock(struct lockdep_map *lock); |
@@ -392,7 +391,6 @@ static inline void lockdep_on(void) | |||
392 | # define lockdep_set_current_reclaim_state(g) do { } while (0) | 391 | # define lockdep_set_current_reclaim_state(g) do { } while (0) |
393 | # define lockdep_clear_current_reclaim_state() do { } while (0) | 392 | # define lockdep_clear_current_reclaim_state() do { } while (0) |
394 | # define lockdep_trace_alloc(g) do { } while (0) | 393 | # define lockdep_trace_alloc(g) do { } while (0) |
395 | # define lockdep_init() do { } while (0) | ||
396 | # define lockdep_info() do { } while (0) | 394 | # define lockdep_info() do { } while (0) |
397 | # define lockdep_init_map(lock, name, key, sub) \ | 395 | # define lockdep_init_map(lock, name, key, sub) \ |
398 | do { (void)(name); (void)(key); } while (0) | 396 | do { (void)(name); (void)(key); } while (0) |
diff --git a/init/main.c b/init/main.c index 58c9e374704b..b3008bcfb1dc 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -499,11 +499,6 @@ asmlinkage __visible void __init start_kernel(void) | |||
499 | char *command_line; | 499 | char *command_line; |
500 | char *after_dashes; | 500 | char *after_dashes; |
501 | 501 | ||
502 | /* | ||
503 | * Need to run as early as possible, to initialize the | ||
504 | * lockdep hash: | ||
505 | */ | ||
506 | lockdep_init(); | ||
507 | set_task_stack_end_magic(&init_task); | 502 | set_task_stack_end_magic(&init_task); |
508 | smp_setup_processor_id(); | 503 | smp_setup_processor_id(); |
509 | debug_objects_early_init(); | 504 | debug_objects_early_init(); |
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 716547fdb873..3261214323fa 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c | |||
@@ -123,8 +123,6 @@ static inline int debug_locks_off_graph_unlock(void) | |||
123 | return ret; | 123 | return ret; |
124 | } | 124 | } |
125 | 125 | ||
126 | static int lockdep_initialized; | ||
127 | |||
128 | unsigned long nr_list_entries; | 126 | unsigned long nr_list_entries; |
129 | static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES]; | 127 | static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES]; |
130 | 128 | ||
@@ -434,19 +432,6 @@ unsigned int max_lockdep_depth; | |||
434 | 432 | ||
435 | #ifdef CONFIG_DEBUG_LOCKDEP | 433 | #ifdef CONFIG_DEBUG_LOCKDEP |
436 | /* | 434 | /* |
437 | * We cannot printk in early bootup code. Not even early_printk() | ||
438 | * might work. So we mark any initialization errors and printk | ||
439 | * about it later on, in lockdep_info(). | ||
440 | */ | ||
441 | static int lockdep_init_error; | ||
442 | static const char *lock_init_error; | ||
443 | static unsigned long lockdep_init_trace_data[20]; | ||
444 | static struct stack_trace lockdep_init_trace = { | ||
445 | .max_entries = ARRAY_SIZE(lockdep_init_trace_data), | ||
446 | .entries = lockdep_init_trace_data, | ||
447 | }; | ||
448 | |||
449 | /* | ||
450 | * Various lockdep statistics: | 435 | * Various lockdep statistics: |
451 | */ | 436 | */ |
452 | DEFINE_PER_CPU(struct lockdep_stats, lockdep_stats); | 437 | DEFINE_PER_CPU(struct lockdep_stats, lockdep_stats); |
@@ -669,20 +654,6 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | |||
669 | struct hlist_head *hash_head; | 654 | struct hlist_head *hash_head; |
670 | struct lock_class *class; | 655 | struct lock_class *class; |
671 | 656 | ||
672 | #ifdef CONFIG_DEBUG_LOCKDEP | ||
673 | /* | ||
674 | * If the architecture calls into lockdep before initializing | ||
675 | * the hashes then we'll warn about it later. (we cannot printk | ||
676 | * right now) | ||
677 | */ | ||
678 | if (unlikely(!lockdep_initialized)) { | ||
679 | lockdep_init(); | ||
680 | lockdep_init_error = 1; | ||
681 | lock_init_error = lock->name; | ||
682 | save_stack_trace(&lockdep_init_trace); | ||
683 | } | ||
684 | #endif | ||
685 | |||
686 | if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) { | 657 | if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) { |
687 | debug_locks_off(); | 658 | debug_locks_off(); |
688 | printk(KERN_ERR | 659 | printk(KERN_ERR |
@@ -4013,28 +3984,6 @@ out_restore: | |||
4013 | raw_local_irq_restore(flags); | 3984 | raw_local_irq_restore(flags); |
4014 | } | 3985 | } |
4015 | 3986 | ||
4016 | void lockdep_init(void) | ||
4017 | { | ||
4018 | int i; | ||
4019 | |||
4020 | /* | ||
4021 | * Some architectures have their own start_kernel() | ||
4022 | * code which calls lockdep_init(), while we also | ||
4023 | * call lockdep_init() from the start_kernel() itself, | ||
4024 | * and we want to initialize the hashes only once: | ||
4025 | */ | ||
4026 | if (lockdep_initialized) | ||
4027 | return; | ||
4028 | |||
4029 | for (i = 0; i < CLASSHASH_SIZE; i++) | ||
4030 | INIT_HLIST_HEAD(classhash_table + i); | ||
4031 | |||
4032 | for (i = 0; i < CHAINHASH_SIZE; i++) | ||
4033 | INIT_HLIST_HEAD(chainhash_table + i); | ||
4034 | |||
4035 | lockdep_initialized = 1; | ||
4036 | } | ||
4037 | |||
4038 | void __init lockdep_info(void) | 3987 | void __init lockdep_info(void) |
4039 | { | 3988 | { |
4040 | printk("Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\n"); | 3989 | printk("Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\n"); |
@@ -4061,14 +4010,6 @@ void __init lockdep_info(void) | |||
4061 | 4010 | ||
4062 | printk(" per task-struct memory footprint: %lu bytes\n", | 4011 | printk(" per task-struct memory footprint: %lu bytes\n", |
4063 | sizeof(struct held_lock) * MAX_LOCK_DEPTH); | 4012 | sizeof(struct held_lock) * MAX_LOCK_DEPTH); |
4064 | |||
4065 | #ifdef CONFIG_DEBUG_LOCKDEP | ||
4066 | if (lockdep_init_error) { | ||
4067 | printk("WARNING: lockdep init error: lock '%s' was acquired before lockdep_init().\n", lock_init_error); | ||
4068 | printk("Call stack leading to lockdep invocation was:\n"); | ||
4069 | print_stack_trace(&lockdep_init_trace, 0); | ||
4070 | } | ||
4071 | #endif | ||
4072 | } | 4013 | } |
4073 | 4014 | ||
4074 | static void | 4015 | static void |
diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c index 9be663340f0a..d1c89cc06f5f 100644 --- a/tools/lib/lockdep/common.c +++ b/tools/lib/lockdep/common.c | |||
@@ -11,11 +11,6 @@ static __thread struct task_struct current_obj; | |||
11 | bool debug_locks = true; | 11 | bool debug_locks = true; |
12 | bool debug_locks_silent; | 12 | bool debug_locks_silent; |
13 | 13 | ||
14 | __attribute__((constructor)) static void liblockdep_init(void) | ||
15 | { | ||
16 | lockdep_init(); | ||
17 | } | ||
18 | |||
19 | __attribute__((destructor)) static void liblockdep_exit(void) | 14 | __attribute__((destructor)) static void liblockdep_exit(void) |
20 | { | 15 | { |
21 | debug_check_no_locks_held(); | 16 | debug_check_no_locks_held(); |
diff --git a/tools/lib/lockdep/include/liblockdep/common.h b/tools/lib/lockdep/include/liblockdep/common.h index a60c14b9662a..6e66277ec437 100644 --- a/tools/lib/lockdep/include/liblockdep/common.h +++ b/tools/lib/lockdep/include/liblockdep/common.h | |||
@@ -44,7 +44,6 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
44 | void lock_release(struct lockdep_map *lock, int nested, | 44 | void lock_release(struct lockdep_map *lock, int nested, |
45 | unsigned long ip); | 45 | unsigned long ip); |
46 | extern void debug_check_no_locks_freed(const void *from, unsigned long len); | 46 | extern void debug_check_no_locks_freed(const void *from, unsigned long len); |
47 | extern void lockdep_init(void); | ||
48 | 47 | ||
49 | #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \ | 48 | #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \ |
50 | { .name = (_name), .key = (void *)(_key), } | 49 | { .name = (_name), .key = (void *)(_key), } |
diff --git a/tools/lib/lockdep/preload.c b/tools/lib/lockdep/preload.c index 21cdf869a01b..52844847569c 100644 --- a/tools/lib/lockdep/preload.c +++ b/tools/lib/lockdep/preload.c | |||
@@ -439,7 +439,5 @@ __attribute__((constructor)) static void init_preload(void) | |||
439 | ll_pthread_rwlock_unlock = dlsym(RTLD_NEXT, "pthread_rwlock_unlock"); | 439 | ll_pthread_rwlock_unlock = dlsym(RTLD_NEXT, "pthread_rwlock_unlock"); |
440 | #endif | 440 | #endif |
441 | 441 | ||
442 | lockdep_init(); | ||
443 | |||
444 | __init_state = done; | 442 | __init_state = done; |
445 | } | 443 | } |