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

From: Zhenzhong Duan
Date: Tue Nov 12 2019 - 07:14:15 EST



On 2019/11/11 21:53, Paolo Bonzini wrote:
On 01/11/19 22:16, Marcelo Tosatti wrote:
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)
What about making this "if (!waited)"? The result would be very readable:

if (!waited)
;
/* we had a long block, shrink polling */
else if (block_ns > halt_poll_ns && vcpu->halt_poll_ns)
shrink_halt_poll_ns(vcpu);
/* we had a short halt and our poll time is too small */
else if (block_ns < halt_poll_ns && vcpu->halt_poll_ns < halt_poll_ns)
grow_halt_poll_ns(vcpu);

This patch is dropped in v2 as it rarely happen in real scenario.

Appreciate you reviewing v2 in https://lkml.org/lkml/2019/11/6/447

Thanks

Zhenzhong