AIO and savevm
Hi,
I don't think savevm works reliably together with current AIO. At least some kind of AIO flushing or completion waiting should happen and then this should be done before any devices have started saving their state. Is this correct?
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/
Quoted 4 lines
I don't think savevm works reliably together with current AIO. At least some kind of AIO flushing or completion waiting should happen and then this should be done before any devices have started saving their state. Is this correct?
Correct.
Implementing it this way does mean savevm can effect the guest VM state (it causes all pending IO to complete immediately). However this should be safe, ie. it could occur be chance anyway, and qemu isn't deterministic to start with.
Trying to make async AIO restartable is IMHO not worth the effort at this point.
Paul
Quoted 4 lines
Implementing it this way does mean savevm can effect the guest VM state (it causes all pending IO to complete immediately). However this should be safe, ie. it could occur be chance anyway, and qemu isn't deterministic to start with.
What would be the right place for the AIO flush, how about bdrv_flush? Would it be OK to add bdrv_flush just before qemu_fopen_bdrv in do_savevm?
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Quoted 7 lines · Blue Swirl
Quoted 4 lines
Implementing it this way does mean savevm can effect the guest VM state (it causes all pending IO to complete immediately). However this should be safe, ie. it could occur by chance anyway, and qemu isn't deterministic to start with.
What would be the right place for the AIO flush, how about
bdrv_flush? Would it be OK to addbdrv_flushjust beforeqemu_fopen_bdrvindo_savevm?
No bdrv_flush if completely different, and has no observable effect[1].
When savevm is issued, you need to halt the guest CPUs, and wait for all IO to complete. While doing this you need to allow device AIO completion routines to run, which may trigger additional IO. Once all IO has been completed you should then be able to safely save state.
Paul
[1] ie. should be safe to call bdrv_flush at any time, and bdrv_flush is never necessary for correct operations. It's purpose is to help ensure data consistency if the host machine dies unexpectedly.