Skip to contentSkip to conversation

powerpc/pseries: Skip vpa_init() for boot cpu in smp_setup_cpu()

PATCH Applied Vaibhav Jain 2 participants 2 messages Jul 8 – Jul 30

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

PATCH 2/2 powerpc/pseries: Skip vpa_init() for boot cpu in smp_setup_cpu()

During pSeries_setup_arch(), VPA for boot-cpu is first to be initialized. However later in the boot, smp_setup_cpu() is called for setting up VPA on boot and secondary cpus that were brought online. This results in vpa_init() being called twice for boot-cpu and three redundant H_REGISTER_VPA hcalls being made to the hypervisor.

Fix this by adding an extra condition in smp_set_cpu() to call vpa_init() only on non boot-cpus.

---
 arch/powerpc/platforms/pseries/smp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/smp.c +6 -1
index c6c2baacca9a..106f79a96edc 100644
@@ -131,7 +131,12 @@ static void smp_setup_cpu(int cpu)
 	else if (cpu != boot_cpuid)
 		xics_setup_cpu();
 
-	if (firmware_has_feature(FW_FEATURE_SPLPAR))
+	/*
+	 * Initialize VPA on non-boot cpus since boot-cpu vpa was
+	 * already initialized in pSeries_setup_arch()
+	 */
+	if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
+	    cpu != boot_cpuid)
 		vpa_init(cpu);
 
 	cpumask_clear_cpu(cpu, of_spin_mask);
Signature · 1 line
2.55.0
maintainer Applied
#1 lore raw
Quoted 10 lines · Vaibhav Jain

During pSeries_setup_arch(), VPA for boot-cpu is first to be initialized. However later in the boot, smp_setup_cpu() is called for setting up VPA on boot and secondary cpus that were brought online. This results in vpa_init() being called twice for boot-cpu and three redundant H_REGISTER_VPA hcalls being made to the hypervisor.

Fix this by adding an extra condition in smp_set_cpu() to call vpa_init() only on non boot-cpus.

[...]

Applied to powerpc/fixes.

[2/2] powerpc/pseries: Skip vpa_init() for boot cpu in smp_setup_cpu()

      https://git.kernel.org/powerpc/c/8f45abd50aaa4155a72ec539f371dafb039786df

cheers