KVM: Fix race between APIC TMR and IRR
commit59cf8545b9b307b15441f07dec587b7774484789
authorAvi Kivity <avi@redhat.com>
Tue, 29 Dec 2009 10:42:16 +0000 (29 12:42 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Jan 2010 23:02:44 +0000 (28 15:02 -0800)
tree1010293a66ba59cc1c977cc029e0797d1409f7c2
parentf0d13b89d4b12f331a0dd1d646a69060e49b1951
KVM: Fix race between APIC TMR and IRR

commit a5d36f82c4f3e852b61fdf1fee13463c8aa91b90 upstream.

When we queue an interrupt to the local apic, we set the IRR before the TMR.
The vcpu can pick up the IRR and inject the interrupt before setting the TMR,
and perhaps even EOI it, causing incorrect behaviour.

The race is really insignificant since it can only occur on the first
interrupt (usually following interrupts will not change TMR), but it's better
closed than open.

Fixed by reordering setting the TMR vs IRR.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/lapic.c