]> git.proxmox.com Git - mirror_qemu.git/commit - dma-helpers.c
dma-helpers: rewrite completion/cancellation
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 16 Sep 2011 14:40:02 +0000 (16:40 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 20 Sep 2011 10:27:43 +0000 (12:27 +0200)
commitc3adb5b9168a57790b5074489b6f0275ac3cc8b5
tree23c80fd5ded017fea0c0cde44673872498e80c83
parent10dc8aef419b4ce77670fb080ffe995bf9d7b0a1
dma-helpers: rewrite completion/cancellation

This fixes various problems with completion/cancellation:

* if the io_func fails to get an AIOCB, the callback wasn't called

* 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

* cancellation could leak the iovec

* the callback was missed if the I/O operation failed without returning
an AIOCB

and probably more that I've missed.  The patch fixes them by sharing
the cleanup code between completion and cancellation.  The dma_bdrv_cb
now returns a boolean completed/not completed flag, and the wrapper
dma_continue takes care of tasks to do upon completion.

Most of these are basically impossible in practice, but it is better
to be tidy...

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
dma-helpers.c