patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v4 00/19] vhost: add postcopy live-migration support
@ 2018-10-08 15:25 Maxime Coquelin
  2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 01/19] vhost: fix messages error checks Maxime Coquelin
                   ` (18 more replies)
  0 siblings, 19 replies; 36+ messages in thread
From: Maxime Coquelin @ 2018-10-08 15:25 UTC (permalink / raw)
  To: dev, tiwei.bie, zhihong.wang, jfreimann, nicknickolaev,
	i.maximets, bruce.richardson, alejandro.lucero
  Cc: dgilbert, stable, Maxime Coquelin

In this v4:
- Fix VHOST_USER_MAX in patch 12 (Ilya)
- Don't close postcopy_fd in set_mem_table error path (Ilya)
- Close postcopy_fd in vhost_backend_cleanup() (Ilya)
- Re-init postcopy_listening in vhost_backend_cleanup() (Ilya)
- Close FDs in read_fd_message() error path (Ilya)
- Fix various typos in comments


With classic live-migration, the VM runs on source while its
content is being migrated to destination. When pages already
migrated to destination are dirtied by the source, they get
copied until both source and destination memory converge.
At that time, the source is stopped and destination is
started.

With postcopy live-migration, the VM is started on destination
before all the memory has been migrated. When the VM tries to
access a page that haven't been migrated yet, a pagefault is
triggered, handled by userfaultfd which pauses the thread.
A Qemu thread in charge of postcopy request the source for
the missing page. Once received and mapped, the paused thread
gets resumed.

Userfaultfd supports handling faults from a different process,
and Qemu supports postcopy with vhost-user backends since
v2.12.

One problem encountered with classic live-migration for VMs
relying on vhost-user backends is that when the traffic is
high (e.g. PVP), it happens that it never converges as
pages gets dirtied at a faster rate than they are copied
to the destination.
It is expected this problem sould be solved with using
postcopy, as rings memory and buffers will be copied once,
when destination will pagefault on them.

Note that it will certainly require a rebase to apply on top
of Nikolay's vhost-user message handling rework.

Steps to test postcopy:
1. Run DPDK's Testpmd application on source:
./install/bin/testpmd -m 512 --file-prefix=src -l 0,2 -n 4 \
  --vdev 'net_vhost0,iface=/tmp/vu-src' -- --portmask=1 -i \
  --rxq=1 --txq=1 --nb-cores=1 --eth-peer=0,52:54:00:11:22:12 \
  --no-mlockall

2. Run DPDK's Testpmd application on destination:
./install/bin/testpmd -m 512 --file-prefix=dst -l 0,2 -n 4 \
  --vdev 'net_vhost0,iface=/tmp/vu-dst,postcopy-support=1' -- --portmask=1 -i \
  --rxq=1 --txq=1 --nb-cores=1 --eth-peer=0,52:54:00:11:22:12 \
  --no-mlockall

3. Launch VM on source:
./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 3G -smp 2 -cpu host \
  -object memory-backend-file,id=mem,size=3G,mem-path=/dev/shm,share=on \
  -numa node,memdev=mem -mem-prealloc \
  -chardev socket,id=char0,path=/tmp/vu-src \
  -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \
  -device virtio-net-pci,netdev=mynet1 /home/virt/rhel7.6-1-clone.qcow2 \
  -net none -vnc :0 -monitor stdio

4. Launch VM on destination:
./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 3G -smp 2 -cpu host \
  -object memory-backend-file,id=mem,size=3G,mem-path=/dev/shm,share=on \
  -numa node,memdev=mem -mem-prealloc \
  -chardev socket,id=char0,path=/tmp/vu-dst \
  -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \
  -device virtio-net-pci,netdev=mynet1 /home/virt/rhel7.6-1-clone.qcow2 \
  -net none -vnc :1 -monitor stdio -incoming tcp::8888

5. In both testpmd prompts, start flooding the virtio-net device:
testpmd> set fwd txonly
testpmd> start

6. In destination's Qemu monitor, enable postcopy:
(qemu) migrate_set_capability postcopy-ram on

7. In source's Qemu monitor, enable postcopy and launch migration:
(qemu) migrate_set_capability postcopy-ram on
(qemu) migrate -d tcp:0:8888
(qemu) migrate_start_postcopy

Maxime Coquelin (19):
  vhost: fix messages error checks
  vhost: fix return code of messages requiring replies
  vhost: clarify reply-ack in case a reply was already sent
  vhost: fix payload size of reply
  vhost: fix error handling when mem table gets updated
  vhost: define postcopy protocol flag
  vhost: add number of fds to vhost-user messages and use it
  vhost: pass socket fd to message handling callbacks
  vhost: enable fds passing when sending vhost-user messages
  vhost: add config flag for postcopy feature
  vhost: introduce postcopy's advise message
  vhost: add support for postcopy's listen message
  vhost: register new regions with userfaultfd
  vhost: avoid useless VhostUserMemory copy
  vhost: send userfault range addresses back to qemu
  vhost: add support to postcopy's end request
  vhost: enable postcopy protocol feature
  vhost: add flag to enable postcopy live-migration
  net/vhost: add parameter to enable postcopy support

 config/common_linuxapp              |   1 +
 doc/guides/nics/vhost.rst           |   5 +
 doc/guides/prog_guide/vhost_lib.rst |   8 +
 drivers/net/vhost/rte_eth_vhost.c   |  13 ++
 lib/librte_vhost/meson.build        |   2 +
 lib/librte_vhost/rte_vhost.h        |   5 +
 lib/librte_vhost/socket.c           |  44 +++-
 lib/librte_vhost/vhost.h            |   3 +
 lib/librte_vhost/vhost_user.c       | 316 +++++++++++++++++++++++-----
 lib/librte_vhost/vhost_user.h       |  12 +-
 10 files changed, 342 insertions(+), 67 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2018-10-09 17:53 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 15:25 [dpdk-stable] [PATCH v4 00/19] vhost: add postcopy live-migration support Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 01/19] vhost: fix messages error checks Maxime Coquelin
2018-10-09  8:03   ` Tiwei Bie
2018-10-09 12:20     ` Maxime Coquelin
2018-10-09 12:54       ` Tiwei Bie
2018-10-09 17:53         ` Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 02/19] vhost: fix return code of messages requiring replies Maxime Coquelin
2018-10-09  8:05   ` Tiwei Bie
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 03/19] vhost: clarify reply-ack in case a reply was already sent Maxime Coquelin
2018-10-09  8:12   ` Tiwei Bie
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 04/19] vhost: fix payload size of reply Maxime Coquelin
2018-10-09 10:21   ` Tiwei Bie
2018-10-09 10:30     ` Maxime Coquelin
2018-10-09 10:34       ` [dpdk-stable] [dpdk-dev] " Maxime Coquelin
2018-10-09 11:02         ` Tiwei Bie
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 05/19] vhost: fix error handling when mem table gets updated Maxime Coquelin
2018-10-09 11:35   ` Tiwei Bie
2018-10-09 11:47     ` Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 06/19] vhost: define postcopy protocol flag Maxime Coquelin
2018-10-09 11:41   ` Tiwei Bie
2018-10-09 11:47     ` Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 07/19] vhost: add number of fds to vhost-user messages and use it Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 08/19] vhost: pass socket fd to message handling callbacks Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 09/19] vhost: enable fds passing when sending vhost-user messages Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 10/19] vhost: add config flag for postcopy feature Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 11/19] vhost: introduce postcopy's advise message Maxime Coquelin
2018-10-08 16:22   ` Ilya Maximets
2018-10-09  7:59     ` Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 12/19] vhost: add support for postcopy's listen message Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 13/19] vhost: register new regions with userfaultfd Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 14/19] vhost: avoid useless VhostUserMemory copy Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 15/19] vhost: send userfault range addresses back to qemu Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 16/19] vhost: add support to postcopy's end request Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 17/19] vhost: enable postcopy protocol feature Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 18/19] vhost: add flag to enable postcopy live-migration Maxime Coquelin
2018-10-08 15:25 ` [dpdk-stable] [PATCH v4 19/19] net/vhost: add parameter to enable postcopy support Maxime Coquelin

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).