mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	joao.m.martins@oracle.com, rafael.j.wysocki@intel.com,
	rkrcmar@redhat.com, pbonzini@redhat.com
Subject: Re: [PATCH 1/5] KVM: simplify branch check in host poll code
Date: Mon, 4 Nov 2019 11:49:27 +0800	[thread overview]
Message-ID: <c6a23208-4432-6fc4-a3f8-56a6aff07fd8@oracle.com> (raw)
In-Reply-To: <20191101210331.GA20061@amt.cnet>


On 2019/11/2 5:03, Marcelo Tosatti wrote:
> On Sat, Oct 26, 2019 at 11:23:55AM +0800, Zhenzhong Duan wrote:
>> Remove redundant check.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
>> ---
>>   virt/kvm/kvm_main.c | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 67ef3f2..2ca2979 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -2366,13 +2366,12 @@ void kvm_vcpu_block(struct kvm_vcpu *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)
>> -				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 &&
> This is not a redundant check: it avoids from calling
> into grow_halt_poll_ns, which will do:
>
> 	1) Multiplication
> 	2) Cap that back to halt_poll_ns
> 	3) Invoke the trace_kvm_halt_poll_ns_grow tracepoint
> 	   (when in fact vcpu->halt_poll_ns did not grow).

In this branch, vcpu->halt_poll_ns < block_ns is true, and if block_ns < 
halt_poll_ns,

then vcpu->halt_poll_ns < halt_poll_ns is always true, isn't it?


I realized I ignored the situation that halt_poll_ns and 
halt_poll_ns_grow could be

updated at runtime, so pls ignore this patch, I'll fix it by following 
the guest haltpoll code.

Thanks

Zhenzhong


  reply	other threads:[~2019-11-04  3:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26  3:23 [PATCH 0/5] misc fixes on halt-poll code both KVM and guest Zhenzhong Duan
2019-10-26  3:23 ` [PATCH 1/5] KVM: simplify branch check in host poll code Zhenzhong Duan
2019-11-01 21:03   ` Marcelo Tosatti
2019-11-04  3:49     ` Zhenzhong Duan [this message]
2019-10-26  3:23 ` [PATCH 2/5] KVM: add a check to ensure grow start value is nonzero Zhenzhong Duan
2019-11-11 13:49   ` Paolo Bonzini
2019-10-26  3:23 ` [PATCH 3/5] KVM: ensure pool time is longer than block_ns Zhenzhong Duan
2019-11-01 21:16   ` Marcelo Tosatti
2019-11-11 13:53     ` Paolo Bonzini
2019-11-12 12:14       ` Zhenzhong Duan
2019-10-26  3:23 ` [PATCH 4/5] cpuidle-haltpoll: add a check to ensure grow start value is nonzero Zhenzhong Duan
2019-11-01 21:19   ` Marcelo Tosatti
2019-11-04  2:56     ` Zhenzhong Duan
2019-11-11 13:54       ` Paolo Bonzini
2019-10-26  3:23 ` [PATCH 5/5] cpuidle-haltpoll: fix up the branch check Zhenzhong Duan
2019-11-01 21:26   ` Marcelo Tosatti
2019-11-04  3:10     ` Zhenzhong Duan
2019-11-04 15:01       ` Marcelo Tosatti
2019-11-05  6:49         ` Zhenzhong Duan

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=c6a23208-4432-6fc4-a3f8-56a6aff07fd8@oracle.com \
    --to=zhenzhong.duan@oracle.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rkrcmar@redhat.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®