From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Wanpeng Li" <wanpeng.li@hotmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"David Matlack" <dmatlack@google.com>,
"Yang Zhang" <yang.zhang.wz@gmail.com>
Subject: Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers
Date: Tue, 24 May 2016 19:15:14 +0200 [thread overview]
Message-ID: <57448C22.2030504@de.ibm.com> (raw)
In-Reply-To: <1464076674-4024-1-git-send-email-wanpeng.li@hotmail.com>
On 05/24/2016 09:57 AM, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> If an emulated lapic timer will fire soon(in the scope of 10us the
> base of dynamic halt-polling, lower-end of message passing workload
> latency TCP_RR's poll time < 10us) we can treat it as a short halt,
> and poll to wait it fire, the fire callback apic_timer_fn() will set
> KVM_REQ_PENDING_TIMER, and this flag will be check during busy poll.
> This can avoid context switch overhead and the latency which we wake
> up vCPU.
>
> This feature is slightly different from current advance expiration
> way. Advance expiration rely on the vCPU is running(do polling before
> vmentry). But in some cases, the timer interrupt may be blocked by
> other thread(i.e., IF bit is clear) and vCPU cannot be scheduled to
> run immediately. So even advance the timer early, vCPU may still see
> the latency. But polling is different, it ensures the vCPU to aware
> the timer expiration before schedule out.
>
> echo HRTICK > /sys/kernel/debug/sched_features in dynticks guests.
>
> Context switching - times in microseconds - smaller is better
> -------------------------------------------------------------------------
> Host OS 2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K
> ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw
> --------- ------------- ------ ------ ------ ------ ------ ------- -------
> kernel Linux 4.6.0+ 7.9800 11.0 10.8 14.6 9.4300 13.0 10.2 vanilla
> kernel Linux 4.6.0+ 15.3 13.6 10.7 12.5 9.0000 12.8 7.38000 poll
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: David Matlack <dmatlack@google.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Yang Zhang <yang.zhang.wz@gmail.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> v3 -> v4:
> * add module parameter halt_poll_ns_timer
> * rename patch subject since lapic maybe just for x86.
> v2 -> v3:
> * add Yang's statement to patch description
> v1 -> v2:
> * add return statement to non-x86 archs
> * capture never expire case for x86 (hrtimer is not started)
>
> arch/arm/include/asm/kvm_host.h | 4 ++++
> arch/arm64/include/asm/kvm_host.h | 4 ++++
> arch/mips/include/asm/kvm_host.h | 4 ++++
> arch/powerpc/include/asm/kvm_host.h | 4 ++++
> arch/s390/include/asm/kvm_host.h | 4 ++++
> arch/x86/kvm/lapic.c | 11 +++++++++++
> arch/x86/kvm/lapic.h | 1 +
> arch/x86/kvm/x86.c | 5 +++++
> include/linux/kvm_host.h | 1 +
> virt/kvm/kvm_main.c | 15 +++++++++++----
> 10 files changed, 49 insertions(+), 4 deletions(-)
[...]
@@ -1966,7 +1970,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_timer;
Drop this hunk and leave this at 10000, so that a user can disable the timer
logic, but keep the old polling?
> else
> val *= grow;
>
>
next prev parent reply other threads:[~2016-05-24 17:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-24 7:57 [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Wanpeng Li
2016-05-24 17:15 ` Christian Borntraeger [this message]
2016-05-24 23:16 ` Wanpeng Li
2016-05-24 22:38 ` David Matlack
2016-05-24 23:11 ` Wanpeng Li
2016-05-24 23:37 ` David Matlack
2016-05-25 0:47 ` Wanpeng Li
2016-05-25 1:29 ` Wanpeng Li
2016-05-25 2:10 ` Yang Zhang
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=57448C22.2030504@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 \
--cc=yang.zhang.wz@gmail.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