lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 7 Feb 2020 02:59:14 +0000
From:   linmiaohe <linmiaohe@...wei.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>
CC:     "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "rkrcmar@...hat.com" <rkrcmar@...hat.com>,
        "wanpengli@...cent.com" <wanpengli@...cent.com>,
        "jmattson@...gle.com" <jmattson@...gle.com>,
        "joro@...tes.org" <joro@...tes.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "bp@...en8.de" <bp@...en8.de>, "hpa@...or.com" <hpa@...or.com>
Subject: Re: [PATCH] KVM: apic: reuse smp_wmb() in kvm_make_request()

Sean Christopherson <sean.j.christopherson@...el.com> wrote:
> On Thu, Feb 06, 2020 at 11:47:02AM +0100, Vitaly Kuznetsov wrote:
>> linmiaohe <linmiaohe@...wei.com> writes:
>> 
>> > From: Miaohe Lin <linmiaohe@...wei.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