Skip to contentSkip to conversation

Misc patches for 2017-06-01

GIT PULL Paolo Bonzini 4 participants 14 messages Jun 7, 2017 – Jun 8, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit 65dfad62a176f5265f801683be64149c5ad55f7d:

Merge remote-tracking branch 'remotes/xtensa/tags/20170606-xtensa' into staging (2017-06-06 17:00:12 +0100)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to a316ae656514501478594ee6043b098c045046fc:

docs: create config/, devel/ and spin/ subdirectories (2017-06-07 17:25:31 +0200)

----------------------------------------------------------------
* virtio-scsi use-after-free fix (Fam)
* vhost-user-scsi support (Felipe)
* SMM fixes and improvements for TCG (myself, Mihail)
* irqchip and AddressSpaceDispatch cleanups and fixes (Peter)
* Coverity fix (Stefano)
* NBD cleanups and fixes (Vladimir, Eric, myself)
* RTC accuracy improvements and code cleanups (Guangrong+Yunfang)
* socket error reporting improvement (Daniel)
* GDB XML description for SSE registers (Abdallah)
* kvmclock update fix (Denis)
* SMM memory savings (Gonglei)
* -cpu 486 fix (myself)
* various bugfixes (Roman, Peter, myself, Thomas)
* rtc-test improvement (Guangrong)
* migration throttling fix (Felipe)
* create docs/ subdirectories (myself)

----------------------------------------------------------------
Abdallah Bouassida (1):
target/i386: Add GDB XML description for SSE registers

Daniel P. Berrange (1):
sockets: improve error reporting if UNIX socket path is too long

Denis Plotnikov (1):
kvmclock: update system_time_msr address forcibly

Eric Blake (1):
nbd: Fully initialize client in case of failed negotiation

Fam Zheng (1):
virtio-scsi: Unset hotplug handler when unrealize

Felipe Franciosi (3):
vhost-user-scsi: Introduce vhost-user-scsi host device
vhost-user-scsi: Introduce a vhost-user-scsi sample application
cpus: reset throttle_thread_scheduled after sleep

Gonglei (1):
kvm: don't register smram_listener when smm is off

Mihail Abakumov (1):
i386: fix read/write cr with icount option

Paolo Bonzini (6):
target/i386: enable A20 automatically in system management mode target/i386: use multiple CPU AddressSpaces
linuxboot_dma: compile for i486
edu: fix memory leak on msi_broken platforms
nbd: make it thread-safe, fix qcow2 over nbd
docs: create config/, devel/ and spin/ subdirectories

Peter Xu (4):
kvm: irqchip: trace changes on msi add/remove
msix: trace control bit write op
kvm: irqchip: skip update msi when disabled
exec: simplify phys_page_find() params

Roman Pen (1):
i386/kvm: do not zero out segment flags if segment is unusable or not present

Stefano Stabellini (1):
Check the return value of fcntl in qemu_set_cloexec

Tai Yunfang (1):
mc146818rtc: precisely count the clock for periodic timer

Vladimir Sementsov-Ogievskiy (5):
nbd: strict nbd_wr_syncv
nbd: read_sync and friends: return 0 on success
nbd: add errp parameter to nbd_wr_syncv()
nbd: add errp to read_sync, write_sync and drop_sync nbd/client.c: use errp instead of LOG

