From b68f16d34f8cdfa5c4b8611e68cf2c93caef6ad0 Mon Sep 17 00:00:00 2001 From: Zhouyi Zhou Date: Tue, 27 Sep 2022 09:48:23 +0800 Subject: [PATCH] powerpc: avoid lockdep when we are offline This is second version of my fix to PPC's "WARNING: suspicious RCU usage", I improved my fix under Paul E. McKenney's guidance: Link: https://lore.kernel.org/lkml/20220914021528.15946-1-zhouzhouyi@gmail.com/T/ During the cpu offlining, the sub functions of xive_teardown_cpu will call __lock_acquire when CONFIG_LOCKDEP=y. The latter function will travel RCU protected list, so "WARNING: suspicious RCU usage" will be triggered. Avoid lockdep when we are offline. Signed-off-by: Zhouyi Zhou --- arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 0f8cd8b06432d..4fe2d44c7923b 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -64,10 +64,15 @@ static void pseries_cpu_offline_self(void) local_irq_disable(); idle_task_exit(); + /* prevent lockdep code from traveling RCU protected list + * when we are offline. + */ + lockdep_off(); if (xive_enabled()) xive_teardown_cpu(); else xics_teardown_cpu(); + lockdep_on(); unregister_slb_shadow(hwcpu); rtas_stop_self();