From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Waiman Long <longman@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, "Joe Mario" <jmario@redhat.com>
Subject: Re: [PATCH] x86/kvm: Don't use pvqspinlock code if only 1 vCPU
Date: Wed, 18 Jul 2018 21:15:46 -0400 [thread overview]
Message-ID: <20180719011546.GB28585@char.US.ORACLE.com> (raw)
In-Reply-To: <1531864767-30648-1-git-send-email-longman@redhat.com>
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@redhat.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
>
next prev parent reply other threads:[~2018-07-19 1:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-17 21:59 Waiman Long
2018-07-18 11:51 ` Paolo Bonzini
2018-07-19 1:15 ` Konrad Rzeszutek Wilk [this message]
2018-07-19 13:34 ` Waiman Long
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=20180719011546.GB28585@char.US.ORACLE.com \
--to=konrad.wilk@oracle.com \
--cc=hpa@zytor.com \
--cc=jmario@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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®