From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] kvm: cap halt polling at exactly halt_poll_ns Date: Wed, 9 Mar 2016 11:55:21 +0100 Message-ID: <56E00119.9060702@redhat.com> References: <1457482784-82531-1-git-send-email-dmatlack@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, wanpeng.li@hotmail.com To: David Matlack , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42286 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752645AbcCIKzZ (ORCPT ); Wed, 9 Mar 2016 05:55:25 -0500 In-Reply-To: <1457482784-82531-1-git-send-email-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/03/2016 01:19, David Matlack wrote: > When growing halt-polling, there is no check that the poll time exceeds > the limit. It's possible for vcpu->halt_poll_ns grow once past > halt_poll_ns, and stay there until a halt which takes longer than > vcpu->halt_poll_ns. For example, booting a Linux guest with > halt_poll_ns=11000: > > ... kvm:kvm_halt_poll_ns: vcpu 0: halt_poll_ns 0 (shrink 10000) > ... kvm:kvm_halt_poll_ns: vcpu 0: halt_poll_ns 10000 (grow 0) > ... kvm:kvm_halt_poll_ns: vcpu 0: halt_poll_ns 20000 (grow 10000) > > Signed-off-by: David Matlack > --- > virt/kvm/kvm_main.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index a11cfd2..9102ae1 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -1952,6 +1952,9 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu) > else > val *= halt_poll_ns_grow; > > + if (val > halt_poll_ns) > + val = halt_poll_ns; > + > vcpu->halt_poll_ns = val; > trace_kvm_halt_poll_ns_grow(vcpu->vcpu_id, val, old); > } > Applied to kvm/master, thanks. Paolo