[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PAT
From: |
David Vrabel |
Subject: |
Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb) |
Date: |
Mon, 21 Dec 2015 10:47:49 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 |
On 20/12/15 09:25, Michael S. Tsirkin wrote:
>
> I noticed that drivers/xen/xenbus/xenbus_comms.c uses
> full memory barriers to communicate with the other side.
> For example:
>
> /* Must write data /after/ reading the consumer index. * */
> mb();
>
> memcpy(dst, data, avail);
> data += avail;
> len -= avail;
>
> /* Other side must not see new producer until data is *
> there. */
> wmb();
> intf->req_prod += avail;
>
> /* Implies mb(): other side will see the updated producer. */
> notify_remote_via_evtchn(xen_store_evtchn);
>
> To me, it looks like for guests compiled with CONFIG_SMP, smp_wmb and smp_mb
> would be sufficient, so mb() and wmb() here are only needed if
> a non-SMP guest runs on an SMP host.
>
> Is my analysis correct?
For x86, yes.
For arm/arm64 I think so, but would prefer one of the Xen arm
maintainers to confirm. In particular, whether inner-shareable barriers
are sufficient for memory shared with the hypervisor.
> So what I'm suggesting is something like the below patch,
> except instead of using virtio directly, a new set of barriers
> that behaves identically for SMP and non-SMP guests will be introduced.
>
> And of course the weak barriers flag is not needed for Xen -
> that's a virtio only thing.
>
> For example:
>
> smp_pv_wmb()
> smp_pv_rmb()
> smp_pv_mb()
The smp_ prefix doesn't make a lot of sense to me here since these
barriers are going to be the same whether the kernel is SMP or not.
David
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, (continued)
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Michael S. Tsirkin, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Peter Zijlstra, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Michael S. Tsirkin, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Peter Zijlstra, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Michael S. Tsirkin, 2015/12/17
- [Qemu-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb), Michael S. Tsirkin, 2015/12/20
- Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb), Andrew Cooper, 2015/12/20
- Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb), Peter Zijlstra, 2015/12/20
- Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb), Michael S. Tsirkin, 2015/12/21
- [Qemu-devel] [PATCH RFC] smp_store_mb should use smp_mb, Michael S. Tsirkin, 2015/12/21
- Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb),
David Vrabel <=
- Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb), Michael S. Tsirkin, 2015/12/21
- Re: [Qemu-devel] [Xen-devel] new barrier type for paravirt (was Re: [PATCH] virtio_ring: use smp_store_mb), Stefano Stabellini, 2015/12/21
Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Peter Zijlstra, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Michael S. Tsirkin, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Peter Zijlstra, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Michael S. Tsirkin, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Peter Zijlstra, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Will Deacon, 2015/12/17
- Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb, Michael S. Tsirkin, 2015/12/17