linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>, "Wanpeng Li" <wanpeng.li@hotmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"David Matlack" <dmatlack@google.com>
Subject: Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon
Date: Thu, 19 May 2016 13:56:03 +0200	[thread overview]
Message-ID: <573DA9D3.3070205@de.ibm.com> (raw)
In-Reply-To: <CANRm+Cyix-AzUO2+osGz+1M6vh=pjafjNQcrUBKWB5NOD853kQ@mail.gmail.com>

On 05/19/2016 01:48 PM, Wanpeng Li wrote:
> 2016-05-19 19:42 GMT+08:00 Christian Borntraeger <borntraeger@de.ibm.com>:
>> On 05/19/2016 01:35 PM, Wanpeng Li wrote:
>>> 2016-05-19 19:23 GMT+08:00 Christian Borntraeger <borntraeger@de.ibm.com>:
>>>> On 05/19/2016 11:26 AM, Wanpeng Li wrote:
>>>>
>>>> I think in general a good idea to poll if a timer will expire soon.
>>>>
>>>> Some patch comments:
>>>>
>>>> Same for all non-x86 archs:
>>>>> +static inline unsigned int kvm_arch_timer_remaining(struct kvm_vcpu *vcpu) {}
>>>>
>>>> A function returning int, without a return statement?
>>>> That gives at least a compiler warning.
>>>
>>> How about return 0 for all non-x86 archs?
>>
>> We will provide an s390 implementation soon, but until then a proper
>> default would be good.
>>
>> [....]
>>>>> +     if (vcpu->halt_poll_ns || (remaining < halt_poll_ns_base)) {
>>
>> but then remaining is 0 and the 2nd condition will always be true, no?
> 
> Nice catch!
> 
> How about something like below:
> 
> +       if (vcpu->halt_poll_ns ||
> +               (remaining != 0 && remaining < halt_poll_ns_base)) {

Maybe just use -1UL to have a "will never expire" and change the return value into u64
while changing that.

  reply	other threads:[~2016-05-19 11:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19  9:26 [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon Wanpeng Li
2016-05-19 11:23 ` Christian Borntraeger
2016-05-19 11:35   ` Wanpeng Li
2016-05-19 11:42     ` Christian Borntraeger
2016-05-19 11:48       ` Wanpeng Li
2016-05-19 11:56         ` Christian Borntraeger [this message]
2016-05-19 12:00           ` Wanpeng Li

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=573DA9D3.3070205@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=dmatlack@google.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --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).