From: Xiao Guangrong <guangrong.xiao@gmail.com>
To: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>, Xu Wang <gnawux@gmail.com>,
qemu-devel@nongnu.org,
"James O . D . Hunt" <james.o.hunt@intel.com>,
Peng Tao <bergwolf@gmail.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Sebastien Boeuf <sebastien.boeuf@intel.com>,
Xiao Guangrong <xiaoguangrong@tencent.com>,
Xiao Guangrong <xiaoguangrong.eric@gmail.com>
Subject: Re: [Qemu-devel] [PATCH V4] migration: add capability to bypass the shared memory
Date: Wed, 4 Apr 2018 20:15:23 +0800 [thread overview]
Message-ID: <941b5dc2-739b-08c1-4f3a-a3a2d2818734@gmail.com> (raw)
In-Reply-To: <20180404114709.45118-1-jiangshanlai@gmail.com>
On 04/04/2018 07:47 PM, Lai Jiangshan wrote:
> 1) What's this
>
> When the migration capability 'bypass-shared-memory'
> is set, the shared memory will be bypassed when migration.
>
> It is the key feature to enable several excellent features for
> the qemu, such as qemu-local-migration, qemu-live-update,
> extremely-fast-save-restore, vm-template, vm-fast-live-clone,
> yet-another-post-copy-migration, etc..
>
> The philosophy behind this key feature, including the resulting
> advanced key features, is that a part of the memory management
> is separated out from the qemu, and let the other toolkits
> such as libvirt, kata-containers (https://github.com/kata-containers)
> runv(https://github.com/hyperhq/runv/) or some multiple cooperative
> qemu commands directly access to it, manage it, provide features on it.
>
> 2) Status in real world
>
> The hyperhq(http://hyper.sh http://hypercontainer.io/)
> introduced the feature vm-template(vm-fast-live-clone)
> to the hyper container for several years, it works perfect.
> (see https://github.com/hyperhq/runv/pull/297).
>
> The feature vm-template makes the containers(VMs) can
> be started in 130ms and save 80M memory for every
> container(VM). So that the hyper containers are fast
> and high-density as normal containers.
>
> kata-containers project (https://github.com/kata-containers)
> which was launched by hyper, intel and friends and which descended
> from runv (and clear-container) should have this feature enabled.
> Unfortunately, due to the code confliction between runv&cc,
> this feature was temporary disabled and it is being brought
> back by hyper and intel team.
>
> 3) How to use and bring up advanced features.
>
> In current qemu command line, shared memory has
> to be configured via memory-object.
>
> a) feature: qemu-local-migration, qemu-live-update
> Set the mem-path on the tmpfs and set share=on for it when
> start the vm. example:
> -object \
> memory-backend-file,id=mem,size=128M,mem-path=/dev/shm/memory,share=on \
> -numa node,nodeid=0,cpus=0-7,memdev=mem
>
> when you want to migrate the vm locally (after fixed a security bug
> of the qemu-binary, or other reason), you can start a new qemu with
> the same command line and -incoming, then you can migrate the
> vm from the old qemu to the new qemu with the migration capability
> 'bypass-shared-memory' set. The migration will migrate the device-state
> *ONLY*, the memory is the origin memory backed by tmpfs file.
>
> b) feature: extremely-fast-save-restore
> the same above, but the mem-path is on the persistent file system.
>
> c) feature: vm-template, vm-fast-live-clone
> the template vm is started as 1), and paused when the guest reaches
> the template point(example: the guest app is ready), then the template
> vm is saved. (the qemu process of the template can be killed now, because
> we need only the memory and the device state files (in tmpfs)).
>
> Then we can launch one or multiple VMs base on the template vm states,
> the new VMs are started without the “share=on”, all the new VMs share
> the initial memory from the memory file, they save a lot of memory.
> all the new VMs start from the template point, the guest app can go to
> work quickly.
>
> The new VM booted from template vm can’t become template again,
> if you need this unusual chained-template feature, you can write
> a cloneable-tmpfs kernel module for it.
>
> The libvirt toolkit can’t manage vm-template currently, in the
> hyperhq/runv, we use qemu wrapper script to do it. I hope someone add
> “libvrit managed template” feature to libvirt.
>
> d) feature: yet-another-post-copy-migration
> It is a possible feature, no toolkit can do it well now.
> Using nbd server/client on the memory file is reluctantly Ok but
> inconvenient. A special feature for tmpfs might be needed to
> fully complete this feature.
> No one need yet another post copy migration method,
> but it is possible when some crazy man need it.
Excellent work. :)
It's a brilliant feature that can improve our production a lot.
Reviewed-by: Xiao Guangrong <xiaoguangrong@tencent.com>
next prev parent reply other threads:[~2018-04-04 12:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 8:45 [Qemu-devel] [PATCH] migration: add capability to bypass the shared memory Lai Jiangshan
2018-03-31 10:17 ` Lai Jiangshan
2018-03-31 12:35 ` Eric Blake
2018-04-01 8:48 ` [Qemu-devel] [PATCH V3] " Lai Jiangshan
2018-04-01 8:53 ` no-reply
2018-04-01 8:56 ` no-reply
2018-04-04 11:47 ` [Qemu-devel] [PATCH V4] " Lai Jiangshan
2018-04-04 12:15 ` Xiao Guangrong [this message]
2018-04-09 17:30 ` Dr. David Alan Gilbert
2018-04-12 2:34 ` Lai Jiangshan
2018-04-16 15:00 ` [Qemu-devel] [PATCH V5] " Lai Jiangshan
2018-04-19 16:38 ` Dr. David Alan Gilbert
2018-04-25 10:12 ` Lai Jiangshan
2018-04-26 19:05 ` Dr. David Alan Gilbert
2018-04-27 7:47 ` Cédric Le Goater
2018-06-28 0:42 ` Liang Li
2018-04-16 22:54 ` [Qemu-devel] [PATCH V4] " Lai Jiangshan
2018-04-19 15:54 ` Dr. David Alan Gilbert
2018-07-02 13:10 ` [Qemu-devel] [PATCH] " Stefan Hajnoczi
2018-07-02 13:52 ` Peng Tao
2018-07-02 22:15 ` Andrea Arcangeli
2018-07-03 4:09 ` Peng Tao
2018-07-03 10:05 ` Stefan Hajnoczi
2018-07-03 15:10 ` Peng Tao
2018-07-10 13:40 ` Stefan Hajnoczi
2018-07-12 15:02 ` Peng Tao
2018-07-18 16:03 ` Stefan Hajnoczi
2018-07-02 22:01 ` Andrea Arcangeli
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=941b5dc2-739b-08c1-4f3a-a3a2d2818734@gmail.com \
--to=guangrong.xiao@gmail.com \
--cc=armbru@redhat.com \
--cc=bergwolf@gmail.com \
--cc=dgilbert@redhat.com \
--cc=gnawux@gmail.com \
--cc=james.o.hunt@intel.com \
--cc=jiangshanlai@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=sameo@linux.intel.com \
--cc=sebastien.boeuf@intel.com \
--cc=xiaoguangrong.eric@gmail.com \
--cc=xiaoguangrong@tencent.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).