Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-05 Thread Paolo Bonzini
On 05/04/2016 13:15, Fam Zheng wrote: > > Anyway, let's consider bdrv_drain() legacy code that can call if > > (qemu_in_coroutine()) but please make bdrv_co_drain() public so > > block/mirror.c can at least call it directly. > OK, will do. Please create a bdrv_co_drained_begin() function too, ev

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-05 Thread Fam Zheng
On Tue, 04/05 10:39, Stefan Hajnoczi wrote: > > > block/mirror.c should call bdrv_co_drain() explicitly and bdrv_drain() > > > should assert(!qemu_in_coroutine()). > > > > > > The reason why existing bdrv_read() and friends detect coroutine context > > > at runtime is because it is meant for legac

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-05 Thread Stefan Hajnoczi
On Tue, Apr 05, 2016 at 09:27:39AM +0800, Fam Zheng wrote: > On Mon, 04/04 12:57, Stefan Hajnoczi wrote: > > On Fri, Apr 01, 2016 at 09:57:38PM +0800, Fam Zheng wrote: > > > +BdrvCoDrainData data; > > > + > > > +assert(qemu_in_coroutine()); > > > +data = (BdrvCoDrainData) { > > > +

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-04 Thread Fam Zheng
On Mon, 04/04 12:57, Stefan Hajnoczi wrote: > On Fri, Apr 01, 2016 at 09:57:38PM +0800, Fam Zheng wrote: > > Using the nested aio_poll() in coroutine is a bad idea. This patch > > replaces the aio_poll loop in bdrv_drain with a BH, if called in > > coroutine. > > > > For example, the bdrv_drain()

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-04 Thread Paolo Bonzini
On 04/04/2016 13:57, Stefan Hajnoczi wrote: > On Fri, Apr 01, 2016 at 09:57:38PM +0800, Fam Zheng wrote: >> Using the nested aio_poll() in coroutine is a bad idea. This patch >> replaces the aio_poll loop in bdrv_drain with a BH, if called in >> coroutine. >> >> For example, the bdrv_drain() in m

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-04 Thread Stefan Hajnoczi
On Fri, Apr 01, 2016 at 09:57:38PM +0800, Fam Zheng wrote: > Using the nested aio_poll() in coroutine is a bad idea. This patch > replaces the aio_poll loop in bdrv_drain with a BH, if called in > coroutine. > > For example, the bdrv_drain() in mirror.c can hang when a guest issued > request is pe

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-01 Thread Laurent Vivier
On 01/04/2016 15:57, Fam Zheng wrote: > Using the nested aio_poll() in coroutine is a bad idea. This patch > replaces the aio_poll loop in bdrv_drain with a BH, if called in > coroutine. > > For example, the bdrv_drain() in mirror.c can hang when a guest issued > request is pending on it in qemu

[Qemu-devel] [PATCH v2] block: Fix bdrv_drain in coroutine

2016-04-01 Thread Fam Zheng
Using the nested aio_poll() in coroutine is a bad idea. This patch replaces the aio_poll loop in bdrv_drain with a BH, if called in coroutine. For example, the bdrv_drain() in mirror.c can hang when a guest issued request is pending on it in qemu_co_mutex_lock(). Mirror coroutine in this case has