[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180719011546.GB28585@char.US.ORACLE.com>
Date: Wed, 18 Jul 2018 21:15:46 -0400
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: Waiman Long <longman@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Joe Mario <jmario@...hat.com>
Subject: Re: [PATCH] x86/kvm: Don't use pvqspinlock code if only 1 vCPU
On Tue, Jul 17, 2018 at 05:59:27PM -0400, Waiman Long wrote:
> On a VM with only 1 vCPU, the locking fast path will always be
> successful. In this case, there is no need to use the the PV qspinlock
> code which has higher overhead on the unlock side than the native
> qspinlock code.
Why not make this global? That is for both KVM and Xen and any
other virtualized guest that uses this?
>
> Signed-off-by: Waiman Long <longman@...hat.com>
> ---
> arch/x86/kernel/kvm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 5b2300b..575c9a5 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -748,6 +748,10 @@ void __init kvm_spinlock_init(void)
> if (kvm_para_has_hint(KVM_HINTS_REALTIME))
> return;
>
> + /* Don't use the pvqspinlock code if there is only 1 vCPU. */
> + if (num_possible_cpus() == 1)
> + return;
> +
> __pv_init_lock_hash();
> pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath;
> pv_lock_ops.queued_spin_unlock = PV_CALLEE_SAVE(__pv_queued_spin_unlock);
> --
> 1.8.3.1
>
Powered by blists - more mailing lists