summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-01-15 16:27:32 (GMT)
committerAvi Kivity <avi@qumranet.com>2008-01-30 16:01:22 (GMT)
commit6c14280125a374d4c279a68276f97245e03e3f68 (patch)
tree9a562a81927810f5e1ef38b05c109129a19b93cd /arch/x86
parent97db56ce6cc2a0766b536cc227a1da20acc5d82f (diff)
downloadlinux-6c14280125a374d4c279a68276f97245e03e3f68.tar.xz
KVM: Fix unbounded preemption latency
When preparing to enter the guest, if an interrupt comes in while preemption is disabled but interrupts are still enabled, we miss a preemption point. Fix by explicitly checking whether we need to reschedule. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/x86.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 77d57ff..f0493e7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2535,6 +2535,13 @@ again:
local_irq_disable();
+ if (need_resched()) {
+ local_irq_enable();
+ preempt_enable();
+ r = 1;
+ goto out;
+ }
+
if (signal_pending(current)) {
local_irq_enable();
preempt_enable();