KVM: Fix simultaneous NMIs
authorAvi Kivity <avi@redhat.com>
Tue, 20 Sep 2011 10:43:14 +0000 (13:43 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 25 Sep 2011 16:52:59 +0000 (19:52 +0300)
commit7460fb4a340033107530df19e7e125bd0969bfb2
tree02f2aedd48af0a2e316b28d6a5b21a7a96442ac6
parent1cd196ea42c526549ded4fd29809c3fdaa4a7f41
KVM: Fix simultaneous NMIs

If simultaneous NMIs happen, we're supposed to queue the second
and next (collapsing them), but currently we sometimes collapse
the second into the first.

Fix by using a counter for pending NMIs instead of a bool; since
the counter limit depends on whether the processor is currently
in an NMI handler, which can only be checked in vcpu context
(via the NMI mask), we add a new KVM_REQ_NMI to request recalculation
of the counter.

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