Re: [Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-09 Thread Paolo Bonzini
On 09/09/2011 03:34 PM, Kevin Wolf wrote: So the release that we avoid is the release in the callback that may or may not be called indirectly by bdrv_aio_cancel. We always call dma_complete at the end of dma_aio_cancel so that it will be properly freed. In fact it may be worse than just the qe

Re: [Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-09 Thread Kevin Wolf
Am 09.09.2011 15:12, schrieb Paolo Bonzini: > On 09/09/2011 02:59 PM, Kevin Wolf wrote: Also, I think it should be -EIO instead of -ENOMEM (even though it doesn't make any difference if we don't call the callback) >>> >>> If I understood the code correctly, dbs->io_func can only fail if i

Re: [Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-09 Thread Paolo Bonzini
On 09/09/2011 02:59 PM, Kevin Wolf wrote: Also, I think it should be -EIO instead of -ENOMEM (even though it doesn't make any difference if we don't call the callback) If I understood the code correctly, dbs->io_func can only fail if it fails to get an AIOCB, which is basically out-of-memory.

Re: [Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-09 Thread Kevin Wolf
Am 09.09.2011 14:43, schrieb Paolo Bonzini: >>> @@ -120,9 +132,8 @@ static void dma_bdrv_cb(void *opaque, int ret) >>> dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov, >>> dbs->iov.size / 512, dma_bdrv_cb, dbs); >>> if (!dbs->acb) { >>> -dm

Re: [Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-09 Thread Paolo Bonzini
> > @@ -120,9 +132,8 @@ static void dma_bdrv_cb(void *opaque, int ret) > > dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov, > > dbs->iov.size / 512, dma_bdrv_cb, dbs); > > if (!dbs->acb) { > > -dma_bdrv_unmap(dbs); > > -qemu_iovec_d

Re: [Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-09 Thread Kevin Wolf
Am 07.09.2011 17:21, schrieb Paolo Bonzini: > This fixes various problems with completion/cancellation: > > * If DMA encounters a bounce buffer conflict, and the DMA operation is > canceled before the bottom half fires, bad things happen. > > * memory is not unmapped after cancellation, again cau

[Qemu-devel] [PATCH 3/5] dma-helpers: rewrite completion/cancellation

2011-09-07 Thread Paolo Bonzini
This fixes various problems with completion/cancellation: * If DMA encounters a bounce buffer conflict, and the DMA operation is canceled before the bottom half fires, bad things happen. * memory is not unmapped after cancellation, again causing problems when doing DMA to I/O areas * cancellatio