linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sasha Levin <sashal@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>, kvm@vger.kernel.org
Subject: Re: [PATCH MANUALSEL 5.14 3/9] KVM: do not shrink halt_poll_ns below grow_start
Date: Wed, 6 Oct 2021 15:36:24 +0200	[thread overview]
Message-ID: <e561a2a4-96f1-a56c-21f0-06e4e21c4765@redhat.com> (raw)
In-Reply-To: <20211006133021.271905-3-sashal@kernel.org>

On 06/10/21 15:30, Sasha Levin wrote:
> From: Sergey Senozhatsky <senozhatsky@chromium.org>
> 
> [ Upstream commit ae232ea460888dc5a8b37e840c553b02521fbf18 ]
> 
> grow_halt_poll_ns() ignores values between 0 and
> halt_poll_ns_grow_start (10000 by default). However,
> when we shrink halt_poll_ns we may fall way below
> halt_poll_ns_grow_start and endup with halt_poll_ns
> values that don't make a lot of sense: like 1 or 9,
> or 19.
> 
> VCPU1 trace (halt_poll_ns_shrink equals 2):
> 
> VCPU1 grow 10000
> VCPU1 shrink 5000
> VCPU1 shrink 2500
> VCPU1 shrink 1250
> VCPU1 shrink 625
> VCPU1 shrink 312
> VCPU1 shrink 156
> VCPU1 shrink 78
> VCPU1 shrink 39
> VCPU1 shrink 19
> VCPU1 shrink 9
> VCPU1 shrink 4
> 
> Mirror what grow_halt_poll_ns() does and set halt_poll_ns
> to 0 as soon as new shrink-ed halt_poll_ns value falls
> below halt_poll_ns_grow_start.
> 
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-Id: <20210902031100.252080-1-senozhatsky@chromium.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   virt/kvm/kvm_main.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index b50dbe269f4b..1a11dcb670a3 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -3053,15 +3053,19 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
>   
>   static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
>   {
> -	unsigned int old, val, shrink;
> +	unsigned int old, val, shrink, grow_start;
>   
>   	old = val = vcpu->halt_poll_ns;
>   	shrink = READ_ONCE(halt_poll_ns_shrink);
> +	grow_start = READ_ONCE(halt_poll_ns_grow_start);
>   	if (shrink == 0)
>   		val = 0;
>   	else
>   		val /= shrink;
>   
> +	if (val < grow_start)
> +		val = 0;
> +
>   	vcpu->halt_poll_ns = val;
>   	trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old);
>   }
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>


  reply	other threads:[~2021-10-06 13:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 13:30 [PATCH MANUALSEL 5.14 1/9] selftests: KVM: Align SMCCC call with the spec in steal_time Sasha Levin
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 2/9] KVM: x86: Handle SRCU initialization failure during page track init Sasha Levin
2021-10-06 13:36   ` Paolo Bonzini
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 3/9] KVM: do not shrink halt_poll_ns below grow_start Sasha Levin
2021-10-06 13:36   ` Paolo Bonzini [this message]
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 4/9] KVM: x86: reset pdptrs_from_userspace when exiting smm Sasha Levin
2021-10-06 13:36   ` Paolo Bonzini
2021-10-07 15:23     ` Naresh Kamboju
2021-10-07 17:47       ` Paolo Bonzini
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 5/9] KVM: x86: VMX: synthesize invalid VM exit when emulating invalid guest state Sasha Levin
2021-10-06 13:35   ` Paolo Bonzini
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 6/9] KVM: x86: nVMX: don't fail nested VM entry on invalid guest state if !from_vmentry Sasha Levin
2021-10-06 13:36   ` Paolo Bonzini
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 7/9] kvm: x86: Add AMD PMU MSRs to msrs_to_save_all[] Sasha Levin
2021-10-06 13:36   ` Paolo Bonzini
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 8/9] KVM: x86: nSVM: restore int_vector in svm_clear_vintr Sasha Levin
2021-10-06 13:36   ` Paolo Bonzini
2021-10-06 13:30 ` [PATCH MANUALSEL 5.14 9/9] ALSA: pcsp: Make hrtimer forwarding more robust Sasha Levin
2021-10-06 13:36 ` [PATCH MANUALSEL 5.14 1/9] selftests: KVM: Align SMCCC call with the spec in steal_time Paolo Bonzini

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=e561a2a4-96f1-a56c-21f0-06e4e21c4765@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=stable@vger.kernel.org \
    /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).