Kexec reboot fails on ARM64 Hyper-V guests because the VMBus
connection and SynIC CPU hotplug state are not torn down before the
secondary CPUs are stopped. The kexec kernel consequently starts with
the previous kernel's VMBus state still active.
The previous version added an ARM64-specific syscore shutdown
implementation. This version follows Michael Kelley's review and moves
the cleanup into the existing architecture-independent VMBus syscore
operations. This removes the separate x86 handler dispatch and gives
x86 and ARM64 the same ordering:
device_shutdown()
syscore_shutdown()
VMBus UNLOAD and SynIC CPU hotplug teardown
machine_shutdown()
On x86, VMBus teardown now runs before hv_stimer_global_cleanup().
This ordering is safe after commit be0cfab740e5 ("clocksource: hyper-v:
Remove support for stimer interrupts in message mode") removed the
VMBus dependency from synthetic timer handling.
Patch 1 adds a read-only helper that reports whether a kexec reboot is
in progress. The helper is exported because HYPERV_VMBUS is tristate
and the common syscore callback must also link when VMBus is a module.
Patch 2 moves the cleanup into the common callback and removes the
obsolete architecture-specific setup/remove interface.
For stable kernels that still support message-mode stimers, an
ARM64-specific backport will be needed to preserve the existing x86
ordering.
Changes in v3:
- Use the existing common VMBus syscore operations on all
architectures, as suggested by Michael.
- Remove the x86 handler pointer and the weak setup/remove interface.
- Add an exported read-only helper for modular VMBus builds.
- Correct the Fixes tag to the commit that enabled Hyper-V on ARM64.
Changes in v2:
- Use syscore shutdown instead of an ARM64 machine_shutdown() hook, as
suggested by Catalin.
Shradha Gupta (2):
kexec: Add helper to report an active kexec reboot
Drivers: hv: Run VMBus kexec cleanup from syscore shutdown
arch/x86/kernel/cpu/mshyperv.c | 17 +----------------
drivers/hv/hv_common.c | 10 ----------
drivers/hv/vmbus_drv.c | 22 ++++++++++++++--------
include/asm-generic/mshyperv.h | 2 --
include/linux/kexec.h | 2 ++
kernel/kexec_core.c | 7 +++++++
6 files changed, 24 insertions(+), 36 deletions(-)
base-commit: be0cfab740e58b70047ef6e7e3d578f00ed5d258
--
2.43.0