]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/hyperv: Skip LP/VP creation on kexec
authorJork Loeser <jloeser@linux.microsoft.com>
Wed, 8 Apr 2026 01:36:40 +0000 (18:36 -0700)
committerWei Liu <wei.liu@kernel.org>
Wed, 22 Apr 2026 06:23:25 +0000 (06:23 +0000)
commit5170a82e89211d876af17bf3d94a511fb2bb4921
treeb136f2665a59adadb4c6f5fb13849de1bcd313a1
parentf7ce370b525a02127527b0f54ee877413705a709
x86/hyperv: Skip LP/VP creation on kexec

After a kexec the logical processors and virtual processors already
exist in the hypervisor because they were created by the previous
kernel. Attempting to add them again causes either a BUG_ON or
corrupted VP state leading to MCEs in the new kernel.

Add hv_lp_exists() to probe whether an LP is already present by
calling HVCALL_GET_LOGICAL_PROCESSOR_RUN_TIME. When it succeeds the
LP exists and we skip the add-LP and create-VP loops entirely.

Also add hv_call_notify_all_processors_started() which informs the
hypervisor that all processors are online. This is required after
adding LPs (fresh boot) and is a no-op on kexec since we skip that
path.

Co-developed-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
Co-developed-by: Stanislav Kinsburskii <stanislav.kinsburskii@gmail.com>
Signed-off-by: Stanislav Kinsburskii <stanislav.kinsburskii@gmail.com>
Co-developed-by: Mukesh Rathor <mrathor@linux.microsoft.com>
Signed-off-by: Mukesh Rathor <mrathor@linux.microsoft.com>
Signed-off-by: Jork Loeser <jloeser@linux.microsoft.com>
Reviewed-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
arch/x86/kernel/cpu/mshyperv.c
drivers/hv/hv_proc.c
include/asm-generic/mshyperv.h
include/hyperv/hvgdk_mini.h
include/hyperv/hvhdk_mini.h