All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/18] RFCv2: vhost-user: shutdown and reconnection
@ 2016-04-01 11:16 marcandre.lureau
  2016-04-01 11:16 ` [Qemu-devel] [PATCH 01/18] tests: append i386 tests marcandre.lureau
                   ` (17 more replies)
  0 siblings, 18 replies; 42+ messages in thread
From: marcandre.lureau @ 2016-04-01 11:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yuanhan Liu, Michael S. Tsirkin, Ilya Maximets, jonshin,
	Tetsuya Mukawa, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi

This is a follow-up on previous RFC allowing the slave to request a
"managed" shutdown and reconnect later. A new optional communication
socket is added for the slave to make request to the master (since
vhost-user protocol isn't bidirectional)

The initial connection must be made before the guest is started for
the feature negotiation to complete. In "server" mode, qemu waits
before starting the VM. However, in "client" mode with "reconnect",
you have to specify "wait". This will wait for the initial connection
before starting the VM (in contrast with the "nowait"+backend features
proposed by Tetsuya [1]).

In order to do a clean shutdown, the slave should flush all pending
buffers so that after VHOST_SET_VRING_BASE, it is enough to
resume. The guest is made aware of virtio-net disconnection thanks to
VIRTIO_NET_S_LINK_UP status, which is reflected by a link-down on the
nic.

RFCv2:
- rebased, added a few preliminary patches
- fix a few mistakes in shutdown message recv/send
- enforce "wait" when using "reconnect"
- save & restore features & check backend compatibility
- save & restore the ring state
- add shutdown support to vhost-user-bridge

Testing:
- the vhost-user-test has a simple reconnect test.
- vhost-user-bridge can be used to run test interactively:

1) Run a slirp/vlan in a background process:
$ qemu -net none -net socket,vlan=0,udp=localhost:4444,localaddr=localhost:5555 -net user,vlan=0

2) Start vubr (it'll use the slirp/vlan process above by default):
$ tests/vhost-user-bridge

3) Start qemu with vhost-user / virtio-net:
$ qemu ... -chardev socket,id=char0,path=/tmp/vubr.sock,reconnect=1,wait -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce -device virtio-net-pci,netdev=mynet1

4) Play in the guest, interrupt (ctlr-c) vubr, check nic link status, restart vubr, etc..

[1] in a previous series "Add feature to start QEMU without
vhost-user backend", Tetsuya Mukawa proposed to allow the vhost-user
backend to disconnect and reconnect. However, Michael Tsirkin pointed
out that you can't do that without extra care, because the guest and
hypervisor don't know the slave ring manipulation state, there might
be pending replies for example that could be lost, and suggested to
reset the guest queues, but this requires kernel changes, and it may
have to clear the ring and lose queued packets. He also introduced a
new option to specify backend features on qemu command line to be able
to boot the VM without waiting for the backend. I consider this a
seperate enhancement.

Marc-André Lureau (16):
  tests: append i386 tests
  char: lower reconnect error to trace event
  char: use a trace for when the char is waiting
  char: add wait support for reconnect
  vhost-user: check reconnect comes with wait
  vhost: add vhost_dev stop callback
  vhost-user: add vhost_user to hold the chr
  vhost-user: add slave-fd support
  vhost-user: add shutdown support
  vhost-user: disconnect on start failure
  vhost-net: do not crash if backend is not present
  vhost-net: save & restore vhost-user acked features
  vhost-net: save & restore vring enable state
  test: vubr check vring enable state
  test: start vhost-user reconnect test
  test: add shutdown support vubr test

Tetsuya Mukawa (2):
  vhost-user: add ability to know vhost-user backend disconnection
  qemu-char: add qemu_chr_disconnect to close a fd accepted by listen fd

 docs/specs/vhost-user.txt |  38 ++++++++++
 hw/net/vhost_net.c        |  53 ++++++++++++-
 hw/virtio/vhost-user.c    | 104 +++++++++++++++++++++++++-
 include/hw/virtio/vhost.h |   4 +
 include/net/net.h         |   1 +
 include/net/vhost-user.h  |   1 +
 include/net/vhost_net.h   |   3 +
 include/sysemu/char.h     |   7 ++
 net/vhost-user.c          |  44 ++++++++++-
 qemu-char.c               |  46 +++++++++---
 tests/Makefile            |   4 +-
 tests/vhost-user-bridge.c | 112 ++++++++++++++++++++++++++--
 tests/vhost-user-test.c   | 184 ++++++++++++++++++++++++++++++++++++++++++----
 trace-events              |   4 +
 14 files changed, 564 insertions(+), 41 deletions(-)

-- 
2.5.5

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

end of thread, other threads:[~2016-05-05 13:42 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01 11:16 [Qemu-devel] [PATCH 00/18] RFCv2: vhost-user: shutdown and reconnection marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 01/18] tests: append i386 tests marcandre.lureau
2016-04-01 20:30   ` [Qemu-devel] [PATCH 01/18 for-2.6] " Eric Blake
2016-04-01 11:16 ` [Qemu-devel] [PATCH 02/18] char: lower reconnect error to trace event marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 03/18] char: use a trace for when the char is waiting marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 04/18] char: add wait support for reconnect marcandre.lureau
2016-04-28  4:33   ` Yuanhan Liu
2016-04-01 11:16 ` [Qemu-devel] [PATCH 05/18] vhost-user: check reconnect comes with wait marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 06/18] vhost-user: add ability to know vhost-user backend disconnection marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 07/18] vhost: add vhost_dev stop callback marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 08/18] vhost-user: add vhost_user to hold the chr marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 09/18] qemu-char: add qemu_chr_disconnect to close a fd accepted by listen fd marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 10/18] vhost-user: add slave-fd support marcandre.lureau
2016-04-01 20:33   ` Eric Blake
2016-04-01 11:16 ` [Qemu-devel] [PATCH 11/18] vhost-user: add shutdown support marcandre.lureau
2016-04-13  2:49   ` Yuanhan Liu
2016-04-13  9:51     ` Marc-André Lureau
2016-04-13 17:32       ` Yuanhan Liu
2016-04-13 21:43         ` Marc-André Lureau
2016-04-13 21:57           ` Yuanhan Liu
2016-04-28  5:23   ` Yuanhan Liu
2016-04-29 10:40     ` Marc-André Lureau
2016-04-29 17:48       ` Yuanhan Liu
2016-05-01 11:37         ` Michael S. Tsirkin
2016-05-01 21:04           ` Yuanhan Liu
2016-05-02 10:45             ` Michael S. Tsirkin
2016-05-02 11:29               ` Marc-André Lureau
2016-05-02 12:04                 ` Michael S. Tsirkin
2016-05-02 17:50                   ` Yuanhan Liu
2016-05-04 13:16                   ` Marc-André Lureau
2016-05-04 19:13                     ` Michael S. Tsirkin
2016-05-05  3:44                       ` Yuanhan Liu
2016-05-05 13:42                         ` Michael S. Tsirkin
2016-05-02 17:37               ` Yuanhan Liu
2016-04-01 11:16 ` [Qemu-devel] [PATCH 12/18] vhost-user: disconnect on start failure marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 13/18] vhost-net: do not crash if backend is not present marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 14/18] vhost-net: save & restore vhost-user acked features marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 15/18] vhost-net: save & restore vring enable state marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 16/18] test: vubr check " marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 17/18] test: start vhost-user reconnect test marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 18/18] test: add shutdown support vubr test marcandre.lureau
2016-04-13  2:52   ` Yuanhan Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.