From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: linmiaohe <linmiaohe@huawei.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com,
sean.j.christopherson@intel.com, wanpengli@tencent.com,
jmattson@google.com, joro@8bytes.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, hpa@zytor.com
Subject: Re: [PATCH] KVM: apic: reuse smp_wmb() in kvm_make_request()
Date: Thu, 06 Feb 2020 11:47:02 +0100 [thread overview]
Message-ID: <87d0asgfh5.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <1580954375-5030-1-git-send-email-linmiaohe@huawei.com>
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.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> arch/x86/kvm/lapic.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index eafc631d305c..ea871206a370 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1080,9 +1080,12 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
> result = 1;
> /* assumes that there are only KVM_APIC_INIT/SIPI */
> apic->pending_events = (1UL << KVM_APIC_INIT);
> - /* make sure pending_events is visible before sending
> - * the request */
> - smp_wmb();
> + /*
> + * 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
:-)
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> kvm_make_request(KVM_REQ_EVENT, vcpu);
> kvm_vcpu_kick(vcpu);
> }
--
Vitaly
next prev parent reply other threads:[~2020-02-06 10:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 1:59 [PATCH] KVM: apic: reuse smp_wmb() in kvm_make_request() linmiaohe
2020-02-06 10:47 ` Vitaly Kuznetsov [this message]
2020-02-06 15:05 ` Sean Christopherson
-- strict thread matches above, loose matches on Subject: below --
2020-02-07 2:59 linmiaohe
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=87d0asgfh5.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linmiaohe@huawei.com \
--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=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 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.