Re: [PATCH 3/5] KVM: ensure pool time is longer than block_ns

From: Marcelo Tosatti
Date: Fri Nov 01 2019 - 17:27:01 EST


On Sat, Oct 26, 2019 at 11:23:57AM +0800, Zhenzhong Duan wrote:
> When (block_ns == vcpu->halt_poll_ns), there is not a margin so that
> vCPU may still get into block state unnecessorily.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxxx>
> ---
> virt/kvm/kvm_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 1b6fe3b..48a1f1a 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2371,7 +2371,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> if (!vcpu_valid_wakeup(vcpu)) {
> shrink_halt_poll_ns(vcpu);
> } else if (halt_poll_ns) {
> - if (block_ns <= vcpu->halt_poll_ns)
> + if (block_ns < vcpu->halt_poll_ns)
> ;
> /* we had a short halt and our poll time is too small */
> else if (block_ns < halt_poll_ns)
> --
> 1.8.3.1

Makes sense.