Xiao Guangrong (5):
mc146818rtc: update periodic timer only if it is needed
mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386
mc146818rtc: drop unnecessary '#ifdef TARGET_I386'
mc146818rtc: embrace all x86 specific code
qtest: add rtc periodic timer test

 .gitignore                                 |   1 +
 Makefile                                   |   3 +
 Makefile.objs                              |   4 +
 block/nbd-client.c                         |  41 +-
 configure                                  |   4 +-
 contrib/libvhost-user/libvhost-user.h      |  11 +-
 contrib/vhost-user-scsi/Makefile.objs      |   1 +
 contrib/vhost-user-scsi/vhost-user-scsi.c  | 886 +++++++++++++++++++++++++++++
 cpus.c                                     |   2 +-
 default-configs/pci.mak                    |   1 +
 default-configs/s390x-softmmu.mak          |   1 +
 docs/{ => config}/ich9-ehci-uhci.cfg       |   0
 docs/{ => config}/mach-virt-graphical.cfg  |   0
 docs/{ => config}/mach-virt-serial.cfg     |   0
 docs/{ => config}/q35-emulated.cfg         |   0
 docs/{ => config}/q35-virtio-graphical.cfg |   0
 docs/{ => config}/q35-virtio-serial.cfg    |   0
 docs/{ => devel}/atomics.txt               |   0
 docs/{ => devel}/bitmaps.md                |   0
 docs/{ => devel}/blkdebug.txt              |   0
 docs/{ => devel}/blkverify.txt             |   0
 docs/{ => devel}/build-system.txt          |   0
 docs/{ => devel}/lockcnt.txt               |   0
 docs/{ => devel}/memory.txt                |   0
 docs/{ => devel}/migration.txt             |   0
 docs/{ => devel}/multi-thread-tcg.txt      |   0
 docs/{ => devel}/multiple-iothreads.txt    |   0
 docs/{ => devel}/qapi-code-gen.txt         |   0
 docs/{ => devel}/rcu.txt                   |   0
 docs/{ => devel}/tracing.txt               |   0
 docs/{ => devel}/virtio-migration.txt      |   0
 docs/{ => devel}/writing-qmp-commands.txt  |   0
 docs/{ => spin}/aio_notify.promela         |   0
 docs/{ => spin}/aio_notify_accept.promela  |   0
 docs/{ => spin}/aio_notify_bug.promela     |   0
 docs/{ => spin}/tcg-exclusive.promela      |   0
 docs/{ => spin}/win32-qemu-event.promela   |   0
 exec.c                                     |  13 +-
 gdb-xml/i386-32bit-sse.xml                 |  52 ++
 gdb-xml/i386-32bit.xml                     |  14 +
 gdb-xml/i386-64bit-sse.xml                 |  60 ++
 gdb-xml/i386-64bit.xml                     |  14 +
 hw/i386/kvm/clock.c                        |   3 +
 hw/misc/edu.c                              |  12 +-
 hw/pci/msix.c                              |  11 +-
 hw/pci/trace-events                        |   3 +
 hw/scsi/Makefile.objs                      |   1 +
 hw/scsi/vhost-scsi-common.c                |   1 -
 hw/scsi/vhost-user-scsi.c                  | 194 +++++++
 hw/scsi/virtio-scsi.c                      |   3 +
 hw/timer/mc146818rtc.c                     | 203 ++++---
 hw/virtio/virtio-pci.c                     |  58 ++
 hw/virtio/virtio-pci.h                     |  11 +
 include/block/nbd.h                        |   8 +-
 include/hw/timer/mc146818rtc_regs.h        |  20 +
 include/hw/virtio/vhost-user-scsi.h        |  35 ++
 include/hw/virtio/virtio-scsi.h            |   2 +
 kvm-all.c                                  |   8 +-
 nbd/client.c                               | 125 ++--
 nbd/common.c                               |  23 +-
 nbd/nbd-internal.h                         |  40 +-
 nbd/server.c                               | 100 ++--
 pc-bios/linuxboot_dma.bin                  | Bin 1536 -> 1536 bytes
 pc-bios/optionrom/Makefile                 |   1 +
 qemu-nbd.c                                 |   5 +-
 target/i386/arch_memory_mapping.c          |  18 +-
 target/i386/cpu.c                          |  23 +-
 target/i386/cpu.h                          |  20 +-
 target/i386/helper.c                       |  96 ++--
 target/i386/kvm.c                          |  36 +-
 target/i386/machine.c                      |   4 -
 target/i386/smm_helper.c                   |  18 -
 target/i386/translate.c                    |  12 +
 tests/qemu-iotests/083.out                 |   2 +
 tests/rtc-test.c                           |  49 ++
 trace-events                               |   3 +-
 util/oslib-posix.c                         |   4 +-
 util/qemu-sockets.c                        |  68 ++-
 78 files changed, 1936 insertions(+), 392 deletions(-)
 create mode 100644 contrib/vhost-user-scsi/Makefile.objs
 create mode 100644 contrib/vhost-user-scsi/vhost-user-scsi.c
 rename docs/{ => config}/ich9-ehci-uhci.cfg (100%)
 rename docs/{ => config}/mach-virt-graphical.cfg (100%)
 rename docs/{ => config}/mach-virt-serial.cfg (100%)
 rename docs/{ => config}/q35-emulated.cfg (100%)
 rename docs/{ => config}/q35-virtio-graphical.cfg (100%)
 rename docs/{ => config}/q35-virtio-serial.cfg (100%)
 rename docs/{ => devel}/atomics.txt (100%)
 rename docs/{ => devel}/bitmaps.md (100%)
 rename docs/{ => devel}/blkdebug.txt (100%)
 rename docs/{ => devel}/blkverify.txt (100%)
 rename docs/{ => devel}/build-system.txt (100%)
 rename docs/{ => devel}/lockcnt.txt (100%)
 rename docs/{ => devel}/memory.txt (100%)
 rename docs/{ => devel}/migration.txt (100%)
 rename docs/{ => devel}/multi-thread-tcg.txt (100%)
 rename docs/{ => devel}/multiple-iothreads.txt (100%)
 rename docs/{ => devel}/qapi-code-gen.txt (100%)
 rename docs/{ => devel}/rcu.txt (100%)
 rename docs/{ => devel}/tracing.txt (100%)
 rename docs/{ => devel}/virtio-migration.txt (100%)
 rename docs/{ => devel}/writing-qmp-commands.txt (100%)
 rename docs/{ => spin}/aio_notify.promela (100%)
 rename docs/{ => spin}/aio_notify_accept.promela (100%)
 rename docs/{ => spin}/aio_notify_bug.promela (100%)
 rename docs/{ => spin}/tcg-exclusive.promela (100%)
 rename docs/{ => spin}/win32-qemu-event.promela (100%)
 create mode 100644 gdb-xml/i386-32bit-sse.xml
 create mode 100644 gdb-xml/i386-32bit.xml
 create mode 100644 gdb-xml/i386-64bit-sse.xml
 create mode 100644 gdb-xml/i386-64bit.xml
 create mode 100644 hw/scsi/vhost-user-scsi.c
 create mode 100644 include/hw/virtio/vhost-user-scsi.h
