HomeFreeBSD

vmm: Fix AP startup compatibility for old bhyve executables

Description

vmm: Fix AP startup compatibility for old bhyve executables

These changes unbreak AP startup when using a 13.1-RELEASE bhyve
executable with a newer kernel:

  • Correct the destination mask for the VM_EXITCODE_IPI message generated by an INIT or STARTUP IPI in vlapic_icrlo_write_handler().
  • Only initialize vlapics on active vCPUs. 13.1-RELEASE bhyve activates AP vCPUs only after the BSP starts them with an IPI, and vmm now allocates vcpu structures lazily, so the STARTUP handling in vm_handle_ipi() could trigger a page fault.
  • Fix an off-by-one setting the vcpuid in a VM_EXITCODE_SPINUP_AP message.

Approved by: re (cperciva)
Fixes: 7c326ab5bb9a ("vmm: don't lock a mtx in the icr_low write handler")
Reviewed by: jhb, corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38446

(cherry picked from commit b265a2e0d76422f4007e96dd7295ed0aeb846e2d)
(cherry picked from commit 577a666c3c33def1d4b996575dc43f8567fdac5c)

Details

Provenance
markjAuthored on Feb 9 2023, 8:52 PM
Reviewer
jhb
Differential Revision
D38446: vmm: Fix AP startup compatibility
Parents
rG16a1df8f2dac: MFV: zlib 1.2.13.
Branches
Unknown
Tags
Unknown