Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403693

Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon

From Christian Borntraeger <borntraeger@de.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon
Date 2016-05-19 14:00 +0200
Message-ID <rAuMv-7EI-31@gated-at.bofh.it> (permalink)
References <rAsrf-6ir-1@gated-at.bofh.it> <rAujn-7ti-7@gated-at.bofh.it> <rAut4-7xJ-21@gated-at.bofh.it> <rAuCJ-7Be-1@gated-at.bofh.it> <rAuCK-7Be-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon Wanpeng Li <kernellwp@gmail.com> - 2016-05-19 11:30 +0200
  Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire  soon Christian Borntraeger <borntraeger@de.ibm.com> - 2016-05-19 13:30 +0200
    Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon Wanpeng Li <kernellwp@gmail.com> - 2016-05-19 13:40 +0200
      Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire  soon Christian Borntraeger <borntraeger@de.ibm.com> - 2016-05-19 13:50 +0200
        Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon Wanpeng Li <kernellwp@gmail.com> - 2016-05-19 13:50 +0200
          Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire  soon Christian Borntraeger <borntraeger@de.ibm.com> - 2016-05-19 14:00 +0200
            Re: [PATCH] KVM: halt-polling: poll if emulated lapic timer will fire soon Wanpeng Li <kernellwp@gmail.com> - 2016-05-19 14:10 +0200

csiph-web