All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [PATCH v4 0/5] KVM: LAPIC: Optimize timer latency further
Date: Mon, 20 May 2019 13:16:09 +0200	[thread overview]
Message-ID: <e6e28a3f-bda7-342c-dc28-5dc899b6fa02@redhat.com> (raw)
In-Reply-To: <1558340289-6857-1-git-send-email-wanpengli@tencent.com>

On 20/05/19 10:18, Wanpeng Li wrote:
> 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.
> 
> 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.
> 
> v3 -> v4:
>  * create timer_advance_ns debugfs entry iff lapic_in_kernel() 
>  * keep if (guest_tsc < tsc_deadline) before the call to __wait_lapic_expire()
> 
> v2 -> v3:
>  * expose 'kvm_timer.timer_advance_ns' to userspace
>  * move the tracepoint below guest_exit_irqoff()
>  * move wait_lapic_expire() before flushing the L1
> 
> 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 (5):
>   KVM: LAPIC: Extract adaptive tune timer advancement logic
>   KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow
>   KVM: LAPIC: Expose per-vCPU timer_advance_ns to userspace
>   KVM: LAPIC: Delay trace advance expire delta
>   KVM: LAPIC: Optimize timer latency further
> 
>  arch/x86/kvm/debugfs.c | 18 +++++++++++++++
>  arch/x86/kvm/lapic.c   | 60 +++++++++++++++++++++++++++++---------------------
>  arch/x86/kvm/lapic.h   |  3 ++-
>  arch/x86/kvm/svm.c     |  4 ++++
>  arch/x86/kvm/vmx/vmx.c |  4 ++++
>  arch/x86/kvm/x86.c     |  9 ++++----
>  6 files changed, 68 insertions(+), 30 deletions(-)
> 

Queued, thanks (2-3 for 5.2, the rest for 5.3).

Paolo

  parent reply	other threads:[~2019-05-20 11:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20  8:18 Wanpeng Li
2019-05-20  8:18 ` [PATCH v4 1/5] KVM: LAPIC: Extract adaptive tune timer advancement logic Wanpeng Li
2019-05-20  8:18 ` [PATCH v4 2/5] KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow Wanpeng Li
2019-05-20  8:18 ` [PATCH v4 3/5] KVM: LAPIC: Expose per-vCPU timer_advance_ns to userspace Wanpeng Li
2019-05-20  8:18 ` [PATCH v4 4/5] KVM: LAPIC: Delay trace advance expire delta Wanpeng Li
2019-05-20 11:14   ` Paolo Bonzini
2019-05-20 11:22     ` Wanpeng Li
2019-05-20 11:33       ` Paolo Bonzini
2019-05-20 11:36         ` Wanpeng Li
2019-05-20 11:41           ` Paolo Bonzini
2019-05-20 11:45             ` Wanpeng Li
2019-05-20  8:18 ` [PATCH v4 5/5] KVM: LAPIC: Optimize timer latency further Wanpeng Li
2019-05-20 11:16 ` Paolo Bonzini [this message]
2019-05-22  8:51 ` [PATCH v4 0/5] " 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=e6e28a3f-bda7-342c-dc28-5dc899b6fa02@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --subject='Re: [PATCH v4 0/5] KVM: LAPIC: Optimize timer latency further' \
    /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

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.