Skip to content

Commit

Permalink
KVM: Fix unbounded preemption latency
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Avi Kivity committed Jan 30, 2008
1 parent 97db56c commit 6c14280
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2535,6 +2535,13 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)

local_irq_disable();

if (need_resched()) {
local_irq_enable();
preempt_enable();
r = 1;
goto out;
}

if (signal_pending(current)) {
local_irq_enable();
preempt_enable();
Expand Down

0 comments on commit 6c14280

Please sign in to comment.