[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86/vIRQ: IRR and TMR race condition bug fix

# HG changeset patch
# User Yongan Liu<Liuyongan@xxxxxxxxxx>
# Date 1325752199 -3600
# Node ID 02b92d035f6484ea33f03c4a59630d82e0469eeb
# Parent  efaa28639a71524a693ba500624f8512e5795e18
x86/vIRQ: IRR and TMR race condition bug fix

In vlapic_set_irq, we set the IRR register before the TMR. And the IRR
might be serviced before setting TMR, and even worse EOI might occur
before TMR setting, in which case the vioapic_update_EOI won't be
called, and further prevent all the subsequent interrupt injecting.
Reorder setting the TMR and IRR will solve the problem.

Besides, KVM has fixed a similar bug in:

Signed-off-by: Yongan Liu<Liuyongan@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>

diff -r efaa28639a71 -r 02b92d035f64 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Wed Jan 04 16:12:44 2012 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Thu Jan 05 09:29:59 2012 +0100
@@ -142,14 +142,11 @@
 int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
-    int ret;
-    ret = !vlapic_test_and_set_irr(vec, vlapic);
     if ( trig )
         vlapic_set_vector(vec, &vlapic->regs->data[APIC_TMR]);
     /* We may need to wake up target vcpu, besides set pending bit here */
-    return ret;
+    return !vlapic_test_and_set_irr(vec, vlapic);
 static int vlapic_find_highest_isr(struct vlapic *vlapic)

Xen-changelog mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.