KVM: close timer injection race window in __vcpu_run
authorMarcelo Tosatti <mtosatti@redhat.com>
Fri, 6 Jun 2008 19:37:36 +0000 (16:37 -0300)
committerAvi Kivity <avi@qumranet.com>
Tue, 24 Jun 2008 09:16:59 +0000 (12:16 +0300)
commit06e05645661211b9eaadaf6344c335d2e80f0ba2
tree8846d2a5052aec44141e811c0a76fdb39c2e77ca
parentd4acf7e7abe45457e751525a2a4d5b693dfdd597
KVM: close timer injection race window in __vcpu_run

If a timer fires after kvm_inject_pending_timer_irqs() but before
local_irq_disable() the code will enter guest mode and only inject such
timer interrupt the next time an unrelated event causes an exit.

It would be simpler if the timer->pending irq conversion could be done
with IRQ's disabled, so that the above problem cannot happen.

For now introduce a new vcpu requests bit to cancel guest entry.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/i8254.c
arch/x86/kvm/lapic.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h