From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Hajnoczi Subject: Re: [RFC]VM live snapshot proposal Date: Tue, 4 Mar 2014 09:54:56 +0100 Message-ID: <20140304085456.GD25676@stefanha-thinkpad.redhat.com> References: <615092B2FD0E7648B6E4B43E029BCFB84D578044@SZXEMA503-MBS.china.huawei.com> <20140303123234.GC21055@stefanha-thinkpad.redhat.com> <615092B2FD0E7648B6E4B43E029BCFB84D5794D0@SZXEMA503-MBS.china.huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , "kwolf@redhat.com" , "qemu-devel@nongnu.org" , Wenchao Xia , Pavel Hrdina , KVM devel mailing list , Zhanghailiang To: "Huangpeng (Peter)" Return-path: Received: from mail-ee0-f46.google.com ([74.125.83.46]:44020 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756363AbaCDIzA (ORCPT ); Tue, 4 Mar 2014 03:55:00 -0500 Received: by mail-ee0-f46.google.com with SMTP id t10so1810121eei.19 for ; Tue, 04 Mar 2014 00:54:58 -0800 (PST) Content-Disposition: inline In-Reply-To: <615092B2FD0E7648B6E4B43E029BCFB84D5794D0@SZXEMA503-MBS.china.huawei.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Mar 04, 2014 at 01:02:44AM +0000, Huangpeng (Peter) wrote: > > But back to the options: > > > > If the host has enough free memory to fork QEMU, a small helper process can > > be used to save the copy-on-write memory snapshot (thanks to fork(2) > > semantics). The hard part about the fork(2) approach is that QEMU isn't > > really designed to fork, so work is necessary to reach a quiescent state for the > > child process. > > > > If there is not enough memory to fork, then a synchronous approach to > > catching guest memory writes is needed. I'm not sure if a good mechanism > > for that exists but the simplest would be mprotect(2) and a signal handler > > (which will make the guest run very slowly). > > > > Stefan > > In real production environment, memory over-commit or use as much memory as > possible may be the normal case, so the fork semantics cannot meet the needs. Yes, I think you're right. The fork approach only works in the easy case where there is plenty of free host memory. > Is there any other proposals to implement vm-snapshot? See the discussion by Paolo and Andrea about post-copy migration, which adds kernel memory management features for tracking userspace page faults. Perhaps you can use that infrastructure to trap guest writes. Stefan