Re: [Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext

2016-10-18 Thread Stefan Hajnoczi
On Mon, Oct 17, 2016 at 10:04:59AM +0200, Paolo Bonzini wrote: > > > On 16/10/2016 18:40, Stefan Hajnoczi wrote: > > > void bdrv_wakeup(BlockDriverState *bs) > > > { > > > +if (bs->wakeup) { > > > +aio_bh_schedule_oneshot(qemu_get_aio_context(), dummy_bh_cb, > > > NULL); > > > +

Re: [Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext

2016-10-17 Thread Paolo Bonzini
On 16/10/2016 18:40, Stefan Hajnoczi wrote: > > void bdrv_wakeup(BlockDriverState *bs) > > { > > +if (bs->wakeup) { > > +aio_bh_schedule_oneshot(qemu_get_aio_context(), dummy_bh_cb, NULL); > > +} > > } > > Why use a dummy BH instead of aio_notify()? Originally I used

Re: [Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext

2016-10-16 Thread Stefan Hajnoczi
On Thu, Oct 13, 2016 at 07:34:19PM +0200, Paolo Bonzini wrote: > aio_poll is not thread safe; for example bdrv_drain can hang if > the last in-flight I/O operation is completed in the I/O thread after > the main thread has checked bs->in_flight. > > The bug remains latent as long as all of it is

Re: [Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > diff --git a/include/block/block_int.h b/include/block/block_int.h > index 11f877b..0516f62 100644 > --- a/include/block/block_int.h > +++ b/include/block/block_int.h > @@ -470,6 +470,7 @@ struct BlockDriverState { > NotifierWithReturnList

[Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext

2016-10-13 Thread Paolo Bonzini
aio_poll is not thread safe; for example bdrv_drain can hang if the last in-flight I/O operation is completed in the I/O thread after the main thread has checked bs->in_flight. The bug remains latent as long as all of it is called within aio_context_acquire/aio_context_release, but this will