Skip to content
  • Paolo Bonzini's avatar
    dma-helpers: rewrite completion/cancellation · c3adb5b9
    Paolo Bonzini authored
    
    
    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: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    c3adb5b9