From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Wanpeng Li" <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [PATCH v5 0/4] KVM: LAPIC: Implement Exitless Timer
Date: Tue, 2 Jul 2019 19:23:30 -0300 [thread overview]
Message-ID: <20190702222330.GB26621@amt.cnet> (raw)
In-Reply-To: <1fbd236a-f7f9-e66a-e08c-bf2bac901d15@redhat.com>
On Tue, Jul 02, 2019 at 06:38:56PM +0200, Paolo Bonzini wrote:
> On 21/06/19 11:39, Wanpeng Li wrote:
> > Dedicated instances are currently disturbed by unnecessary jitter due
> > to the emulated lapic timers fire on the same pCPUs which vCPUs resident.
> > There is no hardware virtual timer on Intel for guest like ARM. Both
> > programming timer in guest and the emulated timer fires incur vmexits.
> > This patchset tries to avoid vmexit which is incurred by the emulated
> > timer fires in dedicated instance scenario.
> >
> > When nohz_full is enabled in dedicated instances scenario, the unpinned
> > timer will be moved to the nearest busy housekeepers after commit
> > 9642d18eee2cd (nohz: Affine unpinned timers to housekeepers) and commit
> > 444969223c8 ("sched/nohz: Fix affine unpinned timers mess"). However,
> > KVM always makes lapic timer pinned to the pCPU which vCPU residents, the
> > reason is explained by commit 61abdbe0 (kvm: x86: make lapic hrtimer
> > pinned). Actually, these emulated timers can be offload to the housekeeping
> > cpus since APICv is really common in recent years. The guest timer interrupt
> > is injected by posted-interrupt which is delivered by housekeeping cpu
> > once the emulated timer fires.
> >
> > The host admin should fine tuned, e.g. dedicated instances scenario w/
> > nohz_full cover the pCPUs which vCPUs resident, several pCPUs surplus
> > for busy housekeeping, disable mwait/hlt/pause vmexits to keep in non-root
> > mode, ~3% redis performance benefit can be observed on Skylake server.
>
> Marcelo,
>
> does this patch work for you or can you still see the oops?
Hi Paolo,
No more oopses with kvm/queue. Can you include:
Index: kvm/arch/x86/kvm/lapic.c
===================================================================
--- kvm.orig/arch/x86/kvm/lapic.c
+++ kvm/arch/x86/kvm/lapic.c
@@ -124,8 +124,7 @@ static inline u32 kvm_x2apic_id(struct k
bool posted_interrupt_inject_timer(struct kvm_vcpu *vcpu)
{
- return pi_inject_timer && kvm_vcpu_apicv_active(vcpu) &&
- kvm_hlt_in_guest(vcpu->kvm);
+ return pi_inject_timer && kvm_vcpu_apicv_active(vcpu);
}
EXPORT_SYMBOL_GPL(posted_interrupt_inject_timer);
However, for some reason (hrtimer subsystems responsability) with cyclictest -i 200
on the guest, the timer runs on the local CPU:
CPU 1/KVM-9454 [003] d..2 881.674196: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d..2 881.674200: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d.h. 881.674387: apic_timer_fn <-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 881.674393: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d..2 881.674395: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d..2 881.674399: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d.h. 881.674586: apic_timer_fn <-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 881.674593: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d..2 881.674595: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d..2 881.674599: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d.h. 881.674787: apic_timer_fn <-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 881.674793: get_nohz_timer_target: get_nohz_timer_target 3->0
CPU 1/KVM-9454 [003] d..2 881.674795: get_nohz_timer_target: get_nohz_timer_target 3->0
But on boot:
CPU 1/KVM-9454 [003] d..2 578.625394: get_nohz_timer_target: get_nohz_timer_target 3->0
<idle>-0 [000] d.h1 578.626390: apic_timer_fn <-__hrtimer_run_queues
<idle>-0 [000] d.h1 578.626394: apic_timer_fn<-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 578.626401: get_nohz_timer_target: get_nohz_timer_target 3->0
<idle>-0 [000] d.h1 578.628397: apic_timer_fn <-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 578.628407: get_nohz_timer_target: get_nohz_timer_target 3->0
<idle>-0 [000] d.h1 578.631403: apic_timer_fn <-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 578.631413: get_nohz_timer_target: get_nohz_timer_target 3->0
<idle>-0 [000] d.h1 578.635409: apic_timer_fn <-__hrtimer_run_queues
CPU 1/KVM-9454 [003] d..2 578.635419: get_nohz_timer_target: get_nohz_timer_target 3->0
<idle>-0 [000] d.h1 578.640415: apic_timer_fn <-__hrtimer_run_queues
Thanks.
next prev parent reply other threads:[~2019-07-03 0:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 9:39 Wanpeng Li
2019-06-21 9:39 ` [PATCH v5 1/4] KVM: LAPIC: Make lapic timer unpinned Wanpeng Li
2019-06-21 9:40 ` [PATCH v5 2/4] KVM: LAPIC: Inject timer interrupt via posted interrupt Wanpeng Li
2019-07-05 12:37 ` Paolo Bonzini
[not found] ` <HK2PR02MB4145E122DC5AC2445137A10F80F50@HK2PR02MB4145.apcprd02.prod.outlook.com>
2019-07-05 13:00 ` Paolo Bonzini
[not found] ` <HK2PR02MB4145BBA5B72DD70AC622FD0E80F50@HK2PR02MB4145.apcprd02.prod.outlook.com>
2019-07-05 13:42 ` Paolo Bonzini
2019-06-21 9:40 ` [PATCH v5 3/4] KVM: LAPIC: Ignore timer migration when lapic timer is injected by pi Wanpeng Li
2019-06-21 9:40 ` [PATCH v5 4/4] KVM: LAPIC: Don't inject already-expired timer via posted interrupt Wanpeng Li
2019-07-05 12:40 ` Paolo Bonzini
[not found] ` <HK2PR02MB4145B13227997511174DBFA480F50@HK2PR02MB4145.apcprd02.prod.outlook.com>
2019-07-05 13:26 ` Paolo Bonzini
2019-07-02 16:38 ` [PATCH v5 0/4] KVM: LAPIC: Implement Exitless Timer Paolo Bonzini
2019-07-02 22:23 ` Marcelo Tosatti [this message]
2019-07-03 0:47 ` Wanpeng Li
2019-07-03 1:01 ` 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=20190702222330.GB26621@amt.cnet \
--to=mtosatti@redhat.com \
--cc=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®