[PATCH v4 0/3] Hyper-V: kexec fixes for L1VH (mshv)

Jork Loeser posted 3 patches 1 month, 2 weeks ago
drivers/hv/hv.c           |   3 +
drivers/hv/mshv_debugfs.c |   7 +-
drivers/hv/mshv_synic.c   | 154 +++++++++++++++++++++++++-------------
3 files changed, 110 insertions(+), 54 deletions(-)
[PATCH v4 0/3] Hyper-V: kexec fixes for L1VH (mshv)
Posted by Jork Loeser 1 month, 2 weeks ago
This series fixes kexec support when Linux runs as an L1 Virtual Host
(L1VH) under Hyper-V, using the MSHV driver to manage child VMs.

1-2. SynIC cleanup: the MSHV driver manages its own SynIC resources
     separately from vmbus. Add proper teardown of MSHV-owned SINTs
     and SIRBP on kexec, scoped to only the resources MSHV owns.
     Use hv_vmbus_exists() to decide at runtime whether VMBus owns
     SIMP/SIEFP/SCONTROL (so MSHV must not touch them) or whether
     MSHV must manage them itself (bare root partition without VMBus).
     Also fix SIEFP and SIRBP address calculations to use
     HV_HYP_PAGE_SHIFT instead of PAGE_SHIFT, which produces wrong
     addresses on ARM64 with 64K pages.

3.   Debugfs stats pages: unmap the VP statistics overlay pages before
     kexec to avoid machine check exceptions when the new kernel
     reuses those physical pages.

Changes since v3:
- Dropped patches 1-3 (vmbus variable shadowing, stimer cleanup,
  LP/VP skip), now merged via hyperv-next.
- Patch 1: fix SIEFP and SIRBP memremap()/virt_to_phys() to use
  HV_HYP_PAGE_SHIFT/HV_HYP_PAGE_SIZE instead of PAGE_SHIFT/PAGE_SIZE.

Changes since v2:
- Rebased onto linux-next/master to adapt to the upstream SynIC
  refactor (commit 5a674ef871fe, "mshv: refactor synic init and
  cleanup").

Changes since v1:
- Patch 1: account for nested root partitions where VMBus is also
  active (not just L1VH); use a vmbus_active local variable; allocate
  SIRBP in L1VH allocation path for when the hypervisor doesn't
  pre-provision the page.

Jork Loeser (3):
  mshv: limit SynIC management to MSHV-owned resources
  mshv: clean up SynIC state on kexec for L1VH
  mshv: unmap debugfs stats pages on kexec

 drivers/hv/hv.c           |   3 +
 drivers/hv/mshv_debugfs.c |   7 +-
 drivers/hv/mshv_synic.c   | 154 +++++++++++++++++++++++++-------------
 3 files changed, 110 insertions(+), 54 deletions(-)

-- 
2.43.0
Re: [PATCH v4 0/3] Hyper-V: kexec fixes for L1VH (mshv)
Posted by Wei Liu 1 month, 2 weeks ago
On Mon, Apr 27, 2026 at 02:38:51PM -0700, Jork Loeser wrote:
> This series fixes kexec support when Linux runs as an L1 Virtual Host
> (L1VH) under Hyper-V, using the MSHV driver to manage child VMs.
> 
> 1-2. SynIC cleanup: the MSHV driver manages its own SynIC resources
>      separately from vmbus. Add proper teardown of MSHV-owned SINTs
>      and SIRBP on kexec, scoped to only the resources MSHV owns.
>      Use hv_vmbus_exists() to decide at runtime whether VMBus owns
>      SIMP/SIEFP/SCONTROL (so MSHV must not touch them) or whether
>      MSHV must manage them itself (bare root partition without VMBus).
>      Also fix SIEFP and SIRBP address calculations to use
>      HV_HYP_PAGE_SHIFT instead of PAGE_SHIFT, which produces wrong
>      addresses on ARM64 with 64K pages.
> 
> 3.   Debugfs stats pages: unmap the VP statistics overlay pages before
>      kexec to avoid machine check exceptions when the new kernel
>      reuses those physical pages.
> 
> Changes since v3:
> - Dropped patches 1-3 (vmbus variable shadowing, stimer cleanup,
>   LP/VP skip), now merged via hyperv-next.
> - Patch 1: fix SIEFP and SIRBP memremap()/virt_to_phys() to use
>   HV_HYP_PAGE_SHIFT/HV_HYP_PAGE_SIZE instead of PAGE_SHIFT/PAGE_SIZE.
> 
> Changes since v2:
> - Rebased onto linux-next/master to adapt to the upstream SynIC
>   refactor (commit 5a674ef871fe, "mshv: refactor synic init and
>   cleanup").
> 
> Changes since v1:
> - Patch 1: account for nested root partitions where VMBus is also
>   active (not just L1VH); use a vmbus_active local variable; allocate
>   SIRBP in L1VH allocation path for when the hypervisor doesn't
>   pre-provision the page.
> 
> Jork Loeser (3):
>   mshv: limit SynIC management to MSHV-owned resources
>   mshv: clean up SynIC state on kexec for L1VH
>   mshv: unmap debugfs stats pages on kexec

Applied to hyperv-fixes. Thanks.