summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Dufour <ldufour@linux.ibm.com>2022-11-14 19:01:50 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2022-12-07 12:30:23 +0300
commitf6aa37c51ec0d053ee34c235bfe0e666618a3baf (patch)
tree43d503ae93b4787726bd29f7ce3fa7625886efa1
parent9b574cfab7d4e68c67c4ee4fcde912ef54a25b88 (diff)
downloadlinux-f6aa37c51ec0d053ee34c235bfe0e666618a3baf.tar.xz
powerpc/pseries: unregister VPA when hot unplugging a CPU
The VPA should unregister when offlining a CPU. Otherwise there could be a short window where 2 CPUs could share the same VPA. This happens because the hypervisor is still keeping the VPA attached to the vCPU even if it became offline. Here is a potential situation: 1. remove proc A, 2. add proc B. If proc B gets proc A's place in cpu_present_mask, then it registers proc A's VPAs. 3. If proc B is then re-added to the LP, its threads are sharing VPAs with proc A briefly as they come online. As the hypervisor may check for the VPA's yield_count field oddity, it may detect an unexpected value and kill the LPAR. Suggested-by: Nathan Lynch <nathanl@linux.ibm.com> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com> [mpe: s/cpu_present_map/cpu_present_mask/ in change log] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20221114160150.13554-1-ldufour@linux.ibm.com
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index e0a7ac5db15d..090ae5a1e0f5 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -70,6 +70,7 @@ static void pseries_cpu_offline_self(void)
xics_teardown_cpu();
unregister_slb_shadow(hwcpu);
+ unregister_vpa(hwcpu);
rtas_stop_self();
/* Should never get here... */