lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  3 Dec 2018 14:33:44 -0500
From:   Qian Cai <cai@....us>
To:     mark.rutland@....com, marc.zyngier@....com
Cc:     daniel.lezcano@...aro.org, tglx@...utronix.de,
        peterz@...radead.org, mingo@...nel.org, longman@...hat.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Qian Cai <cai@....us>
Subject: [PATCH] clocksource/arm_arch_timer: fix a lockdep warning

Booting this Huawei TaiShan 2280 arm64 server generated this lockdep
warning.

[    0.000000]  lockdep_assert_cpus_held+0x50/0x60
[    0.000000]  static_key_enable_cpuslocked+0x30/0xe8
[    0.000000]  arch_timer_check_ool_workaround+0x128/0x2d0
[    0.000000]  arch_timer_acpi_init+0x274/0x6ac
[    0.000000]  acpi_table_parse+0x1ac/0x218
[    0.000000]  __acpi_probe_device_table+0x164/0x1ec
[    0.000000]  timer_probe+0x1bc/0x254
[    0.000000]  time_init+0x44/0x98
[    0.000000]  start_kernel+0x4ec/0x7d4

This is due to the commit cb538267ea1e ("jump_label/lockdep: Assert we hold
the hotplug lock for _cpuslocked() operations"). Therefore, it will check
if it is really in the CPU hotplug path or not, and work around this
problem by using cpus_read_trylock(). The chance of not getting the read
lock is very small. If that happens, it will report a lockdep warning at
most.

Signed-off-by: Qian Cai <cai@....us>
---
 drivers/clocksource/arm_arch_timer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 9a7d4dc..5c9acbd 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -497,11 +497,20 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
 			per_cpu(timer_unstable_counter_workaround, i) = wa;
 	}
 
+#ifdef CONFIG_HOTPLUG_CPU
+	i = 0;
+
 	/*
 	 * Use the locked version, as we're called from the CPU
 	 * hotplug framework. Otherwise, we end-up in deadlock-land.
 	 */
+	i = cpus_read_trylock();
 	static_branch_enable_cpuslocked(&arch_timer_read_ool_enabled);
+	if (i)
+		cpus_read_unlock();
+#else
+	static_branch_enable(&arch_timer_read_ool_enabled);
+#endif
 
 	/*
 	 * Don't use the vdso fastpath if errata require using the
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