arm: kvm: fix CPU hotplug
PATCH 1/1 arm: kvm: fix CPU hotplug
On some platforms with no power management capabilities, the hotplug implementation is allowed to return from a smp_ops.cpu_die() call as a function return. Upon a CPU onlining event, the KVM CPU notifier tries to reinstall the hyp stub, which fails on platform where no reset took place following a hotplug event, with the message:
CPU1: smp_ops.cpu_die() returned, trying to resuscitate
CPU1: Booted secondary processor
Kernel panic - not syncing: unexpected prefetch abort in Hyp mode at: 0x80409540
unexpected data abort in Hyp mode at: 0x80401fe8 unexpected HVC/SVC trap in Hyp mode at: 0x805c6170
since KVM code is trying to reinstall the stub on a system where it is already configured.
To prevent this issue, this patch adds a check in the KVM hotplug notifier that detects if the HYP stub really needs re-installing when a CPU is onlined and skips the installation call if the stub is already in place, which means that the CPU has not been reset.
--- arch/arm/kvm/arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/kvm/arm.c +2 -1
@@ -826,7 +826,8 @@ static int hyp_init_cpu_notify(struct notifier_block *self,switch (action) {case CPU_STARTING :case CPU_STARTING_FROZEN : -cpu_init_hyp_mode (NULL ); +if (__hyp_get_vectors () == hyp_default_vectors) +cpu_init_hyp_mode (NULL );break ; }
Signature · 1 line
2.0.0
Christoffer Dall
AppliedPATCH 1/1 arm: kvm: fix CPU hotplug
Quoted 15 lines · Vladimir Murzin
On some platforms with no power management capabilities, the hotplug implementation is allowed to return from a
smp_ops.cpu_die()call as a function return. Upon a CPU onlining event, the KVM CPU notifier tries to reinstall the hyp stub, which fails on platform where no reset took place following a hotplug event, with the message:CPU1:
smp_ops.cpu_die()returned, trying to resuscitate
CPU1: Booted secondary processorKernel panic - not syncing: unexpected prefetch abort in Hyp mode at: 0x80409540unexpected data abort in Hyp mode at:
0x80401fe8unexpected HVC/SVC trap in Hyp mode at:0x805c6170since KVM code is trying to reinstall the stub on a system where it is already configured.
Quoted 8 lines
To prevent this issue, this patch adds a check in the KVM hotplug notifier that detects if the HYP stub really needs re-installing when a CPU is onlined and skips the installation call if the stub is already in place, which means that the CPU has not been reset.
Signed-off-by Vladimir Murzin <[email protected]>Acked-by Marc Zyngier <[email protected]>
Applied to queue, thanks
-Christoffer