Signature · 1 line
2.13.0
#1 lore raw

[Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
       -chardev socket,id=vus0,path=/tmp/vus.sock \
       -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Message-Id: <[email protected]>

[Disable migration for now, since it does not support bdrv_drain. - Paolo]
---
 .gitignore                          |   1 +
 default-configs/pci.mak             |   1 +
 default-configs/s390x-softmmu.mak   |   1 +
 hw/scsi/Makefile.objs               |   1 +
 hw/scsi/vhost-scsi-common.c         |   1 -
 hw/scsi/vhost-user-scsi.c           | 194 ++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-pci.c              |  58 +++++++++++
 hw/virtio/virtio-pci.h              |  11 ++
 include/hw/virtio/vhost-user-scsi.h |  35 +++++++
 include/hw/virtio/virtio-scsi.h     |   2 +
 10 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 hw/scsi/vhost-user-scsi.c
 create mode 100644 include/hw/virtio/vhost-user-scsi.h
.gitignore +1 -0
index 55a001e3b8..fa96bd29bb 100644
@@ -50,6 +50,7 @@
 /qemu-version.h.tmp
 /module_block.h
 /vscclient
+/vhost-user-scsi
 /fsdev/virtfs-proxy-helper
 *.[1-9]
 *.a
default-configs/pci.mak +1 -0
index 3bbeb62d9a..53ff10975c 100644
@@ -43,3 +43,4 @@ CONFIG_VGA=y
 CONFIG_VGA_PCI=y
 CONFIG_IVSHMEM=$(CONFIG_EVENTFD)
 CONFIG_ROCKER=y
+CONFIG_VHOST_USER_SCSI=$(CONFIG_LINUX)
default-configs/s390x-softmmu.mak +1 -0
index 18aed56fc0..b227a36179 100644
@@ -1,5 +1,6 @@
 CONFIG_PCI=y
 CONFIG_VIRTIO_PCI=y
+CONFIG_VHOST_USER_SCSI=$(CONFIG_LINUX)
 CONFIG_VIRTIO=y
 CONFIG_SCLPCONSOLE=y
 CONFIG_TERMINAL3270=y
hw/scsi/Makefile.objs +1 -0
index 54d8754e9a..b188f7242b 100644
@@ -11,4 +11,5 @@ obj-$(CONFIG_PSERIES) += spapr_vscsi.o
 ifeq ($(CONFIG_VIRTIO),y)
 obj-y += virtio-scsi.o virtio-scsi-dataplane.o
 obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-common.o vhost-scsi.o
+obj-$(CONFIG_VHOST_USER_SCSI) += vhost-scsi-common.o vhost-user-scsi.o
 endif
hw/scsi/vhost-scsi-common.c +0 -1
index e41c0314db..d434b3e99a 100644
@@ -16,7 +16,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <linux/vhost.h>
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "migration/migration.h"
hw/scsi/vhost-user-scsi.c new file +194 -0

194 lines not on this page · raw message

hw/virtio/virtio-pci.c +58 -0

70 lines not on this page · raw message

hw/virtio/virtio-pci.h +11 -0
index b095dfc6d9..69f5959623 100644
@@ -26,6 +26,7 @@
 #include "hw/virtio/virtio-input.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-crypto.h"
+#include "hw/virtio/vhost-user-scsi.h"
 
 #ifdef CONFIG_VIRTFS
 #include "hw/9pfs/virtio-9p.h"
@@ -44,6 +45,7 @@ typedef struct VirtIOBalloonPCI VirtIOBalloonPCI;
 typedef struct VirtIOSerialPCI VirtIOSerialPCI;
 typedef struct VirtIONetPCI VirtIONetPCI;
 typedef struct VHostSCSIPCI VHostSCSIPCI;
+typedef struct VHostUserSCSIPCI VHostUserSCSIPCI;
 typedef struct VirtIORngPCI VirtIORngPCI;
 typedef struct VirtIOInputPCI VirtIOInputPCI;
 typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI;
@@ -230,6 +232,15 @@ struct VHostSCSIPCI {
 };
 #endif
 
+#define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci"
+#define VHOST_USER_SCSI_PCI(obj) \
+        OBJECT_CHECK(VHostUserSCSIPCI, (obj), TYPE_VHOST_USER_SCSI_PCI)
+
+struct VHostUserSCSIPCI {
+    VirtIOPCIProxy parent_obj;
+    VHostUserSCSI vdev;
+};
+
 /*
  * virtio-blk-pci: This extends VirtioPCIProxy.
  */
include/hw/virtio/vhost-user-scsi.h new file +35 -0
new file mode 100644
index 0000000000..01861f78d0
@@ -0,0 +1,35 @@
+/*
+ * vhost-user-scsi host device
+ *
+ * Copyright (c) 2016 Nutanix Inc. All rights reserved.
+ *
+ * Author:
+ *  Felipe Franciosi <[email protected]>
+ *
+ * This file is largely based on "vhost-scsi.h" by:
+ *  Stefan Hajnoczi   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef VHOST_USER_SCSI_H
+#define VHOST_USER_SCSI_H
+
+#include "qemu-common.h"
+#include "hw/qdev.h"
+#include "hw/virtio/virtio-scsi.h"
+#include "hw/virtio/vhost.h"
+#include "hw/virtio/vhost-scsi-common.h"
+
+#define TYPE_VHOST_USER_SCSI "vhost-user-scsi"
+#define VHOST_USER_SCSI(obj) \
+        OBJECT_CHECK(VHostUserSCSI, (obj), TYPE_VHOST_USER_SCSI)
+
+typedef struct VHostUserSCSI {
+    VHostSCSICommon parent_obj;
+    uint64_t host_features;
+} VHostUserSCSI;
+
+#endif /* VHOST_USER_SCSI_H */
include/hw/virtio/virtio-scsi.h +2 -0
index eac2013ddd..de6ae5a9f6 100644
@@ -21,6 +21,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/pci/pci.h"
 #include "hw/scsi/scsi.h"
+#include "chardev/char-fe.h"
 #include "sysemu/iothread.h"
 
 #define TYPE_VIRTIO_SCSI_COMMON "virtio-scsi-common"
@@ -53,6 +54,7 @@ struct VirtIOSCSIConf {
     char *vhostfd;
     char *wwpn;
 #endif
+    CharBackend chardev;
     uint32_t boot_tpgt;
     IOThread *iothread;
 };
Signature · 1 line
2.13.0
#2 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 13 lines · Paolo Bonzini

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
       -chardev socket,id=vus0,path=/tmp/vus.sock \
       -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...
Quoted 6 lines

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Message-Id: <[email protected]> [Disable migration for now, since it does not support bdrv_drain. - Paolo]

I was expecting this to mean a VMStateDescription with a ".unmigratable = 1" field, but it doesn't seem to have one. Does it disable migration some other way?

thanks
-- PMM

#3 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 20 lines · Peter Maydell
Quoted 16 lines · Paolo Bonzini

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
      -chardev socket,id=vus0,path=/tmp/vus.sock \
      -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Quoted 7 lines
Quoted 3 lines

Message-Id: <[email protected]> [Disable migration for now, since it does not support bdrv_drain. - Paolo]

I was expecting this to mean a VMStateDescription with a ".unmigratable = 1" field, but it doesn't seem to have one. Does it disable migration some other way?

Hi Peter,

vhost-user-scsi supports migration.

Thanks,
Felipe

Quoted 3 lines

thanks
-- PMM

#4 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 24 lines · Felipe Franciosi
Quoted 24 lines · Peter Maydell
Quoted 19 lines · Paolo Bonzini

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
      -chardev socket,id=vus0,path=/tmp/vus.sock \
      -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Message-Id: <[email protected]> [Disable migration for now, since it does not support bdrv_drain. - Paolo]

Quoted 7 lines
Quoted 3 lines

I was expecting this to mean a VMStateDescription with a ".unmigratable = 1" field, but it doesn't seem to have one. Does it disable migration some other way?

Hi Peter,

vhost-user-scsi supports migration.

Paolo's change comment in the commit message quoted above says it does not, which is what I was remarking on.

(Your original patches use register_savevm(), which is a function that has just gone away. They'd need to use VMStateDescription structs instead to support migration.)

thanks
-- PMM

#5 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 34 lines · Peter Maydell
Quoted 30 lines · Felipe Franciosi
Quoted 20 lines · Peter Maydell
Quoted 16 lines · Paolo Bonzini

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
     -chardev socket,id=vus0,path=/tmp/vus.sock \
     -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Quoted 7 lines
Quoted 3 lines

Message-Id: <[email protected]> [Disable migration for now, since it does not support bdrv_drain. - Paolo]

I was expecting this to mean a VMStateDescription with a ".unmigratable = 1" field, but it doesn't seem to have one. Does it disable migration some other way?

Hi Peter,

Quoted 8 lines
Quoted 1 line

vhost-user-scsi supports migration.

Paolo's change comment in the commit message quoted above says it does not, which is what I was remarking on.

(Your original patches use register_savevm(), which is a function that has just gone away. They'd need to use VMStateDescription structs instead to support migration.)

Oh thanks for pointing that out, I missed it at the bottom of the commit message.

F.

Quoted 3 lines

thanks
-- PMM

#6 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

In reply to Felipe Franciosi
Quoted 24 lines · Felipe Franciosi
Quoted 24 lines · Peter Maydell
Quoted 19 lines · Paolo Bonzini

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
      -chardev socket,id=vus0,path=/tmp/vus.sock \
      -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Message-Id: <[email protected]> [Disable migration for now, since it does not support bdrv_drain. - Paolo]

Quoted 7 lines
Quoted 3 lines

I was expecting this to mean a VMStateDescription with a ".unmigratable = 1" field, but it doesn't seem to have one. Does it disable migration some other way?

Hi Peter,

vhost-user-scsi supports migration.

How, since there is no synchronization point between the vhost-user server on the source and the destination?

Can you please send a version of your patch that uses .unmigratable?

I'll send a v6 that momentarily drops vhost-scsi, but I intend to include it again in the next pull request.

Thanks,

Paolo

#7 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 34 lines · Paolo Bonzini
Quoted 28 lines · Felipe Franciosi
Quoted 27 lines · Peter Maydell
Quoted 13 lines · Paolo Bonzini

From: Felipe Franciosi <[email protected]>

This commit introduces a vhost-user device for SCSI. This is based on the existing vhost-scsi implementation, but done over vhost-user instead. It also uses a chardev to connect to the backend. Unlike vhost-scsi (today), VMs using vhost-user-scsi can be live migrated.

To use it, start Qemu with a command line equivalent to:

qemu-system-x86_64 \
     -chardev socket,id=vus0,path=/tmp/vus.sock \
     -device vhost-user-scsi-pci,chardev=vus0,bus=pci.0,addr=...
Quoted 6 lines

A separate commit presents a sample application linked with libiscsi to provide a backend for vhost-user-scsi.

Message-Id: <[email protected]> [Disable migration for now, since it does not support bdrv_drain. - Paolo]

I was expecting this to mean a VMStateDescription with a ".unmigratable = 1" field, but it doesn't seem to have one. Does it disable migration some other way?

Quoted 6 lines
Quoted 3 lines

Hi Peter,

vhost-user-scsi supports migration.

How, since there is no synchronization point between the vhost-user server on the source and the destination?

The idea is that the backend should both stop picking up new requests and also quiesce outstanding requests upon a GET_VRING_BASE vhost message.

Quoted 2 lines

Can you please send a version of your patch that uses .unmigratable?

Sure I can do that. We can work on the migration later on.

Quoted 3 lines

I'll send a v6 that momentarily drops vhost-scsi, but I intend to include it again in the next pull request.

Sounds good to me.

Felipe

Quoted 4 lines

Thanks,

Paolo

#8 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 5 lines
Quoted 2 lines

How, since there is no synchronization point between the vhost-user server on the source and the destination?

The idea is that the backend should both stop picking up new requests and also quiesce outstanding requests upon a GET_VRING_BASE vhost message.

This could be documented, but perhaps it's best to add a START_STOP feature and message to the vhost-user protocol?

The feature then can be optional for vhost-user-net and mandatory for vhost-user-scsi. When this is done we can remove .unmigratable.

Thanks,

Paolo

Quoted 19 lines
Quoted 2 lines

Can you please send a version of your patch that uses .unmigratable?

Sure I can do that. We can work on the migration later on.

Quoted 3 lines

I'll send a v6 that momentarily drops vhost-scsi, but I intend to include it again in the next pull request.

Sounds good to me.

Felipe

Quoted 4 lines

Thanks,

Paolo

#9 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 7 lines · Paolo Bonzini
Quoted 5 lines
Quoted 2 lines

How, since there is no synchronization point between the vhost-user server on the source and the destination?

The idea is that the backend should both stop picking up new requests and also quiesce outstanding requests upon a GET_VRING_BASE vhost message.

This could be documented,

It is documented AFAIK. Pls take a look at the spec documentation.

Quoted 2 lines

but perhaps it's best to add a START_STOP
feature and message to the vhost-user protocol?

We just never need to GET_VRING_BASE if ring keeps going - makes no sense since base gets invalidated immediately.

Quoted 6 lines

The feature then can be optional for vhost-user-net and mandatory for vhost-user-scsi. When this is done we can remove .unmigratable.

Thanks,

Paolo

If vhost-user-scsi does not stop the ring after responding to GET_VRING_BASE, it's just a bug that needs to be fixed.

Quoted 19 lines
Quoted 19 lines
Quoted 2 lines

Can you please send a version of your patch that uses .unmigratable?

Sure I can do that. We can work on the migration later on.

Quoted 3 lines

I'll send a v6 that momentarily drops vhost-scsi, but I intend to include it again in the next pull request.

Sounds good to me.

Felipe

Quoted 4 lines

Thanks,

Paolo

#10 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 4 lines
Quoted 2 lines

This could be documented,

It is documented AFAIK. Pls take a look at the spec documentation.

Found it now. It's not under GET_VRING_BASE, it's under "starting and stopping rings"---fair enough.

In the case of vhost-user-scsi, however, QEMU also must not proceed until vhost-user-scsi has drained the pending I/O---and this pending I/O would be completed _after_ QEMU has sent GET_VRING_BASE.

Is this handled by VHOST_USER_PROTOCOL_F_REPLY_ACK already? If so, migration would be denied if the server lacks that protocol feature.

Paolo

Quoted 38 lines
Quoted 2 lines

but perhaps it's best to add a START_STOP
feature and message to the vhost-user protocol?

We just never need to GET_VRING_BASE if ring keeps going - makes no sense since base gets invalidated immediately.

Quoted 6 lines

The feature then can be optional for vhost-user-net and mandatory for vhost-user-scsi. When this is done we can remove .unmigratable.

Thanks,

Paolo

If vhost-user-scsi does not stop the ring after responding to GET_VRING_BASE, it's just a bug that needs to be fixed.

Quoted 19 lines
Quoted 19 lines
Quoted 2 lines

Can you please send a version of your patch that uses .unmigratable?

Sure I can do that. We can work on the migration later on.

Quoted 3 lines

I'll send a v6 that momentarily drops vhost-scsi, but I intend to include it again in the next pull request.

Sounds good to me.

Felipe

Quoted 4 lines

Thanks,

Paolo

#11 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 11 lines · Paolo Bonzini
Quoted 4 lines
Quoted 2 lines

This could be documented,

It is documented AFAIK. Pls take a look at the spec documentation.

Found it now. It's not under GET_VRING_BASE, it's under "starting and stopping rings"---fair enough.

In the case of vhost-user-scsi, however, QEMU also must not proceed until vhost-user-scsi has drained the pending I/O---and this pending I/O would be completed _after_ QEMU has sent GET_VRING_BASE.

Weird. Doesn't QEMU wait for response to GET_VRING_BASE? I think it does since we migrate the returned value.

Spec says:
Client must only process each ring when it is started.
so this isn't expected. I guess whoever wrote vhost-user-scsi understood "process" as "start processing".
What was intended is reading or writing any part of ring. The used ring must not be updated after ring is stopped. A spec clarification might in order.

Quoted 4 lines

Is this handled by VHOST_USER_PROTOCOL_F_REPLY_ACK already? If so, migration would be denied if the server lacks that protocol feature.

Paolo

GET_VRING_BASE does not need an ack, after respoding ring should be stopped.

Quoted 38 lines
Quoted 38 lines
Quoted 2 lines

but perhaps it's best to add a START_STOP
feature and message to the vhost-user protocol?

We just never need to GET_VRING_BASE if ring keeps going - makes no sense since base gets invalidated immediately.

Quoted 6 lines

The feature then can be optional for vhost-user-net and mandatory for vhost-user-scsi. When this is done we can remove .unmigratable.

Thanks,

Paolo

If vhost-user-scsi does not stop the ring after responding to GET_VRING_BASE, it's just a bug that needs to be fixed.

Quoted 19 lines
Quoted 19 lines
Quoted 2 lines

Can you please send a version of your patch that uses .unmigratable?

Sure I can do that. We can work on the migration later on.

Quoted 3 lines

I'll send a v6 that momentarily drops vhost-scsi, but I intend to include it again in the next pull request.

Sounds good to me.

Felipe

Quoted 4 lines

Thanks,

Paolo

#12 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 12 lines · Michael S. Tsirkin
Quoted 8 lines · Paolo Bonzini
Quoted 4 lines
Quoted 2 lines

This could be documented,

It is documented AFAIK. Pls take a look at the spec documentation.

Found it now. It's not under GET_VRING_BASE, it's under "starting and stopping rings"---fair enough.

Quoted 6 lines
Quoted 3 lines

In the case of vhost-user-scsi, however, QEMU also must not proceed until vhost-user-scsi has drained the pending I/O---and this pending I/O would be completed _after_ QEMU has sent GET_VRING_BASE.

Weird. Doesn't QEMU wait for response to GET_VRING_BASE? I think it does since we migrate the returned value.

It does and that's what I said on my first message. On GET_VRING_BASE, a vhost-user-scsi backend application will stop picking up new requests and, _additionally_, quiesce the VQ (by waiting for any outstanding I/O to complete or cancelling them) before returning the last_avail_idx.

Such an application therefore doesn't _necessarily_ need a drain call. However, we could extend vhost-user to include a message for draining (which can be implemented as "wait for pending I/O to complete" or "cancel all outstanding" depending on the implementation).

Quoted 9 lines

Spec says:
Client must only process each ring when it is started.
so this isn't expected. I guess whoever wrote vhost-user-scsi understood "process" as "start processing".
What was intended is reading or writing any part of ring. The used ring must not be updated after ring is stopped. A spec clarification might in order.

Quoted 7 lines
Quoted 4 lines

Is this handled by VHOST_USER_PROTOCOL_F_REPLY_ACK already? If so, migration would be denied if the server lacks that protocol feature.

Paolo

GET_VRING_BASE does not need an ack, after respoding ring should be stopped.

Precisely. To clarify further: the REPLY_ACK feature was added as an extension only for messages that do not demand a reply. This is to cope with a vhost-user protocol deficiency where commands like SET_MEM_TABLE are asynchronous. Qemu sends them and carry on executing before the backend can ACK new regions were configured. The original vhost(-kernel) doesn't suffer that problem as messages are sent via an ioctl() which blocks until the backend is done.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

but perhaps it's best to add a START_STOP
feature and message to the vhost-user protocol?

We just never need to GET_VRING_BASE if ring keeps going - makes no sense since base gets invalidated immediately.

Quoted 3 lines

The feature then can be optional for vhost-user-net and mandatory for vhost-user-scsi. When this is done we can remove .unmigratable.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Thanks,

Paolo

If vhost-user-scsi does not stop the ring after responding to GET_VRING_BASE, it's just a bug that needs to be fixed.

Any backend application written for vhost-user-scsi needs to adhere to the spec and stop picking up new requests upon a GET_VRING_BASE. Depending on the storage backend, it can decide whether to also quiesce the VQ or potentially cancel any outstanding request.

Worth noting, this is very different in networking as packets can just be dropped.

Thanks,
Felipe

#13 lore raw

Re: [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce vhost-user-scsi host device

Quoted 8 lines · Felipe Franciosi
Quoted 2 lines

Weird. Doesn't QEMU wait for response to GET_VRING_BASE? I think it does since we migrate the returned value.

It does and that's what I said on my first message. On GET_VRING_BASE, a vhost-user-scsi backend application will stop picking up new requests and, _additionally_, quiesce the VQ (by waiting for any outstanding I/O to complete or cancelling them) before returning the last_avail_idx.

Yes, I understand now.

Quoted 5 lines

Such an application therefore doesn't _necessarily_ need a drain call. However, we could extend vhost-user to include a message for draining (which can be implemented as "wait for pending I/O to complete" or "cancel all outstanding" depending on the implementation).

Ok, and I see that vhost_dev_stop also calls get_vring_base so my worries are appeased. :)

Paolo