[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190610171110.GB8389@flask>
Date: Mon, 10 Jun 2019 19:11:10 +0200
From: Radim Krčmář <rkrcmar@...hat.com>
To: Wanpeng Li <kernellwp@...il.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v2 1/3] KVM: LAPIC: Make lapic timer unpinned when timer
is injected by posted-interrupt
2019-06-06 13:31+0800, Wanpeng Li:
> From: Wanpeng Li <wanpengli@...cent.com>
>
> Make lapic timer unpinned when timer is injected by posted-interrupt,
> the emulated timer can be offload to the housekeeping cpus.
>
> The host admin should fine tuned, e.g. dedicated instances scenario
> w/ nohz_full cover the pCPUs which vCPUs resident, several pCPUs
> surplus for housekeeping, disable mwait/hlt/pause vmexits to occupy
> the pCPUs, fortunately preemption timer is disabled after mwait is
> exposed to guest which makes emulated timer offload can be possible.
>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Radim Krčmář <rkrcmar@...hat.com>
> Signed-off-by: Wanpeng Li <wanpengli@...cent.com>
> ---
> arch/x86/kvm/lapic.c | 20 ++++++++++++++++----
> arch/x86/kvm/x86.c | 5 +++++
> arch/x86/kvm/x86.h | 2 ++
> include/linux/sched/isolation.h | 2 ++
> kernel/sched/isolation.c | 6 ++++++
> 5 files changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index fcf42a3..09b7387 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -127,6 +127,12 @@ static inline u32 kvm_x2apic_id(struct kvm_lapic *apic)
> return apic->vcpu->vcpu_id;
> }
>
> +static inline bool posted_interrupt_inject_timer_enabled(struct kvm_vcpu *vcpu)
> +{
> + return pi_inject_timer && kvm_vcpu_apicv_active(vcpu) &&
> + kvm_mwait_in_guest(vcpu->kvm);
I'm torn about the mwait dependency. It covers a lot of the targeted
user base, but the relation is convoluted and not fitting perfectly.
What do you think about making posted_interrupt_inject_timer_enabled()
just
pi_inject_timer && kvm_vcpu_apicv_active(vcpu)
and disarming the vmx preemption timer when
posted_interrupt_inject_timer_enabled(), just like we do with mwait now?
Thanks.
Powered by blists - more mailing lists