Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1293743 > unrolled thread

[PATCH] virtio_ring: use smp_store_mb

Started by"Michael S. Tsirkin" <mst@redhat.com>
First post2015-12-17 11:40 +0100
Last post2015-12-17 20:30 +0100
Articles 2 on this page of 22 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 11:40 +0100
    Re: [PATCH] virtio_ring: use smp_store_mb Peter Zijlstra <peterz@infradead.org> - 2015-12-17 12:00 +0100
      Re: [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 14:20 +0100
        Re: [PATCH] virtio_ring: use smp_store_mb Peter Zijlstra <peterz@infradead.org> - 2015-12-17 15:00 +0100
          Re: [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 15:40 +0100
            Re: [PATCH] virtio_ring: use smp_store_mb Peter Zijlstra <peterz@infradead.org> - 2015-12-17 15:40 +0100
              Re: [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 15:50 +0100
              new barrier type for paravirt (was Re: [PATCH] virtio_ring: use  smp_store_mb) "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-20 10:30 +0100
                Re: [Xen-devel] new barrier type for paravirt (was Re: [PATCH]  virtio_ring: use smp_store_mb) Andrew Cooper <andrew.cooper3@citrix.com> - 2015-12-20 18:10 +0100
                  Re: [Xen-devel] new barrier type for paravirt (was Re: [PATCH]  virtio_ring: use smp_store_mb) Peter Zijlstra <peterz@infradead.org> - 2015-12-20 21:10 +0100
                    Re: [Xen-devel] new barrier type for paravirt (was Re: [PATCH]  virtio_ring: use smp_store_mb) "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-21 08:20 +0100
                      [PATCH RFC] smp_store_mb should use smp_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-21 08:30 +0100
                Re: [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring:  use smp_store_mb) David Vrabel <david.vrabel@citrix.com> - 2015-12-21 11:50 +0100
                  Re: [Xen-devel] new barrier type for paravirt (was Re: [PATCH]  virtio_ring: use smp_store_mb) "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-21 13:00 +0100
                  Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re:  [PATCH] virtio_ring: use smp_store_mb) Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-12-21 16:00 +0100
    Re: [PATCH] virtio_ring: use smp_store_mb Peter Zijlstra <peterz@infradead.org> - 2015-12-17 12:30 +0100
      Re: [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 14:30 +0100
        Re: [PATCH] virtio_ring: use smp_store_mb Peter Zijlstra <peterz@infradead.org> - 2015-12-17 15:10 +0100
          Re: [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 15:40 +0100
            Re: [PATCH] virtio_ring: use smp_store_mb Peter Zijlstra <peterz@infradead.org> - 2015-12-17 16:10 +0100
              Re: [PATCH] virtio_ring: use smp_store_mb Will Deacon <will.deacon@arm.com> - 2015-12-17 17:00 +0100
                Re: [PATCH] virtio_ring: use smp_store_mb "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-17 20:30 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1293998

FromWill Deacon <will.deacon@arm.com>
Date2015-12-17 17:00 +0100
Message-ID<qGJ8e-1nC-19@gated-at.bofh.it>
In reply to#1293962
On Thu, Dec 17, 2015 at 04:09:17PM +0100, Peter Zijlstra wrote:
> On Thu, Dec 17, 2015 at 04:34:57PM +0200, Michael S. Tsirkin wrote:
> > On Thu, Dec 17, 2015 at 03:02:12PM +0100, Peter Zijlstra wrote:
> 
> > > > 	commit 9e1a27ea42691429e31f158cce6fc61bc79bb2e9
> > > > 	Author: Alexander Duyck <alexander.h.duyck@redhat.com>
> > > > 	Date:   Mon Apr 13 21:03:49 2015 +0930
> > > > 
> > > > 	    virtio_ring: Update weak barriers to use dma_wmb/rmb
> > > 
> > > That commit doesn't make any sense. dma_*mb() explicitly does _NOT_
> > > cover the smp_*mb() part.
> > > 
> > > Again, look at the ARM definitions, the smp_*mb() primitives use the
> > > inner coherence stuff, while the dma_*mb() primitives use the outer
> > > coherent stuff.
> > 
> > Does outer coherent imply inner coherent?
> > 
> > > the *mb() primitives cover both.
> 
> I do not think so, but lets add Will, he dreams this stuff.

Right, and I don't sleep well these days.

Anyway, the outer-shareable domain (osh) is a superset of the
inner-shareable domain (ish). The inner-shareable domain contains the
CPUs and any peripherals that you and I would call "cache coherent". The
outer-shareable domain extends this to cover a strange set of "less cache
coherent" devices, which we would just call "not cache coherent" for the
purposes of Linux. Normal, non-cacheable memory (i.e. the memory type we
use for non-coherent DMA buffers) is outer-shareable.

Since the barrier macros don't know if the device is coherent or not, we
use the stronger semantics of outer-shareable.

I've not been following the thread, but I reckon we could add dma_mb()
(as dmb(osh) on arm), then use that to build dma_load_acquire and
dma_store_release accessors. On arm64, we could probably use the
acquire/release instructions directly, since they inherit the shareability
domain of the address (which has the nice property of being inner-shareable
for coherent devices).

The massive pain with adding new accessors is defining the semantics.
memory-barriers.txt is already lacking for the CPU side, and we're
struggling to express the kind of transitivity guarantees we provide
today, let alone with new primitives :(

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1294163

From"Michael S. Tsirkin" <mst@redhat.com>
Date2015-12-17 20:30 +0100
Message-ID<qGMps-3Er-7@gated-at.bofh.it>
In reply to#1293998
On Thu, Dec 17, 2015 at 03:52:24PM +0000, Will Deacon wrote:
> On Thu, Dec 17, 2015 at 04:09:17PM +0100, Peter Zijlstra wrote:
> > On Thu, Dec 17, 2015 at 04:34:57PM +0200, Michael S. Tsirkin wrote:
> > > On Thu, Dec 17, 2015 at 03:02:12PM +0100, Peter Zijlstra wrote:
> > 
> > > > > 	commit 9e1a27ea42691429e31f158cce6fc61bc79bb2e9
> > > > > 	Author: Alexander Duyck <alexander.h.duyck@redhat.com>
> > > > > 	Date:   Mon Apr 13 21:03:49 2015 +0930
> > > > > 
> > > > > 	    virtio_ring: Update weak barriers to use dma_wmb/rmb
> > > > 
> > > > That commit doesn't make any sense. dma_*mb() explicitly does _NOT_
> > > > cover the smp_*mb() part.
> > > > 
> > > > Again, look at the ARM definitions, the smp_*mb() primitives use the
> > > > inner coherence stuff, while the dma_*mb() primitives use the outer
> > > > coherent stuff.
> > > 
> > > Does outer coherent imply inner coherent?
> > > 
> > > > the *mb() primitives cover both.
> > 
> > I do not think so, but lets add Will, he dreams this stuff.
> 
> Right, and I don't sleep well these days.
> 
> Anyway, the outer-shareable domain (osh) is a superset of the
> inner-shareable domain (ish). The inner-shareable domain contains the
> CPUs and any peripherals that you and I would call "cache coherent". The
> outer-shareable domain extends this to cover a strange set of "less cache
> coherent" devices, which we would just call "not cache coherent" for the
> purposes of Linux. Normal, non-cacheable memory (i.e. the memory type we
> use for non-coherent DMA buffers) is outer-shareable.
> 
> Since the barrier macros don't know if the device is coherent or not, we
> use the stronger semantics of outer-shareable.
> 
> I've not been following the thread, but I reckon we could add dma_mb()
> (as dmb(osh) on arm), then use that to build dma_load_acquire and
> dma_store_release accessors. On arm64, we could probably use the
> acquire/release instructions directly, since they inherit the shareability
> domain of the address (which has the nice property of being inner-shareable
> for coherent devices).
> 
> The massive pain with adding new accessors is defining the semantics.
> memory-barriers.txt is already lacking for the CPU side, and we're
> struggling to express the kind of transitivity guarantees we provide
> today, let alone with new primitives :(
> 
> Will

Well virtio (might) have wanted dma_mb in the past.

But if are adding barrier stuff anyway, we really want
pv_ counterparts to smp_ that do the same on CONFIG_SMP
but don't change when CONFIG_SMP is disabled.

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web