vlapic/viridian: abort existing APIC assist if any vector is pending in ISR
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 7 Mar 2017 14:58:04 +0000 (14:58 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 7 Mar 2017 17:30:03 +0000 (17:30 +0000)
commit4361e80d228655b100bae5d19b489b39d20aa68d
tree949ea7190b594aba4118b60c5f35c816aa1e9977
parentc2e316b2f220af06dab76b1219e61441c31f6ff9
vlapic/viridian: abort existing APIC assist if any vector is pending in ISR

The vlapic code already aborts an APIC assist if an interrupt is deferred
because a higher priority interrupt has already been delivered (and hence
its vector is pending in the ISR).

However, it is also necessary to abort an APIC assist in the case where a
higher priority is about to be delivered because, in either case, at least
two vectors will be pending in the ISR and hence an EOI is necessary.

Also, following on from the above reasoning, the decision to start a new
APIC assist should clearly be based upon whether any other vector is
pending in the ISR, regardless of whether it is lower or higher in
priority. (In fact the code in question cannot be reached if the
vector is lower in priority). Thus the single use of
vlapic_find_lowest_vector() can be replaced with a call to
vlapic_find_highest_isr() and the former function removed.

Without this patch, because the logic is flawed, a domain_crash() results
when an attempt is made to erroneously start a new APIC assist.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/vlapic.c