qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

vl: Drain before (block) job cancel when quitting

If the main loop cancels all block jobs while the block layer is not
drained, this cancelling may not happen instantaneously. We can start a
drained section before vm_shutdown(), which entails another
bdrv_drain_all(); this nested bdrv_drain_all() will thus be a no-op,
basically.

We do not have to end the drained section, because we actually do not
want any requests to happen from this point on.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

authored by

Max Reitz and committed by
Kevin Wolf
e6f0ac4d 86472071

+11
+11
vl.c
··· 4480 4480 */ 4481 4481 migration_shutdown(); 4482 4482 4483 + /* 4484 + * We must cancel all block jobs while the block layer is drained, 4485 + * or cancelling will be affected by throttling and thus may block 4486 + * for an extended period of time. 4487 + * vm_shutdown() will bdrv_drain_all(), so we may as well include 4488 + * it in the drained section. 4489 + * We do not need to end this section, because we do not want any 4490 + * requests happening from here on anyway. 4491 + */ 4492 + bdrv_drain_all_begin(); 4493 + 4483 4494 /* No more vcpu or device emulation activity beyond this point */ 4484 4495 vm_shutdown(); 4485 4496