]> 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, 9 Feb 2023 21:14:33 +0000 (16:14 -0500)
commitb265a2e0d76422f4007e96dd7295ed0aeb846e2d
treed3bbcec8b748d674bec2be5739b59347cd03ede0
parentba34de1b3bf965d15f6c76c97fa7e6d17194d401
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
sys/amd64/vmm/io/vlapic.c