]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/cpu-hotplug-mute-hotplug-lockdep-during-init.patch
Linux 4.14.111
[thirdparty/kernel/stable-queue.git] / queue-4.19 / cpu-hotplug-mute-hotplug-lockdep-during-init.patch
1 From 39f7e50ea91f5da025fcdbc731e2b2424088b567 Mon Sep 17 00:00:00 2001
2 From: Valentin Schneider <valentin.schneider@arm.com>
3 Date: Wed, 19 Dec 2018 18:23:15 +0000
4 Subject: cpu/hotplug: Mute hotplug lockdep during init
5
6 [ Upstream commit ce48c457b95316b9a01b5aa9d4456ce820df94b4 ]
7
8 Since we've had:
9
10 commit cb538267ea1e ("jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations")
11
12 we've been getting some lockdep warnings during init, such as on HiKey960:
13
14 [ 0.820495] WARNING: CPU: 4 PID: 0 at kernel/cpu.c:316 lockdep_assert_cpus_held+0x3c/0x48
15 [ 0.820498] Modules linked in:
16 [ 0.820509] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G S 4.20.0-rc5-00051-g4cae42a #34
17 [ 0.820511] Hardware name: HiKey960 (DT)
18 [ 0.820516] pstate: 600001c5 (nZCv dAIF -PAN -UAO)
19 [ 0.820520] pc : lockdep_assert_cpus_held+0x3c/0x48
20 [ 0.820523] lr : lockdep_assert_cpus_held+0x38/0x48
21 [ 0.820526] sp : ffff00000a9cbe50
22 [ 0.820528] x29: ffff00000a9cbe50 x28: 0000000000000000
23 [ 0.820533] x27: 00008000b69e5000 x26: ffff8000bff4cfe0
24 [ 0.820537] x25: ffff000008ba69e0 x24: 0000000000000001
25 [ 0.820541] x23: ffff000008fce000 x22: ffff000008ba70c8
26 [ 0.820545] x21: 0000000000000001 x20: 0000000000000003
27 [ 0.820548] x19: ffff00000a35d628 x18: ffffffffffffffff
28 [ 0.820552] x17: 0000000000000000 x16: 0000000000000000
29 [ 0.820556] x15: ffff00000958f848 x14: 455f3052464d4d34
30 [ 0.820559] x13: 00000000769dde98 x12: ffff8000bf3f65a8
31 [ 0.820564] x11: 0000000000000000 x10: ffff00000958f848
32 [ 0.820567] x9 : ffff000009592000 x8 : ffff00000958f848
33 [ 0.820571] x7 : ffff00000818ffa0 x6 : 0000000000000000
34 [ 0.820574] x5 : 0000000000000000 x4 : 0000000000000001
35 [ 0.820578] x3 : 0000000000000000 x2 : 0000000000000001
36 [ 0.820582] x1 : 00000000ffffffff x0 : 0000000000000000
37 [ 0.820587] Call trace:
38 [ 0.820591] lockdep_assert_cpus_held+0x3c/0x48
39 [ 0.820598] static_key_enable_cpuslocked+0x28/0xd0
40 [ 0.820606] arch_timer_check_ool_workaround+0xe8/0x228
41 [ 0.820610] arch_timer_starting_cpu+0xe4/0x2d8
42 [ 0.820615] cpuhp_invoke_callback+0xe8/0xd08
43 [ 0.820619] notify_cpu_starting+0x80/0xb8
44 [ 0.820625] secondary_start_kernel+0x118/0x1d0
45
46 We've also had a similar warning in sched_init_smp() for every
47 asymmetric system that would enable the sched_asym_cpucapacity static
48 key, although that was singled out in:
49
50 commit 40fa3780bac2 ("sched/core: Take the hotplug lock in sched_init_smp()")
51
52 Those warnings are actually harmless, since we cannot have hotplug
53 operations at the time they appear. Instead of starting to sprinkle
54 useless hotplug lock operations in the init codepaths, mute the
55 warnings until they start warning about real problems.
56
57 Suggested-by: Peter Zijlstra <peterz@infradead.org>
58 Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
59 Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
60 Cc: Andrew Morton <akpm@linux-foundation.org>
61 Cc: Linus Torvalds <torvalds@linux-foundation.org>
62 Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
63 Cc: Thomas Gleixner <tglx@linutronix.de>
64 Cc: Will Deacon <will.deacon@arm.com>
65 Cc: cai@gmx.us
66 Cc: daniel.lezcano@linaro.org
67 Cc: dietmar.eggemann@arm.com
68 Cc: linux-arm-kernel@lists.infradead.org
69 Cc: longman@redhat.com
70 Cc: marc.zyngier@arm.com
71 Cc: mark.rutland@arm.com
72 Link: https://lkml.kernel.org/r/1545243796-23224-2-git-send-email-valentin.schneider@arm.com
73 Signed-off-by: Ingo Molnar <mingo@kernel.org>
74 Signed-off-by: Sasha Levin <sashal@kernel.org>
75 ---
76 kernel/cpu.c | 9 +++++++++
77 1 file changed, 9 insertions(+)
78
79 diff --git a/kernel/cpu.c b/kernel/cpu.c
80 index 9d0ecc4a0e79..dc250ec2c096 100644
81 --- a/kernel/cpu.c
82 +++ b/kernel/cpu.c
83 @@ -313,6 +313,15 @@ void cpus_write_unlock(void)
84
85 void lockdep_assert_cpus_held(void)
86 {
87 + /*
88 + * We can't have hotplug operations before userspace starts running,
89 + * and some init codepaths will knowingly not take the hotplug lock.
90 + * This is all valid, so mute lockdep until it makes sense to report
91 + * unheld locks.
92 + */
93 + if (system_state < SYSTEM_RUNNING)
94 + return;
95 +
96 percpu_rwsem_assert_held(&cpu_hotplug_lock);
97 }
98
99 --
100 2.19.1
101