Skip to content

Commit

Permalink
kvm: Cap halt polling at kvm->max_halt_poll_ns
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Venkatesh Srinivas <[email protected]>
Message-Id: <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
dmatlack authored and bonzini committed May 7, 2021
1 parent b269909 commit 258785e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 258785e

Please sign in to comment.