KVM: grow_halt_poll_ns() should never shrink vCPU halt_poll_ns
authorNir Weiner <nir.weiner@oracle.com>
Sun, 27 Jan 2019 10:17:14 +0000 (12:17 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 20 Feb 2019 21:48:50 +0000 (22:48 +0100)
commit7fa08e71b4a0591a518814fa78b32e124f90d587
treef8b66306b476c5b6e833bceef8a0434bc9116652
parent8ab3c471eef20925bf64c6d4fa46e88cdb4e86d5
KVM: grow_halt_poll_ns() should never shrink vCPU halt_poll_ns

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>
arch/powerpc/kvm/book3s_hv.c
virt/kvm/kvm_main.c