OSDN Git Service

dma: Avoid reentrancy in DMA transfer handlers
authorKevin Wolf <kwolf@redhat.com>
Fri, 28 Oct 2011 09:28:13 +0000 (05:28 -0400)
committerKevin Wolf <kwolf@redhat.com>
Fri, 4 Nov 2011 13:23:58 +0000 (14:23 +0100)
commitacae6f1c4c1dae1b7e059751347ca4225b01a391
tree971c2671b8fa18543ae97d9aeef1b3115271d728
parent67403dbba76fb294fb3a2317227f4b77037145cc
dma: Avoid reentrancy in DMA transfer handlers

With the conversion of the block layer to coroutines, bdrv_read/write
have changed to run a nested event loop that calls qemu_bh_poll.
Consequently a scheduled BH can be called while a DMA transfer handler
runs and this means that DMA_run becomes reentrant.

Devices haven't been designed to cope with that, so instead of running a
nested transfer handler just wait for the next invocation of the BH from the
main loop.

This fixes some problems with the floppy device.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/dma.c