|Priority:||4 - Normal|
|Created by:||Patrick Mooney [X]|
|Reported by:||Patrick Mooney [X]|
|Assigned to:||Patrick Mooney [X]|
Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2018-06-01T16:21:02.400Z)
2018-06-07 Train Graveyard (Release Date: 2018-06-07)
After closely re-inspecting OS-6829 as part of the effort to upstream it, I found one series of events which would still cause a missed wake-up when using VMX PIR functionality.
By storing the interrupt priorities a bit field in the reserved bits of
pending in the PIR descriptor, the OS-6829 fix counts on stale priority bits being present in the field after the CPU delivers those interrupts to the guest. This is fine since the field is cleared in
vmx_inject_pir() when it checks for accumulated posted interrupts to inject into the host. There is a condition, however, when those stale bits present a problem: When a high-level interrupt is posted and delivered to the guest, followed by the guest exiting on
HLT at a lowered PPR, without a subsequent VM entry. In that case, the processor will be in a lower priority but with stale high-prio bits left in the
pending field. If two interrupts, one lower than the PPR, one higher than the PPR (but lower than the priority represented by the stale bit(s)), are sent to the vCPU, in that order, it will fail the notification check on the second interrupt and miss the necessary wake-up.
The solution is rather simple: When setting the
pir_desc->pending field as part of interrupt posting, attempt to clear the priority bits if the
pending bit is absent. A failure of the CAS for the updating to
pir_desc->pending is still fine, as an atomic OR of the priority, plus unconditional wake-up notification remains an acceptable fallback.
illumos-joyent commit 21e2c666e809045ac5b02a65fa8b9c6708909804 (branch master, by Patrick Mooney)
OS-6930 bhyve PIR can still miss PIR wake-ups
Reviewed by: John Levon <firstname.lastname@example.org>
Reviewed by: Bryan Cantrill <email@example.com>
Approved by: Robert Mustacchi <firstname.lastname@example.org>