From: Wanpeng Li <kernellwp@gmail.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: [PATCH v2 0/4] KVM: LAPIC: Optimize timer latency further
Date: Wed, 15 May 2019 12:11:50 +0800 [thread overview]
Message-ID: <1557893514-5815-1-git-send-email-wanpengli@tencent.com> (raw)
Advance lapic timer tries to hidden the hypervisor overhead between the
host emulated timer fires and the guest awares the timer is fired. However,
it just hidden the time between apic_timer_fn/handle_preemption_timer ->
wait_lapic_expire, instead of the real position of vmentry which is
mentioned in the orignial commit d0659d946be0 ("KVM: x86: add option to
advance tscdeadline hrtimer expiration"). There is 700+ cpu cycles between
the end of wait_lapic_expire and before world switch on my haswell desktop,
it will be 2400+ cycles if vmentry_l1d_flush is tuned to always.
This patchset tries to narrow the last gap(wait_lapic_expire -> world switch),
it takes the real overhead time between apic_timer_fn/handle_preemption_timer
and before world switch into consideration when adaptively tuning timer
advancement. The patchset can reduce 40% latency (~1600+ cycles to ~1000+
cycles on a haswell desktop) for kvm-unit-tests/tscdeadline_latency when
testing busy waits.
v1 -> v2:
* fix indent in patch 1/4
* remove the wait_lapic_expire() tracepoint and expose by debugfs
* move the call to wait_lapic_expire() into vmx.c and svm.c
Wanpeng Li (4):
KVM: LAPIC: Extract adaptive tune timer advancement logic
KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow
KVM: LAPIC: Expose per-vCPU timer adavance information to userspace
KVM: LAPIC: Optimize timer latency further
arch/x86/kvm/debugfs.c | 16 +++++++++++++
arch/x86/kvm/lapic.c | 62 +++++++++++++++++++++++++++++---------------------
arch/x86/kvm/lapic.h | 3 ++-
arch/x86/kvm/svm.c | 4 ++++
arch/x86/kvm/trace.h | 20 ----------------
arch/x86/kvm/vmx/vmx.c | 4 ++++
arch/x86/kvm/x86.c | 5 +---
7 files changed, 63 insertions(+), 51 deletions(-)
--
2.7.4
next reply other threads:[~2019-05-15 4:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 4:11 Wanpeng Li [this message]
2019-05-15 4:11 ` [PATCH v2 1/4] KVM: LAPIC: Extract adaptive tune timer advancement logic Wanpeng Li
2019-05-15 4:11 ` [PATCH v2 2/4] KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow Wanpeng Li
2019-05-15 4:11 ` [PATCH v2 3/4] KVM: LAPIC: Expose per-vCPU timer adavance information to userspace Wanpeng Li
2019-05-15 17:21 ` Sean Christopherson
2019-05-16 3:15 ` Wanpeng Li
2019-05-15 4:11 ` [PATCH v2 4/4] KVM: LAPIC: Optimize timer latency further Wanpeng Li
2019-05-15 17:42 ` Sean Christopherson
2019-05-16 3:14 ` Wanpeng Li
-- strict thread matches above, loose matches on Subject: below --
2019-05-15 4:11 [PATCH v2 0/4] " 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=1557893514-5815-1-git-send-email-wanpengli@tencent.com \
--to=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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®