浏览代码

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>
Avi Kivity 17 年之前
父节点
当前提交
6c14280125
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      arch/x86/kvm/x86.c

+ 7 - 0
arch/x86/kvm/x86.c

@@ -2535,6 +2535,13 @@ again:
 
 
 	local_irq_disable();
 	local_irq_disable();
 
 
+	if (need_resched()) {
+		local_irq_enable();
+		preempt_enable();
+		r = 1;
+		goto out;
+	}
+
 	if (signal_pending(current)) {
 	if (signal_pending(current)) {
 		local_irq_enable();
 		local_irq_enable();
 		preempt_enable();
 		preempt_enable();