grow_halt_poll_ns() have a strange behavior in case
(halt_poll_ns_grow == 0) && (vcpu->halt_poll_ns != 0).
In this case, vcpu->halt_pol_ns will be set to zero.
That results in shrinking instead of growing.
Fix issue by changing grow_halt_poll_ns() to not modify
vcpu->halt_poll_ns in case halt_poll_ns_grow is zero
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Nir Weiner <nir.weiner@oracle.com>
Suggested-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
static void grow_halt_poll_ns(struct kvmppc_vcore *vc)
{
+ if (!halt_poll_ns_grow)
+ return;
+
/* 10us base */
- if (vc->halt_poll_ns == 0 && halt_poll_ns_grow)
+ if (vc->halt_poll_ns == 0)
vc->halt_poll_ns = 10000;
else
vc->halt_poll_ns *= halt_poll_ns_grow;
old = val = vcpu->halt_poll_ns;
grow = READ_ONCE(halt_poll_ns_grow);
+ if (!grow)
+ goto out;
+
/* 10us base */
- if (val == 0 && grow)
+ if (val == 0)
val = 10000;
else
val *= grow;
val = halt_poll_ns;
vcpu->halt_poll_ns = val;
+out:
trace_kvm_halt_poll_ns_grow(vcpu->vcpu_id, val, old);
}