qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, kvm <kvm@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Chijianchun <chijianchun@huawei.com>, Avi Kivity <avi@redhat.com>,
	Alex Bligh <alex@alex.org.uk>,
	fred.konrad@greensocs.com, Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] Are there plans to achieve ram live Snapshot feature?
Date: Tue, 13 Aug 2013 10:53:23 +0800	[thread overview]
Message-ID: <52099FA3.6010207@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAJSP0QU3HYdN+FiQY-RtM1N1kkWfL0Y=KbrWj-qYk+TtS-6+Rw@mail.gmail.com>

于 2013-8-12 19:33, Stefan Hajnoczi 写道:
> On Mon, Aug 12, 2013 at 12:26 PM, Alex Bligh <alex@alex.org.uk> wrote:
>> --On 12 August 2013 11:59:03 +0200 Stefan Hajnoczi <stefanha@gmail.com>
>> wrote:
>>
>>> The idea that was discussed on qemu-devel@nongnu.org uses fork(2) to
>>> capture the state of guest RAM and then send it back to the parent
>>> process.  The guest is only paused for a brief instant during fork(2)
>>> and can continue to run afterwards.
>>
>>
>> How would you capture the state of emulated hardware which might not
>> be in the guest RAM?
>
> Exactly the same way vmsave works today.  It calls the device's save
> functions which serialize state to file.
>
> The difference between today's vmsave and the fork(2) approach is that
> QEMU does not need to wait for guest RAM to be written to file before
> resuming the guest.
>
> Stefan
>
   I have a worry about what glib says:

"On Unix, the GLib mainloop is incompatible with fork(). Any program
using the mainloop must either exec() or exit() from the child without
returning to the mainloop. "

   There is another way to do it: intercept the write in kvm.ko(or other
kernel code). Since the key is intercept the memory change, we can do
it in userspace in TCG mode, thus we can add the missing part in KVM
mode. Another benefit of this way is: the used memory can be
controlled. For example, with ioctl(), set a buffer of a fixed size
which keeps the intercepted write data by kernel code, which can avoid
frequently switch back to user space qemu code. when it is full always
return back to userspace's qemu code, let qemu code save the data into
disk. I haven't check the exactly behavior of Intel guest mode about
how to handle page fault, so can't estimate the performance caused by
switching of guest mode and root mode, but it should not be worse than
fork().


-- 
Best Regards

Wenchao Xia

  reply	other threads:[~2013-08-13  2:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 10:20 [Qemu-devel] Are there plans to achieve ram live Snapshot feature? Chijianchun
2013-08-09 15:38 ` Paolo Bonzini
2013-08-09 15:45 ` Anthony Liguori
2013-08-09 15:51   ` Eric Blake
2013-08-12  9:59 ` Stefan Hajnoczi
2013-08-12 10:26   ` Alex Bligh
2013-08-12 11:33     ` Stefan Hajnoczi
2013-08-13  2:53       ` Wenchao Xia [this message]
2013-08-13  8:21         ` Stefan Hajnoczi
2013-08-14  1:54           ` Wenchao Xia
2013-08-14  7:53             ` Stefan Hajnoczi
2013-08-14  8:13               ` Alex Bligh
2013-08-15  2:26               ` Wenchao Xia
2013-08-15  7:49                 ` Stefan Hajnoczi
2013-08-15  8:03                   ` Wenchao Xia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52099FA3.6010207@linux.vnet.ibm.com \
    --to=xiawenc@linux.vnet.ibm.com \
    --cc=alex@alex.org.uk \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=chijianchun@huawei.com \
    --cc=fred.konrad@greensocs.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).