Skip to content

Commit 258785e

Browse files
dmatlackbonzini
authored andcommitted
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>
1 parent b269909 commit 258785e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

virt/kvm/kvm_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,8 +2893,8 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
28932893
if (val < grow_start)
28942894
val = grow_start;
28952895

2896-
if (val > halt_poll_ns)
2897-
val = halt_poll_ns;
2896+
if (val > vcpu->kvm->max_halt_poll_ns)
2897+
val = vcpu->kvm->max_halt_poll_ns;
28982898

28992899
vcpu->halt_poll_ns = val;
29002900
out:

0 commit comments

Comments
 (0)