linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: Boris Ostrovsky <boris.ostrovsky@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: Tue, 8 Oct 2019 10:17:29 +0800	[thread overview]
Message-ID: <cf42de29-3460-b9ee-538f-2b1366db6ce3@oracle.com> (raw)
In-Reply-To: <ee3feb72-e587-9ac8-d5ba-e5c00b2a89c7@oracle.com>


On 2019/10/7 22:46, Boris Ostrovsky wrote:
> On 10/6/19 3:49 AM, Zhenzhong Duan wrote:
>> On 2019/10/4 22:52, Boris Ostrovsky wrote:
>>
>>> 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())?
>> Thanks for point out, I'll do it. Just not clear if I should do that
>> in a separate patch,
>> there is a history about that code:
>>
>> Its original place was here and then moved to kvm_smp_prepare_cpus()
>> by below commit:
>> 34226b6b ("KVM: X86: Fix setup the virt_spin_lock_key before static
>> key get initialized")
>> which fixed jump_label_init() calling late issue.
>>
>> Then 8990cac6 ("x86/jump_label: Initialize static branching early")
>> move jump_label_init()
>> early, so commit 34226b6b could be reverted.
> Which is similar to what you did earlier for Xen.

You remember that, ok, I'll do the same for KVM.

Thanks

Zhenzhong


  reply	other threads:[~2019-10-08  2:20 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
2019-10-06  7:49     ` Zhenzhong Duan
2019-10-07 14:46       ` Boris Ostrovsky
2019-10-08  2:17         ` Zhenzhong Duan [this message]
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=cf42de29-3460-b9ee-538f-2b1366db6ce3@oracle.com \
    --to=zhenzhong.duan@oracle.com \
    --cc=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 \
    /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;
as well as URLs for NNTP newsgroup(s).