Re: [RESEND PATCH v2] clocksource/arm_arch_timer: fix a lockdep warning

From: Thomas Gleixner
Date: Mon Dec 10 2018 - 16:31:37 EST


On Mon, 10 Dec 2018, Peter Zijlstra wrote:
> On Mon, Dec 10, 2018 at 08:52:28AM -0500, Qian Cai wrote:
> > 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
>
> It seems to me we want something like:
>
> ---
> kernel/cpu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 91d5c38eb7e5..e1ee8caf28b5 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -313,6 +313,8 @@ void cpus_write_unlock(void)
>
> void lockdep_assert_cpus_held(void)
> {
> + if (system_state < SYSTEM_RUNNING)
> + return;
> percpu_rwsem_assert_held(&cpu_hotplug_lock);
> }

Hmm, no. SYSTEM_SCHEDULING is what you want because RUNNING is set way too
late.

Thanks,

tglx