kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: Cap halt polling at kvm->max_halt_poll_ns
@ 2021-05-06 15:24 Venkatesh Srinivas
  2021-05-06 16:13 ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: Venkatesh Srinivas @ 2021-05-06 15:24 UTC (permalink / raw)
  To: kvm, dmatlack, pbonzini; +Cc: Venkatesh Srinivas

From: David Matlack <dmatlack@google.com>

When growing halt-polling, there is no check that the poll time exceeds
the per-VM limit. It's possible for vcpu->halt_poll_ns to grow past
kvm->max_halt_poll_ns and stay there until a halt which takes longer
than kvm->halt_poll_ns.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2799c6660cce..120817c5f271 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2893,8 +2893,8 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
 	if (val < grow_start)
 		val = grow_start;
 
-	if (val > halt_poll_ns)
-		val = halt_poll_ns;
+	if (val > vcpu->kvm->max_halt_poll_ns)
+		val = vcpu->kvm->max_halt_poll_ns;
 
 	vcpu->halt_poll_ns = val;
 out:
-- 
2.31.1.607.g51e8a6a459-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-06 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 15:24 [PATCH] kvm: Cap halt polling at kvm->max_halt_poll_ns Venkatesh Srinivas
2021-05-06 16:13 ` Sean Christopherson
2021-05-06 16:30   ` David Matlack
2021-05-06 17:41     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).