Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Paolo Bonzini
Il 24/04/2012 18:08, Michael S. Tsirkin ha scritto: > On Tue, Apr 24, 2012 at 05:40:07PM +0200, Paolo Bonzini wrote: >> I would be grateful if, instead of fixing the qemu-barrier.h parts of >> the patches, you picked up the (sole) patch in the atomics branch of >> git://github.com/bonzi

Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Michael S. Tsirkin
On Tue, Apr 24, 2012 at 05:40:07PM +0200, Paolo Bonzini wrote: > I would be grateful if, instead of fixing the qemu-barrier.h parts of > the patches, you picked up the (sole) patch in the atomics branch of > git://github.com/bonzini/qemu.git. The constructs there are more > com

Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Paolo Bonzini
Il 24/04/2012 17:11, Michael S. Tsirkin ha scritto: > On Tue, Apr 24, 2012 at 05:01:07PM +0200, Paolo Bonzini wrote: >> Il 24/04/2012 16:38, Michael S. Tsirkin ha scritto: > I think it is prudent to address this theoretical race condition. I think your fix is right, but it is not need

Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Michael S. Tsirkin
On Tue, Apr 24, 2012 at 05:01:07PM +0200, Paolo Bonzini wrote: > Il 24/04/2012 16:38, Michael S. Tsirkin ha scritto: > >>> I think it is prudent to address this theoretical race condition. > >> > >> I think your fix is right, but it is not needed on x86. lfence is only > >> required for weakly-ord

Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Paolo Bonzini
Il 24/04/2012 16:38, Michael S. Tsirkin ha scritto: >>> I think it is prudent to address this theoretical race condition. >> >> I think your fix is right, but it is not needed on x86. lfence is only >> required for weakly-ordered memory types, so says Intel, > > I see this in spec: > > The LFENC

Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Michael S. Tsirkin
On Tue, Apr 24, 2012 at 03:48:27PM +0200, Paolo Bonzini wrote: > Il 23/04/2012 15:19, Michael S. Tsirkin ha scritto: > > virtio has the equivalent of: > > > > if (vq->last_avail_index != vring_avail_idx(vq)) { > > read descriptor head at vq->last_avail_index; > > } > > > > In

Re: [Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-24 Thread Paolo Bonzini
Il 23/04/2012 15:19, Michael S. Tsirkin ha scritto: > virtio has the equivalent of: > > if (vq->last_avail_index != vring_avail_idx(vq)) { > read descriptor head at vq->last_avail_index; > } > > In theory, processor can reorder descriptor head > read to happen speculativ

[Qemu-devel] [PATCHv2 3/3] virtio: order index/descriptor reads

2012-04-23 Thread Michael S. Tsirkin
virtio has the equivalent of: if (vq->last_avail_index != vring_avail_idx(vq)) { read descriptor head at vq->last_avail_index; } In theory, processor can reorder descriptor head read to happen speculatively before the index read. this would trigger the following ra