summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorDavid Matlack <dmatlack@google.com>2021-05-06 15:24:43 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2021-05-07 06:06:22 -0400
commit258785ef08b323bddd844b4926a32c2b2045a1b0 (patch)
treee5d433f41dd7d413f054c04b3c429c423a399235 /virt
parentb26990987ffce0525abbd84b36595869cfdbbfe6 (diff)
downloadlinux-258785ef08b323bddd844b4926a32c2b2045a1b0.tar.gz
kvm: Cap halt polling at kvm->max_halt_poll_ns
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> Message-Id: <20210506152442.4010298-1-venkateshs@chromium.org> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b9f12da6af0e..6b4feb92dc79 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: