Skip to contentSkip to conversation

powerpc: move pseries interrupt cleanup code to under __cpu_disable

RFC PATCH New Zhouyi Zhou 1 participant 1 message Nov 9, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 powerpc: move pseries interrupt cleanup code to under __cpu_disable

According to

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.

According to Documentation/core-api/cpu_hotplug.rst:
__cpu_disable should shut down the interrupt handler.

This patch move pseries interrupt cleanup code to under __cpu_disable.

RCU torture tested in ppc VM of Open Source Lab of Oregon State University, by comparing the test results, our fix don't introduce new bugs and fixed previous "WARNING: suspicious RCU usage" bugs.

---
Dear PPC and RCU developers

I tries do move pseries interrupt cleanup code to under __cpu_disable. During this process, I learn the XIVE interrupt controller architecture by debugging the qemu virtual machine, and reading the following documents:

It is a fruitful journey, thank you for you guidance ;-)

I also tested the patch in ppc VM of Open Source Lab of Oregon State University by invoking tools/testing/selftests/rcutorture/bin/torture.sh

Thanks again
Zhouyi
--

 arch/powerpc/platforms/pseries/hotplug-cpu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +7 -5
index e0a7ac5db15d..c7c86ea0a74d 100644
@@ -62,12 +62,7 @@ static void pseries_cpu_offline_self(void)
 {
 	unsigned int hwcpu = hard_smp_processor_id();
 
-	local_irq_disable();
 	idle_task_exit();
-	if (xive_enabled())
-		xive_teardown_cpu();
-	else
-		xics_teardown_cpu();
 
 	unregister_slb_shadow(hwcpu);
 	rtas_stop_self();
@@ -96,3 +91,10 @@ static int pseries_cpu_disable(void)
 
 	cleanup_cpu_mmu_context();
 
+	local_irq_disable();
+
+	if (xive_enabled())
+		xive_teardown_cpu();
+	else
+		xics_teardown_cpu();
+
	return 0;

}

Signature · 1 line
2.25.1