From: linmiaohe <linmiaohe@huawei.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
"wanpengli@tencent.com" <wanpengli@tencent.com>,
"jmattson@google.com" <jmattson@google.com>,
"joro@8bytes.org" <joro@8bytes.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>, "hpa@zytor.com" <hpa@zytor.com>
Subject: Re: [PATCH] KVM: apic: reuse smp_wmb() in kvm_make_request()
Date: Fri, 7 Feb 2020 02:59:14 +0000 [thread overview]
Message-ID: <0f8ae71f59cd4b80ac93b9e1aa3b2428@huawei.com> (raw)
Sean Christopherson <sean.j.christopherson@intel.com> wrote:
> On Thu, Feb 06, 2020 at 11:47:02AM +0100, Vitaly Kuznetsov wrote:
>> linmiaohe <linmiaohe@huawei.com> writes:
>>
>> > From: Miaohe Lin <linmiaohe@huawei.com>
>> >
>> > There is already an smp_mb() barrier in kvm_make_request(). We reuse
>> > it here.
>> > + /*
>> > + * Make sure pending_events is visible before sending
>> > + * the request.
>> > + * There is already an smp_wmb() in kvm_make_request(),
>> > + * we reuse that barrier here.
>> > + */
>>
>> Let me suggest an alternative wording,
>>
>> "kvm_make_request() provides smp_wmb() so pending_events changes are
>> guaranteed to be visible"
>>
>> But there is nothing wrong with yours, it's just longer than it could
>> be
>> :-)
Thanks for your alternative wording. It looks much better.
>I usually lean in favor of more comments, but in thise case I'd vote to drop the comment altogether. There are lots of places that rely on the
>smp_wmb() in kvm_make_request() without a comment, e.g. the cases for APIC_DM_STARTUP and APIC_DM_REMRD in this same switch, kvm_inject_nmi(), etc... One might wonder what makes INIT special.
>
>And on the flip side, APIC_DM_STARTUP is a good example of when a
>smp_wmb()/smp_rmb() is needed and commented correctly (though calling out the exactly location of the other half would be helpful).
Yeh, I think the comment should be dropped too. :)
Thanks to both for review! I would send v2.
next reply other threads:[~2020-02-07 2:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-07 2:59 linmiaohe [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-02-06 1:59 [PATCH] KVM: apic: reuse smp_wmb() in kvm_make_request() linmiaohe
2020-02-06 10:47 ` Vitaly Kuznetsov
2020-02-06 15:05 ` Sean Christopherson
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=0f8ae71f59cd4b80ac93b9e1aa3b2428@huawei.com \
--to=linmiaohe@huawei.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--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;
as well as URLs for NNTP newsgroup(s).