mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Marcelo Tosatti" <mtosatti@redhat.com>
Subject: Re: [PATCH v2] KVM: Don't shrink/grow vCPU halt_poll_ns if host side polling is disabled
Date: Tue, 8 Oct 2019 14:11:21 +0200	[thread overview]
Message-ID: <a0f940ba-7bc9-8695-c233-0d82858fb91d@redhat.com> (raw)
In-Reply-To: <1569719216-32080-1-git-send-email-wanpengli@tencent.com>

On 29/09/19 03:06, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> Don't waste cycles to shrink/grow vCPU halt_poll_ns if host 
> side polling is disabled.
> 
> Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
> v1 -> v2: 
>  * fix coding style
> 
>  virt/kvm/kvm_main.c | 29 ++++++++++++++++-------------
>  1 file changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index e6de315..9d5eed9 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2359,20 +2359,23 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
>  	kvm_arch_vcpu_unblocking(vcpu);
>  	block_ns = ktime_to_ns(cur) - ktime_to_ns(start);
>  
> -	if (!vcpu_valid_wakeup(vcpu))
> -		shrink_halt_poll_ns(vcpu);
> -	else if (halt_poll_ns) {
> -		if (block_ns <= vcpu->halt_poll_ns)
> -			;
> -		/* we had a long block, shrink polling */
> -		else if (vcpu->halt_poll_ns && block_ns > halt_poll_ns)
> +	if (!kvm_arch_no_poll(vcpu)) {
> +		if (!vcpu_valid_wakeup(vcpu)) {
>  			shrink_halt_poll_ns(vcpu);
> -		/* we had a short halt and our poll time is too small */
> -		else if (vcpu->halt_poll_ns < halt_poll_ns &&
> -			block_ns < halt_poll_ns)
> -			grow_halt_poll_ns(vcpu);
> -	} else
> -		vcpu->halt_poll_ns = 0;
> +		} else if (halt_poll_ns) {
> +			if (block_ns <= vcpu->halt_poll_ns)
> +				;
> +			/* we had a long block, shrink polling */
> +			else if (vcpu->halt_poll_ns && block_ns > halt_poll_ns)
> +				shrink_halt_poll_ns(vcpu);
> +			/* we had a short halt and our poll time is too small */
> +			else if (vcpu->halt_poll_ns < halt_poll_ns &&
> +				block_ns < halt_poll_ns)
> +				grow_halt_poll_ns(vcpu);
> +		} else {
> +			vcpu->halt_poll_ns = 0;
> +		}
> +	}
>  
>  	trace_kvm_vcpu_wakeup(block_ns, waited, vcpu_valid_wakeup(vcpu));
>  	kvm_arch_vcpu_block_finish(vcpu);
> 

Queued, thanks.

Paolo

      parent reply	other threads:[~2019-10-08 12:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-29  1:06 Wanpeng Li
2019-10-08  1:07 ` Wanpeng Li
2019-10-08 12:11 ` 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=a0f940ba-7bc9-8695-c233-0d82858fb91d@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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

all inboxes | Powered by JetHome®