From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIgv3-0000jE-37 for qemu-devel@nongnu.org; Thu, 21 Mar 2013 10:56:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIgv1-0004vx-IG for qemu-devel@nongnu.org; Thu, 21 Mar 2013 10:56:41 -0400 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]:54518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIgv1-0004vg-Af for qemu-devel@nongnu.org; Thu, 21 Mar 2013 10:56:39 -0400 Received: by mail-we0-f175.google.com with SMTP id t11so278622wey.20 for ; Thu, 21 Mar 2013 07:56:38 -0700 (PDT) Date: Thu, 21 Mar 2013 15:56:30 +0100 From: Stefan Hajnoczi Message-ID: <20130321145630.GA16677@stefanha-thinkpad.redhat.com> References: <5142CCB6.7000004@linux.vnet.ibm.com> <51471686.3030505@redhat.com> <514AABFC.1030605@linux.vnet.ibm.com> <514AF393.8030109@redhat.com> <20130321133802.GA15276@stefanha-thinkpad.redhat.com> <514B0E3F.5070309@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <514B0E3F.5070309@redhat.com> Subject: Re: [Qemu-devel] [RFC] qmp interface for save vmstate to image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Pavel Hrdina , Juan Quintela , qemu-devel , Dietmar Maurer , Wenchao Xia On Thu, Mar 21, 2013 at 02:42:23PM +0100, Paolo Bonzini wrote: > Il 21/03/2013 14:38, Stefan Hajnoczi ha scritto: > > There already is a guest RAM cloning mechanism: fork the QEMU process. > > Then you have a copy-on-write guest RAM. > > > > In a little more detail: > > > > 1. save non-RAM device state > > 2. quiesce QEMU to a state that is safe for forking > > 3. create an EventNotifier for live savevm completion signal > > 4. fork and pass completion EventNotifier to child > > 5. parent continues running VM > > 6. child performs vmsave of copy-on-write guest RAM > > 7. child signals completion EventNotifier and terminates > > 8. parent raises live savevm completion QMP event > > Forking a threaded program is not so easy, but it could be done if the > child is very simple and only uses syscalls to communicate back with the > parent: On Linux you should be able to use clone(2) to spawn a thread with copy-on-write memory. Too bad it's not portable because it gets around the messy fork issues. Stefan