summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorBenjamin Segall <bsegall@google.com>2021-04-29 18:22:34 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-05-03 17:25:36 +0200
commit262de4102c7bb8e59f26a967a8ffe8cce85cc537 (patch)
tree5edd83d866953237b4971e9c1ab9e60d7bc416e9 /virt
parentKVM: LAPIC: Accurately guarantee busy wait for timer to expire when using hv_... (diff)
downloadlinux-262de4102c7bb8e59f26a967a8ffe8cce85cc537.tar.xz
linux-262de4102c7bb8e59f26a967a8ffe8cce85cc537.zip
kvm: exit halt polling on need_resched() as well
single_task_running() is usually more general than need_resched() but CFS_BANDWIDTH throttling will use resched_task() when there is just one task to get the task to block. This was causing long-need_resched warnings and was likely allowing VMs to overrun their quota when halt polling. Signed-off-by: Ben Segall <bsegall@google.com> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org> Message-Id: <20210429162233.116849-1-venkateshs@chromium.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: stable@vger.kernel.org Reviewed-by: Jim Mattson <jmattson@google.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2799c6660cce..b9f12da6af0e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2973,7 +2973,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out;
}
poll_end = cur = ktime_get();
- } while (single_task_running() && ktime_before(cur, stop));
+ } while (single_task_running() && !need_resched() &&
+ ktime_before(cur, stop));
}
prepare_to_rcuwait(&vcpu->wait);