qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Hrdina <phrdina@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Dietmar Maurer <dietmar@proxmox.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [RFC] qmp interface for save vmstate to image
Date: Thu, 21 Mar 2013 14:43:01 +0100	[thread overview]
Message-ID: <514B0E65.8080904@redhat.com> (raw)
In-Reply-To: <20130321133802.GA15276@stefanha-thinkpad.redhat.com>

On 03/21/2013 02:38 PM, Stefan Hajnoczi wrote:
> On Thu, Mar 21, 2013 at 12:48:35PM +0100, Pavel Hrdina wrote:
>> On 03/21/2013 07:43 AM, Wenchao Xia wrote:
>>> Hi, Pavel
>>>     Sorry for late response.
>>
>> np :)
>>
>>>> Hi Wenchao,
>>>>
>>>> It seems the we are working on the same thing. You are trying to improve
>>>> the size of vmstate if you want to save it to file or as an internal
>>>> snapshot.
>>>>
>>>> I'm also working on that issue and I think that my solution could be
>>>> also used for savevm to external file or for live backup.
>>>>
>>>> Here is my proposal how to do it:
>>>>
>>>> We will not have the fixed size of vmstate, we will have the possible
>>>> minimal size of the vmstate. I will also use the migration code to save
>>>> the vmstate.
>>>>
>>>     It is good if speed and size can be improved, but IMHO the size will
>>> be a problem. Predictable or fixed size ensure management stack to
>>> give assess and decision, preserve resource ahead, personally I
>>> does not like a process continue to take resource without limit,
>>> in most case I'll turn it off.... By using qcow2m vmstate will have a
>>> fixed MAX size, ideal to be used to take it as a backup data.
>>>     Above is my personal opinion, and I do want to know the maintainer's
>>> opinion to decide whether to continue.
>>
>> I mean that the vmstate size would by at max the same as the guest ram
>> size, but could be smaller. I also dislike that actually the vmstate
>> could be much more larger then the guest ram size.
>>
>>>
>>>> In the qemu_savevm_state_begin we will create bitmap for all ram pages.
>>>> Then we set all pages in bitmap to "1" and it means we need to save them
>>>> all. Then we check all ram pages for duplicated pages and we will unset
>>>> all duplicated pages from "savevm_bitmap".
>>>>
>>>> In the qemu_savevm_state_iterate we will start saving remaining ram
>>>> pages according to "savevm_bitmap". Because the guest is running, it
>>>> could change the data in ram pages which is still not saved. For this
>>>> case we also have to create a priority queue. Into this priority queue
>>>> we will copy every ram page before it will be changed and also remove
>>>> this ram page from savevm_bitmap. In the iterate cycle we will at first
>>>> handle the priority queue and then continue to other ram pages from the
>>>> savevm_bitmap.
>>>>
>>>     OK, I got your idea: intercept the page writing before it changes.
>>> I think this could reduce time in savevm. But some problems need to be
>>> confirmed:
>>> 1 is it workable when KVM is used? In my understanding KVM will directly
>>> change the ram page before qemu can take over.
>>
>> Yes, this is true. I'm now investigating any way how to do this, but I'm
>> afraid that without support from kvm kernel module it cannot be done.
>>
>>> 2 the performance sacrifice of running guest, need a test.
>>
>> Surly I'll test it if there will be some solution how to copy the page
>> before it is changed when kvm is used.
>
> 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
And also for internal live savevm create pipe to past the vmstate data 
to the parent. It wouldn't be good idea touching qcow2 file from the child.
> 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
>
> Stefan
>

Yes, this is another way how to do it. I already consider this. Now I 
know that it could be the right way if someone else wrote this.

Thanks Stefan,

Pavel

      parent reply	other threads:[~2013-03-21 13:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15  7:24 [Qemu-devel] [RFC] qmp interface for save vmstate to image Wenchao Xia
2013-03-15 14:51 ` Stefan Hajnoczi
2013-03-18  6:40   ` Wenchao Xia
2013-03-18  9:04     ` Kevin Wolf
2013-03-18 10:08       ` Paolo Bonzini
2013-03-18 10:50         ` Wenchao Xia
2013-03-18 10:47       ` Wenchao Xia
2013-03-18 10:09     ` Stefan Hajnoczi
2013-03-18 13:28 ` Pavel Hrdina
2013-03-21  6:43   ` Wenchao Xia
2013-03-21 11:48     ` Pavel Hrdina
2013-03-21 13:38       ` Stefan Hajnoczi
2013-03-21 13:42         ` Paolo Bonzini
2013-03-21 13:53           ` Pavel Hrdina
2013-03-21 14:56           ` Stefan Hajnoczi
2013-03-21 15:08             ` Eric Blake
2013-03-23  4:36               ` Wenchao Xia
2013-03-27  3:35                 ` Wenchao Xia
2013-03-21 13:43         ` Pavel Hrdina [this message]

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=514B0E65.8080904@redhat.com \
    --to=phrdina@redhat.com \
    --cc=dietmar@proxmox.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@gmail.com \
    --cc=xiawenc@linux.vnet.ibm.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).