From: Paolo Bonzini <pbonzini@redhat.com>
To: David Matlack <dmatlack@google.com>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, wanpeng.li@hotmail.com
Subject: Re: [PATCH] kvm: cap halt polling at exactly halt_poll_ns
Date: Wed, 9 Mar 2016 11:55:21 +0100 [thread overview]
Message-ID: <56E00119.9060702@redhat.com> (raw)
In-Reply-To: <1457482784-82531-1-git-send-email-dmatlack@google.com>
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 <dmatlack@google.com>
> ---
> 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
prev parent reply other threads:[~2016-03-09 10:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 0:19 [PATCH] kvm: cap halt polling at exactly halt_poll_ns David Matlack
2016-03-09 10:55 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E00119.9060702@redhat.com \
--to=pbonzini@redhat.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).