]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vmm: Fix AP startup compatibility for old bhyve executables
authorMark Johnston <markj@FreeBSD.org>
Thu, 9 Feb 2023 20:52:35 +0000 (15:52 -0500)
committerMark Johnston <markj@FreeBSD.org>
Thu, 23 Feb 2023 15:15:47 +0000 (10:15 -0500)
commit577a666c3c33def1d4b996575dc43f8567fdac5c
tree9b410e65d326117cd11e0580230451beb33c1a46
parent3a7d654ed82bc2b379549f8b2ac1e8ac6a638fa5
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.

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)
sys/amd64/vmm/io/vlapic.c