From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GJp8B-0008EC-Px for qemu-devel@nongnu.org; Sun, 03 Sep 2006 06:23:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GJp88-0008DX-9b for qemu-devel@nongnu.org; Sun, 03 Sep 2006 06:23:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GJp88-0008DU-61 for qemu-devel@nongnu.org; Sun, 03 Sep 2006 06:23:08 -0400 Received: from [65.74.133.4] (helo=mail.codesourcery.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GJpIP-0002oK-35 for qemu-devel@nongnu.org; Sun, 03 Sep 2006 06:33:45 -0400 From: Paul Brook Subject: Re: [Qemu-devel] AIO and savevm Date: Sun, 3 Sep 2006 11:23:00 +0100 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200609031123.01431.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Sunday 03 September 2006 09:51, Blue Swirl wrote: > >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 add bdrv_flush just before qemu_fopen_bdrv in do_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.