[Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Michael S. Tsirkin
In addition to handling IO in vcpu thread and in io thread, blk dataplane introduces yet another mode: handling it by aio. This reuses the same handler as previous modes, which triggers races as these were not designed to be reentrant. As a temporary fix, use a separate handler just for aio, and

Re: [Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Paolo Bonzini
On 29/03/2016 15:42, Michael S. Tsirkin wrote: > @@ -262,6 +274,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) > > /* Stop notifications for new requests from guest */ > virtio_queue_aio_set_host_notifier_handler(s->vq, s->ctx, false, false); I think that this should h

Re: [Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Michael S. Tsirkin
On Tue, Mar 29, 2016 at 03:56:18PM +0200, Paolo Bonzini wrote: > > > On 29/03/2016 15:42, Michael S. Tsirkin wrote: > > @@ -262,6 +274,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) > > > > /* Stop notifications for new requests from guest */ > > virtio_queue_aio_set_ho

Re: [Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Paolo Bonzini
On 29/03/2016 15:58, Michael S. Tsirkin wrote: > In that case, we'll have to also change scsi to use the new API. > A bit more work, to be sure. > Does scsi have the same problem as blk? Yes. The bug is in the virtio core. Paolo

Re: [Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Michael S. Tsirkin
On Tue, Mar 29, 2016 at 04:05:46PM +0200, Paolo Bonzini wrote: > > > On 29/03/2016 15:42, Michael S. Tsirkin wrote: > > +if (s->dataplane) { > > +/* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so > > start > > + * dataplane here instead of waiting for .set_statu

Re: [Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Paolo Bonzini
On 29/03/2016 15:42, Michael S. Tsirkin wrote: > +if (s->dataplane) { > +/* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start > + * dataplane here instead of waiting for .set_status(). > + */ > +if (!s->dataplane_started) { > +virti

Re: [Qemu-block] [PATCH 2/2] virtio-blk: use aio handler for data plane

2016-03-29 Thread Paolo Bonzini
On 29/03/2016 16:09, Michael S. Tsirkin wrote: >> > Another small comment, this can be written simply as >> > >> > if (s->dataplane) { >> > virtio_blk_data_plane_start(s->dataplane); > > True, it's best not to poke at dataplane_started. > > > } else { > > virtio_blk_han