Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1403653
| Path | csiph.com!news.mixmin.net!border2.nntp.ams1.giganews.com!nntp.giganews.com!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| 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 | Thu, 19 May 2016 13:30:01 +0200 |
| Message-ID | <rAujn-7ti-7@gated-at.bofh.it> (permalink) |
| References | <rAsrf-6ir-1@gated-at.bofh.it> |
| X-Original-To | Wanpeng Li <kernellwp@gmail.com>, linux-kernel@vger.kernel.org, kvm@vger.kernel.org |
| X-Ibm-Helo | d06dlp01.portsmouth.uk.ibm.com |
| X-Ibm-Mailfrom | borntraeger@de.ibm.com |
| X-Ibm-Rcptto | kvm@vger.kernel.org;linux-kernel@vger.kernel.org |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Tm-As-Mml | disable |
| X-Content-Scanned | Fidelis XPS MAILER |
| X-Cbid | 16051911-0013-0000-0000-000013DF1AF9 |
| X-Ibm-Av-Detection | SAVI=unused REMOTE=unused XFE=unused |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 58 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Wanpeng Li <wanpeng.li@hotmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Radim Krčmář <rkrcmar@redhat.com>, David Matlack <dmatlack@google.com> |
| X-Original-Date | Thu, 19 May 2016 13:23:57 +0200 |
| X-Original-Message-ID | <573DA24D.3080507@de.ibm.com> |
| X-Original-References | <1463649990-5889-1-git-send-email-wanpeng.li@hotmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1403653 |
Show key headers only | View raw
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.
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -78,6 +78,9 @@ module_param(halt_poll_ns_grow, uint, S_IRUGO | S_IWUSR);
> static unsigned int halt_poll_ns_shrink;
> module_param(halt_poll_ns_shrink, uint, S_IRUGO | S_IWUSR);
>
> +/* lower-end of message passing workload latency TCP_RR's poll time < 10us */
> +static unsigned int halt_poll_ns_base = 10000;
> +
> /*
> * Ordering of locks:
> *
> @@ -1966,7 +1969,7 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
> grow = READ_ONCE(halt_poll_ns_grow);
> /* 10us base */
> if (val == 0 && grow)
> - val = 10000;
> + val = halt_poll_ns_base;
> else
> val *= grow;
>
> @@ -2015,11 +2018,15 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> DECLARE_SWAITQUEUE(wait);
> bool waited = false;
> u64 block_ns;
> + unsigned int delta, remaining;
>
> + remaining = kvm_arch_timer_remaining(vcpu);
and now it causes undefined behaviour, no?
> start = cur = ktime_get();
> - if (vcpu->halt_poll_ns) {
> - ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
> + if (vcpu->halt_poll_ns || (remaining < halt_poll_ns_base)) {
> + ktime_t stop;
>
> + delta = vcpu->halt_poll_ns ? vcpu->halt_poll_ns : remaining;
> + stop = ktime_add_ns(ktime_get(), delta);
> ++vcpu->stat.halt_attempted_poll;
> do {
> /*
>
So you avoid to shrink/grow for these cases? Probably makes sense
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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