Re: [PATCH v2 32/32] virtio_ring: use virt_store_mb
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx>
- Subject: Re: [PATCH v2 32/32] virtio_ring: use virt_store_mb
- From: "Michael S. Tsirkin" <mst@xxxxxxxxxx>
- Date: Sun, 3 Jan 2016 11:01:05 +0200
- Cc: linux-kernel@xxxxxxxxxxxxxxx, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, linux-arch@xxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, David Miller <davem@xxxxxxxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-metag@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxx, x86@xxxxxxxxxx, user-mode-linux-devel@xxxxxxxxxxxxxxxxxxxxx, adi-buildroot-devel@xxxxxxxxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- In-reply-to: <5686B622.6070600@cogentembedded.com>
- List-id: <linux-ia64.vger.kernel.org>
- References: <1451572003-2440-1-git-send-email-mst@redhat.com> <1451572003-2440-33-git-send-email-mst@redhat.com> <5686B622.6070600@cogentembedded.com>
On Fri, Jan 01, 2016 at 08:23:46PM +0300, Sergei Shtylyov wrote:
> Hello.
>
> On 12/31/2015 10:09 PM, Michael S. Tsirkin wrote:
>
> >We need a full barrier after writing out event index, using
> >virt_store_mb there seems better than open-coding. As usual, we need a
> >wrapper to account for strong barriers.
> >
> >It's tempting to use this in vhost as well, for that, we'll
> >need a variant of smp_store_mb that works on __user pointers.
> >
> >Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> >---
> > include/linux/virtio_ring.h | 12 ++++++++++++
> > drivers/virtio/virtio_ring.c | 15 +++++++++------
> > 2 files changed, 21 insertions(+), 6 deletions(-)
> >
> >diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
> >index f3fa55b..3a74d91 100644
> >--- a/include/linux/virtio_ring.h
> >+++ b/include/linux/virtio_ring.h
> >@@ -45,6 +45,18 @@ static inline void virtio_wmb(bool weak_barriers)
> > wmb();
> > }
> >
> >+static inline void virtio_store_mb(bool weak_barriers,
> >+ __virtio16 *p, __virtio16 v)
> >+{
> >+ if (weak_barriers)
> >+ virt_store_mb(*p, v);
> >+ else
> >+ {
>
> The kernel coding style dictates:
>
> if (weak_barriers) {
> virt_store_mb(*p, v);
> } else {
>
> >+ WRITE_ONCE(*p, v);
> >+ mb();
> >+ }
> >+}
> >+
> [...]
>
> MBR, Sergei
Will fix, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]