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 0/3] KVM: LAPIC: Optimize timer latency further
Date: Thu, 9 May 2019 19:29:18 +0800 [thread overview]
Message-ID: <1557401361-3828-1-git-send-email-wanpengli@tencent.com> (raw)
Advance lapic timer tries to hidden the hypervisor overhead between host
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, it measures the time between
the end of wait_lapic_expire and before world switch, we take this
time into consideration when busy waiting, otherwise, the guest still
awares the latency between wait_lapic_expire and world switch, we also
consider this when adaptively tuning the timer advancement. The patch
can reduce 50% latency (~1600+ cycles to ~800+ cycles on a haswell
desktop) for kvm-unit-tests/tscdeadline_latency when testing busy waits.
Wanpeng Li (3):
KVM: LAPIC: Extract adaptive tune timer advancement logic
KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow
KVM: LAPIC: Optimize timer latency further
arch/x86/kvm/lapic.c | 78 ++++++++++++++++++++++++++++++++++----------------
arch/x86/kvm/lapic.h | 8 ++++++
arch/x86/kvm/vmx/vmx.c | 2 ++
arch/x86/kvm/x86.c | 2 +-
4 files changed, 64 insertions(+), 26 deletions(-)
--
2.7.4
next reply other threads:[~2019-05-09 11:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 11:29 Wanpeng Li [this message]
2019-05-09 11:29 ` [PATCH 1/3] KVM: LAPIC: Extract adaptive tune timer advancement logic Wanpeng Li
2019-05-13 19:39 ` Sean Christopherson
2019-05-14 0:59 ` Wanpeng Li
2019-05-09 11:29 ` [PATCH 2/3] KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow Wanpeng Li
2019-05-13 19:14 ` Sean Christopherson
2019-05-09 11:29 ` [PATCH 3/3] KVM: LAPIC: Optimize timer latency further Wanpeng Li
2019-05-13 19:54 ` Sean Christopherson
2019-05-14 1:45 ` Wanpeng Li
2019-05-14 10:56 ` Wanpeng Li
2019-05-14 16:45 ` Sean Christopherson
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=1557401361-3828-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.