]> xenbits.xensource.com Git - xen.git/commit
x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
authorJan Beulich <jbeulich@suse.com>
Tue, 6 Dec 2022 12:51:49 +0000 (13:51 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 6 Dec 2022 12:51:49 +0000 (13:51 +0100)
commitf5d0279839b58cb622f0995dbf9cff056f03082e
treee7a4d3d9d81706b79b185770005b0546c34e6292
parent9d67161388d8f611467660300bdf9715b7f110b0
x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled

Linux'es relatively new use of HVMOP_set_evtchn_upcall_vector has
exposed a problem with the marking of the respective vector as
pending: For quite some time Linux has been checking whether any stale
ISR or IRR bits would still be set while preparing the LAPIC for use.
This check is now triggering on the upcall vector, as the registration,
at least for APs, happens before the LAPIC is actually enabled.

In software-disabled state an LAPIC would not accept any interrupt
requests and hence no IRR bit would newly become set while in this
state. As a result it is also wrong for us to mark the upcall vector as
having a pending request when the vLAPIC is in this state.

To compensate for the "enabled" check added to the assertion logic, add
logic to (conditionally) mark the upcall vector as having a request
pending at the time the LAPIC is being software-enabled by the guest.
Note however that, like for the pt_may_unmask_irq() we already have
there, long term we may need to find a different solution. This will be
especially relevant in case yet better LAPIC acceleration would
eliminate notifications of guest writes to this and other registers.

Fixes: 7b5b8ca7dffd ("x86/upcall: inject a spurious event after setting upcall vector")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/irq.c
xen/arch/x86/hvm/vlapic.c