All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Zhenzhong Duan <zhenzhong.duan@oracle.com>, linux-kernel@vger.kernel.org
Cc: vkuznets@redhat.com, linux-hyperv@vger.kernel.org,
	kvm@vger.kernel.org, kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, sashal@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, pbonzini@redhat.com,
	rkrcmar@redhat.com, sean.j.christopherson@intel.com,
	wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org,
	jgross@suse.com, sstabellini@kernel.org, peterz@infradead.org,
	Jonathan Corbet <corbet@lwn.net>,
	"H. Peter Anvin" <hpa@zytor.com>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH v4 1/4] x86/kvm: Add "nopvspin" parameter to disable PV spinlocks
Date: Fri, 4 Oct 2019 10:52:45 -0400	[thread overview]
Message-ID: <26ef7beb-dad0-13c9-fc2f-217a5e046e4d@oracle.com> (raw)
In-Reply-To: <1570111335-12731-2-git-send-email-zhenzhong.duan@oracle.com>

On 10/3/19 10:02 AM, Zhenzhong Duan wrote:
>  void __init kvm_spinlock_init(void)
>  {
> -	/* Does host kernel support KVM_FEATURE_PV_UNHALT? */
> -	if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
> -		return;
> -
> -	if (kvm_para_has_hint(KVM_HINTS_REALTIME))
> +	/*
> +	 * Don't use the pvqspinlock code if no KVM_FEATURE_PV_UNHALT feature
> +	 * support, or there is REALTIME hints or only 1 vCPU.
> +	 */
> +	if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT) ||
> +	    kvm_para_has_hint(KVM_HINTS_REALTIME) ||
> +	    num_possible_cpus() == 1) {
> +		pr_info("PV spinlocks disabled\n");
>  		return;
> +	}
>  
> -	/* Don't use the pvqspinlock code if there is only 1 vCPU. */
> -	if (num_possible_cpus() == 1)
> +	if (nopvspin) {
> +		pr_info("PV spinlocks disabled forced by \"nopvspin\" parameter.\n");
> +		static_branch_disable(&virt_spin_lock_key);

Would it make sense to bring here the other site where the key is
disabled (in kvm_smp_prepare_cpus())?

(and, in fact, shouldn't all of the checks that result in early return
above disable the key?)

-boris

>  		return;
> +	}
> +	pr_info("PV spinlocks enabled\n");
>  
>  	__pv_init_lock_hash();
>  	pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath;
>


  reply	other threads:[~2019-10-04 14:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 14:02 [PATCH v4 0/4] Add a unified parameter "nopvspin" Zhenzhong Duan
2019-10-03 14:02 ` [PATCH v4 1/4] x86/kvm: Add "nopvspin" parameter to disable PV spinlocks Zhenzhong Duan
2019-10-04 14:52   ` Boris Ostrovsky [this message]
2019-10-06  7:49     ` Zhenzhong Duan
2019-10-07 14:46       ` Boris Ostrovsky
2019-10-08  2:17         ` Zhenzhong Duan
2019-10-03 14:02 ` [PATCH v4 2/4] x86/kvm: Change print code to use pr_*() format Zhenzhong Duan
2019-10-03 14:02 ` [PATCH v4 3/4] xen: Mark "xen_nopvspin" parameter obsolete Zhenzhong Duan
2019-10-04 14:57   ` Boris Ostrovsky
2019-10-06  7:52     ` Zhenzhong Duan
2019-10-03 14:02 ` [PATCH v4 4/4] x86/hyperv: Mark "hv_nopvspin" " Zhenzhong Duan
2019-10-05 17:07   ` Michael Kelley

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=26ef7beb-dad0-13c9-fc2f-217a5e046e4d@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rkrcmar@redhat.com \
    --cc=sashal@kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=sstabellini@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=will@kernel.org \
    --cc=zhenzhong.duan@oracle.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 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.