* Re: [RFC-v3 0/5] vhost-scsi: Add support for host virtualized target
From: Michael S. Tsirkin @ 2012-09-07 6:13 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Stefan Hajnoczi, kvm-devel, Jan Kiszka, qemu-devel, Zhi Yong Wu,
Anthony Liguori, target-devel, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <1345582331-22593-1-git-send-email-nab@linux-iscsi.org>
On Tue, Aug 21, 2012 at 08:52:06PM +0000, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> Hi folks,
>
> This is the third RFC for vhost-scsi patches against mainline QEMU v1.1
> to support the upstream tcm_vhost host virtualized target driver now
> available in v3.6-rc kernel code. This series is based upon last week's
> commit 346fe0c4c0b, and is aiming for a future QEMU v1.3 merge.
>
> The patch series is available directly from:
>
> git://git.kernel.org/pub/scm/virt/kvm/nab/qemu-kvm.git vhost-scsi-merge-v3
>
> This -v3 series contains further review changes based upon feedback from
> MST, Paolo, and Blue. It also contains the changes to function against
> the changes in target-pending/master -> headed for v3.6-rc3 code.
ACK series. Paolo can you ack virtio-scsi changes please?
Nicholas, do you want me to take this through my tree?
> Changes from v3 -> v2:
>
> - Move qdev_prop_vhost_scsi + DEFINE_PROP_VHOST_SCSI defs into vhost-scsi.[c,h]
> (reported by MST)
> - Add enum vhost_scsi_vq_list for VHostSCSI->vqs[] enumeration (reported by MST)
> - Add missing braces around single like if statement to following QEMU
> style (reported by Blue Swirl)
> - Change vhost_scsi_target->vhost_wwpn to char *, in order to drop casts to
> pstrcpy in vhost_scsi_start() + vhost_scsi_stop() (reported by Blue Swirl)
> - Change VHOST_SCSI_GET_ABI_VERSION to 'int' type (MST)
> - Add vhost-scsi.h include for DEFINE_PROP_VHOST_SCSI (mst + nab)
> - Move vhost-scsi related struct members ahead of *cmd_vqs[0] within
> VirtIOSCSI definition. (paolo + nab)
> - Fix 4 byte alignment of vhost_scsi_target (MST)
> - Convert fprintf(stderr, ...) usage to -> error_report() (reported by MST)
> - Do explict memset of backend before calling VHOST_SCSI_CLEAR_ENDPOINT
> in vhost_scsi_stop() (reported by MST)
> - Add support for vhostfd passing in vhost_scsi_add() (reported by MST)
> - Move net_handle_fd_param() -> monitor_handle_fd_param() for generic
> usage by net/ + vhost-scsi (reported by MST)
> - Change vhost_scsi_add() to use monitor_handle_fd_param() (reported by MST)
>
> Changes from v1 -> v2:
>
> - Expose ABI version via VHOST_SCSI_GET_ABI_VERSION + use Rev 0 as
> starting point for v3.6-rc code (Stefan + ALiguori + nab)
> - Fix upstream qemu conflict in hw/qdev-properties.c
> - Make GET_ABI_VERSION use int (nab + mst)
> - Drop unnecessary event-notifier changes (nab)
> - Fix vhost-scsi case lables in configure (reported by paolo)
> - Convert qdev_prop_vhost_scsi to use ->get() + ->set() following
> qdev_prop_netdev (reported by paolo)
> - Fix typo in qemu-options.hx definition of vhost-scsi (reported by paolo)
> - Squash virtio-scsi: use the vhost-scsi host device from stefan (nab)
> - Fix up virtio_scsi_properties[] conflict w/ upstream qemu (nab)
> - Drop usage of to_virtio_scsi() in virtio_scsi_set_status()
> (reported by paolo)
> - Use modern VirtIOSCSIConf define in virtio-scsi.h (reported by paolo)
> - Use s->conf->vhost_scsi instead of proxyconf->vhost_scsi in
> virtio_scsi_init() (reported by paolo)
> - Only register QEMU SCSI bus is vhost-scsi is not active (reported by paolo)
> - Fix incorrect VirtIOSCSI->cmd_vqs[0] definition (nab)
>
> Thanks again to everyone who has been reviewing this series!
>
> --nab
>
> Nicholas Bellinger (2):
> monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
> virtio-scsi: Set max_target=0 during vhost-scsi operation
>
> Stefan Hajnoczi (3):
> vhost: Pass device path to vhost_dev_init()
> vhost-scsi: add -vhost-scsi host device for use with tcm-vhost
> virtio-scsi: Add start/stop functionality for vhost-scsi
>
> configure | 10 +++
> hw/Makefile.objs | 1 +
> hw/qdev-properties.c | 41 +++++++++++
> hw/vhost-scsi.c | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++
> hw/vhost-scsi.h | 62 ++++++++++++++++
> hw/vhost.c | 5 +-
> hw/vhost.h | 3 +-
> hw/vhost_net.c | 2 +-
> hw/virtio-pci.c | 2 +
> hw/virtio-scsi.c | 55 ++++++++++++++-
> hw/virtio-scsi.h | 1 +
> monitor.c | 18 +++++
> monitor.h | 1 +
> net.c | 18 -----
> net.h | 2 -
> net/socket.c | 2 +-
> net/tap.c | 4 +-
> qemu-common.h | 1 +
> qemu-config.c | 19 +++++
> qemu-options.hx | 4 +
> vl.c | 18 +++++
> 21 files changed, 431 insertions(+), 28 deletions(-)
> create mode 100644 hw/vhost-scsi.c
> create mode 100644 hw/vhost-scsi.h
>
> --
> 1.7.2.5
^ permalink raw reply
* Re: [RFC-v3 3/5] vhost-scsi: add -vhost-scsi host device for use with tcm-vhost
From: Michael S. Tsirkin @ 2012-09-07 6:20 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Anthony Liguori, Stefan Hajnoczi, kvm-devel, Jan Kiszka,
qemu-devel, Zhi Yong Wu, Anthony Liguori, target-devel,
Paolo Bonzini, lf-virt, Christoph Hellwig
In-Reply-To: <1345582331-22593-4-git-send-email-nab@linux-iscsi.org>
On Tue, Aug 21, 2012 at 08:52:09PM +0000, Nicholas A. Bellinger wrote:
> From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
>
> This patch adds a new type of host device that drives the vhost_scsi
> device. The syntax to add vhost-scsi is:
>
> qemu -vhost-scsi id=vhost-scsi0,wwpn=...,tpgt=123
>
> The virtio-scsi emulated device will make use of vhost-scsi to process
> virtio-scsi requests inside the kernel and hand them to the in-kernel
> SCSI target stack using the tcm_vhost fabric driver.
>
> The tcm_vhost driver was merged into the upstream linux kernel for 3.6-rc2,
> and the commit can be found here:
>
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=057cbf49a1f08297
>
In the future, please put changelog after --- or in the cover
letter: we do not need it in git history.
I fixed this up.
> Changelog v2 -> v3:
>
> - Move qdev_prop_vhost_scsi + DEFINE_PROP_VHOST_SCSI defs into vhost-scsi.[c,h]
> (reported by MST)
> - Add enum vhost_scsi_vq_list for VHostSCSI->vqs[] enumeration (reported by MST)
> - Add missing braces around single like if statement to following QEMU
> style (reported by Blue Swirl)
> - Change vhost_scsi_target->vhost_wwpn to char *, in order to drop casts to
> pstrcpy in vhost_scsi_start() + vhost_scsi_stop() (reported by Blue Swirl)
> - Change VHOST_SCSI_GET_ABI_VERSION to 'int' type (MST)
> - Fix 4 byte alignment of vhost_scsi_target (MST)
> - Convert fprintf(stderr, ...) usage to -> error_report() (reported by MST)
> - Do explict memset of backend before calling VHOST_SCSI_CLEAR_ENDPOINT
> in vhost_scsi_stop() (reported by MST)
> - Add support for vhostfd passing in vhost_scsi_add() (reported by MST)
> - Change vhost_scsi_add() to use monitor_handle_fd_param() (reported by MST)
>
> Changelog v1 -> v2:
>
> - Expose ABI version via VHOST_SCSI_GET_ABI_VERSION + use Rev 0 as
> starting point for v3.6-rc code (Stefan + ALiguori + nab)
> - Fix upstream qemu conflict in hw/qdev-properties.c
> - Make GET_ABI_VERSION use int (nab + mst)
> - Fix vhost-scsi case lables in configure (reported by paolo)
> - Convert qdev_prop_vhost_scsi to use ->get() + ->set() following
> qdev_prop_netdev (reported by paolo)
> - Fix typo in qemu-options.hx definition of vhost-scsi (reported by paolo)
>
> Changelog v0 -> v1:
>
> - Add VHOST_SCSI_SET_ENDPOINT call (stefan)
> - Enable vhost notifiers for multiple queues (Zhi)
> - clear vhost-scsi endpoint on stopped (Zhi)
> - Add CONFIG_VHOST_SCSI for QEMU build configure (nab)
> - Rename vhost_vring_target -> vhost_scsi_target (mst + nab)
> - Add support for VHOST_SCSI_GET_ABI_VERSION ioctl (aliguori + nab)
>
> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> Cc: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
> configure | 10 +++
> hw/Makefile.objs | 1 +
> hw/qdev-properties.c | 41 +++++++++++
> hw/vhost-scsi.c | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++
> hw/vhost-scsi.h | 62 ++++++++++++++++
> qemu-common.h | 1 +
> qemu-config.c | 19 +++++
> qemu-options.hx | 4 +
> vl.c | 18 +++++
> 9 files changed, 346 insertions(+), 0 deletions(-)
> create mode 100644 hw/vhost-scsi.c
> create mode 100644 hw/vhost-scsi.h
>
> diff --git a/configure b/configure
> index f0dbc03..1f03202 100755
> --- a/configure
> +++ b/configure
> @@ -168,6 +168,7 @@ libattr=""
> xfs=""
>
> vhost_net="no"
> +vhost_scsi="no"
> kvm="no"
> gprof="no"
> debug_tcg="no"
> @@ -513,6 +514,7 @@ Haiku)
> usb="linux"
> kvm="yes"
> vhost_net="yes"
> + vhost_scsi="yes"
> if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
> audio_possible_drivers="$audio_possible_drivers fmod"
> fi
> @@ -818,6 +820,10 @@ for opt do
> ;;
> --enable-vhost-net) vhost_net="yes"
> ;;
> + --disable-vhost-scsi) vhost_scsi="no"
> + ;;
> + --enable-vhost-scsi) vhost_scsi="yes"
> + ;;
> --disable-opengl) opengl="no"
> ;;
> --enable-opengl) opengl="yes"
> @@ -3116,6 +3122,7 @@ echo "posix_madvise $posix_madvise"
> echo "uuid support $uuid"
> echo "libcap-ng support $cap_ng"
> echo "vhost-net support $vhost_net"
> +echo "vhost-scsi support $vhost_scsi"
> echo "Trace backend $trace_backend"
> echo "Trace output file $trace_file-<pid>"
> echo "spice support $spice"
> @@ -3828,6 +3835,9 @@ case "$target_arch2" in
> if test "$vhost_net" = "yes" ; then
> echo "CONFIG_VHOST_NET=y" >> $config_target_mak
> fi
> + if test "$vhost_scsi" = "yes" ; then
> + echo "CONFIG_VHOST_SCSI=y" >> $config_target_mak
> + fi
> fi
> esac
> case "$target_arch2" in
> diff --git a/hw/Makefile.objs b/hw/Makefile.objs
> index 3ba5dd0..6ab75ec 100644
> --- a/hw/Makefile.objs
> +++ b/hw/Makefile.objs
> @@ -169,6 +169,7 @@ obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
> obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o virtio-scsi.o
> obj-$(CONFIG_SOFTMMU) += vhost_net.o
> obj-$(CONFIG_VHOST_NET) += vhost.o
> +obj-$(CONFIG_VHOST_SCSI) += vhost-scsi.o
> obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/
> obj-$(CONFIG_NO_PCI) += pci-stub.o
> obj-$(CONFIG_VGA) += vga.o
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 8aca0d4..8b505ca 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -4,6 +4,7 @@
> #include "blockdev.h"
> #include "hw/block-common.h"
> #include "net/hub.h"
> +#include "vhost-scsi.h"
>
> void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
> {
> @@ -696,6 +697,46 @@ PropertyInfo qdev_prop_vlan = {
> .set = set_vlan,
> };
>
> +/* --- vhost-scsi --- */
> +
> +static int parse_vhost_scsi_dev(DeviceState *dev, const char *str, void **ptr)
> +{
> + VHostSCSI *p;
> +
> + p = find_vhost_scsi(str);
> + if (p == NULL) {
> + return -ENOENT;
> + }
> +
> + *ptr = p;
> + return 0;
> +}
> +
> +static const char *print_vhost_scsi_dev(void *ptr)
> +{
> + VHostSCSI *p = ptr;
> +
> + return (p) ? vhost_scsi_get_id(p) : "<null>";
> +}
> +
> +static void get_vhost_scsi_dev(Object *obj, Visitor *v, void *opaque,
> + const char *name, Error **errp)
> +{
> + get_pointer(obj, v, opaque, print_vhost_scsi_dev, name, errp);
> +}
> +
> +static void set_vhost_scsi_dev(Object *obj, Visitor *v, void *opaque,
> + const char *name, Error **errp)
> +{
> + set_pointer(obj, v, opaque, parse_vhost_scsi_dev, name, errp);
> +}
> +
> +PropertyInfo qdev_prop_vhost_scsi = {
> + .name = "vhost-scsi",
> + .get = get_vhost_scsi_dev,
> + .set = set_vhost_scsi_dev,
> +};
> +
> /* --- pointer --- */
>
> /* Not a proper property, just for dirty hacks. TODO Remove it! */
> diff --git a/hw/vhost-scsi.c b/hw/vhost-scsi.c
> new file mode 100644
> index 0000000..96da2fc
> --- /dev/null
> +++ b/hw/vhost-scsi.c
> @@ -0,0 +1,190 @@
> +/*
> + * vhost_scsi host device
> + *
> + * Copyright IBM, Corp. 2011
> + *
> + * Authors:
> + * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> + *
> + * Changes for QEMU mainline + tcm_vhost kernel upstream:
> + * Nicholas Bellinger <nab@risingtidesystems.com>
> + *
> + * 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.
> + *
> + */
> +
> +#include <sys/ioctl.h>
> +#include "config.h"
> +#include "qemu-queue.h"
> +#include "monitor.h"
> +#include "vhost-scsi.h"
> +#include "vhost.h"
> +
> +struct VHostSCSI {
> + const char *id;
> + const char *wwpn;
> + uint16_t tpgt;
> + int vhostfd;
> + struct vhost_dev dev;
> + struct vhost_virtqueue vqs[VHOST_SCSI_VQ_NUM];
> + QLIST_ENTRY(VHostSCSI) list;
> +};
> +
> +static QLIST_HEAD(, VHostSCSI) vhost_scsi_list =
> + QLIST_HEAD_INITIALIZER(vhost_scsi_list);
> +
> +VHostSCSI *find_vhost_scsi(const char *id)
> +{
> + VHostSCSI *vs;
> +
> + QLIST_FOREACH(vs, &vhost_scsi_list, list) {
> + if (!strcmp(id, vs->id)) {
> + return vs;
> + }
> + }
> + return NULL;
> +}
> +
> +const char *vhost_scsi_get_id(VHostSCSI *vs)
> +{
> + return vs->id;
> +}
> +
> +int vhost_scsi_start(VHostSCSI *vs, VirtIODevice *vdev)
> +{
> + int ret, abi_version;
> + struct vhost_scsi_target backend;
> +
> + if (!vhost_dev_query(&vs->dev, vdev)) {
> + return -ENOTSUP;
> + }
> +
> + vs->dev.nvqs = VHOST_SCSI_VQ_NUM;
> + vs->dev.vqs = vs->vqs;
> +
> + ret = vhost_dev_enable_notifiers(&vs->dev, vdev);
> + if (ret < 0) {
> + return ret;
> + }
> +
> + ret = vhost_dev_start(&vs->dev, vdev);
> + if (ret < 0) {
> + return ret;
> + }
> +
> + ret = ioctl(vs->dev.control, VHOST_SCSI_GET_ABI_VERSION, &abi_version);
> + if (ret < 0) {
> + ret = -errno;
> + vhost_dev_stop(&vs->dev, vdev);
> + return ret;
> + }
> + if (abi_version > VHOST_SCSI_ABI_VERSION) {
> + error_report("vhost-scsi: The running tcm_vhost kernel abi_version:"
> + " %d is greater than vhost_scsi userspace supports: %d, please"
> + " upgrade your version of QEMU\n", abi_version,
> + VHOST_SCSI_ABI_VERSION);
> + ret = -ENOSYS;
> + vhost_dev_stop(&vs->dev, vdev);
> + return ret;
> + }
> + fprintf(stdout, "TCM_vHost ABI version: %d\n", abi_version);
> +
> + memset(&backend, 0, sizeof(backend));
> + pstrcpy(backend.vhost_wwpn, sizeof(backend.vhost_wwpn), vs->wwpn);
> + backend.vhost_tpgt = vs->tpgt;
> + ret = ioctl(vs->dev.control, VHOST_SCSI_SET_ENDPOINT, &backend);
> + if (ret < 0) {
> + ret = -errno;
> + vhost_dev_stop(&vs->dev, vdev);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +void vhost_scsi_stop(VHostSCSI *vs, VirtIODevice *vdev)
> +{
> + int ret;
> + struct vhost_scsi_target backend;
> +
> + memset(&backend, 0, sizeof(backend));
> + pstrcpy(backend.vhost_wwpn, sizeof(backend.vhost_wwpn), vs->wwpn);
> + backend.vhost_tpgt = vs->tpgt;
> + ret = ioctl(vs->dev.control, VHOST_SCSI_CLEAR_ENDPOINT, &backend);
> + if (ret < 0) {
> + error_report("vhost-scsi: Failed to clear endpoint\n");
> + }
> +
> + vhost_dev_stop(&vs->dev, vdev);
> +}
> +
> +static VHostSCSI *vhost_scsi_add(const char *id, const char *wwpn,
> + uint16_t tpgt, const char *vhostfd_str)
> +{
> + VHostSCSI *vs;
> + int ret;
> +
> + vs = g_malloc0(sizeof(*vs));
> + if (!vs) {
> + error_report("vhost-scsi: unable to allocate *vs\n");
> + return NULL;
> + }
> + vs->vhostfd = -1;
> +
> + if (vhostfd_str) {
> + vs->vhostfd = monitor_handle_fd_param(cur_mon, vhostfd_str);
> + if (vs->vhostfd == -1) {
> + error_report("vhost-scsi: unable to parse vs->vhostfd\n");
> + return NULL;
> + }
> + }
> + /* TODO set up vhost-scsi device and bind to tcm_vhost/$wwpm/tpgt_$tpgt */
> + ret = vhost_dev_init(&vs->dev, vs->vhostfd, "/dev/vhost-scsi", false);
> + if (ret < 0) {
> + error_report("vhost-scsi: vhost initialization failed: %s\n",
> + strerror(-ret));
> + return NULL;
> + }
> + vs->dev.backend_features = 0;
> + vs->dev.acked_features = 0;
> +
> + vs->id = g_strdup(id);
> + vs->wwpn = g_strdup(wwpn);
> + vs->tpgt = tpgt;
> + QLIST_INSERT_HEAD(&vhost_scsi_list, vs, list);
> +
> + return vs;
> +}
> +
> +VHostSCSI *vhost_scsi_add_opts(QemuOpts *opts)
> +{
> + const char *id;
> + const char *wwpn, *vhostfd;
> + uint64_t tpgt;
> +
> + id = qemu_opts_id(opts);
> + if (!id) {
> + error_report("vhost-scsi: no id specified\n");
> + return NULL;
> + }
> + if (find_vhost_scsi(id)) {
> + error_report("duplicate vhost-scsi: \"%s\"\n", id);
> + return NULL;
> + }
> +
> + wwpn = qemu_opt_get(opts, "wwpn");
> + if (!wwpn) {
> + error_report("vhost-scsi: \"%s\" missing wwpn\n", id);
> + return NULL;
> + }
> +
> + tpgt = qemu_opt_get_number(opts, "tpgt", UINT64_MAX);
> + if (tpgt > UINT16_MAX) {
> + error_report("vhost-scsi: \"%s\" needs a 16-bit tpgt\n", id);
> + return NULL;
> + }
> + vhostfd = qemu_opt_get(opts, "vhostfd");
> +
> + return vhost_scsi_add(id, wwpn, tpgt, vhostfd);
> +}
> diff --git a/hw/vhost-scsi.h b/hw/vhost-scsi.h
> new file mode 100644
> index 0000000..68de51a
> --- /dev/null
> +++ b/hw/vhost-scsi.h
> @@ -0,0 +1,62 @@
> +/*
> + * vhost_scsi host device
> + *
> + * Copyright IBM, Corp. 2011
> + *
> + * Authors:
> + * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> + *
> + * 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_SCSI_H
> +#define VHOST_SCSI_H
> +
> +#include "qemu-common.h"
> +#include "qemu-option.h"
> +#include "qdev.h"
> +
> +/*
> + * Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
> + *
> + * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
> + * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
> + */
> +
> +#define VHOST_SCSI_ABI_VERSION 0
> +
> +/* TODO #include <linux/vhost.h> properly */
> +/* For VHOST_SCSI_SET_ENDPOINT/VHOST_SCSI_CLEAR_ENDPOINT ioctl */
> +struct vhost_scsi_target {
> + int abi_version;
> + char vhost_wwpn[224];
> + unsigned short vhost_tpgt;
> + unsigned short reserved;
> +};
> +
> +enum vhost_scsi_vq_list {
> + VHOST_SCSI_VQ_CTL = 0,
> + VHOST_SCSI_VQ_EVT = 1,
> + VHOST_SCSI_VQ_IO = 2,
> + VHOST_SCSI_VQ_NUM = 3,
> +};
> +
> +#define VHOST_VIRTIO 0xAF
> +#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
> +#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
> +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
> +
> +extern PropertyInfo qdev_prop_vhost_scsi;
> +
> +#define DEFINE_PROP_VHOST_SCSI(_n, _s, _f) \
> + DEFINE_PROP(_n, _s, _f, qdev_prop_vhost_scsi, VHostSCSI*)
> +
> +VHostSCSI *find_vhost_scsi(const char *id);
> +const char *vhost_scsi_get_id(VHostSCSI *vs);
> +VHostSCSI *vhost_scsi_add_opts(QemuOpts *opts);
> +int vhost_scsi_start(VHostSCSI *vs, VirtIODevice *vdev);
> +void vhost_scsi_stop(VHostSCSI *vs, VirtIODevice *vdev);
> +
> +#endif
> diff --git a/qemu-common.h b/qemu-common.h
> index f9deca6..ec36002 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -280,6 +280,7 @@ typedef struct EventNotifier EventNotifier;
> typedef struct VirtIODevice VirtIODevice;
> typedef struct QEMUSGList QEMUSGList;
> typedef struct SHPCDevice SHPCDevice;
> +typedef struct VHostSCSI VHostSCSI;
>
> typedef uint64_t pcibus_t;
>
> diff --git a/qemu-config.c b/qemu-config.c
> index 5c3296b..2d4884c 100644
> --- a/qemu-config.c
> +++ b/qemu-config.c
> @@ -626,6 +626,24 @@ QemuOptsList qemu_boot_opts = {
> },
> };
>
> +QemuOptsList qemu_vhost_scsi_opts = {
> + .name = "vhost-scsi",
> + .head = QTAILQ_HEAD_INITIALIZER(qemu_vhost_scsi_opts.head),
> + .desc = {
> + {
> + .name = "wwpn",
> + .type = QEMU_OPT_STRING,
> + }, {
> + .name = "tpgt",
> + .type = QEMU_OPT_NUMBER,
> + }, {
> + .name = "vhostfd",
> + .type = QEMU_OPT_STRING,
> + },
> + { /* end of list */ }
> + },
> +};
> +
> static QemuOptsList *vm_config_groups[32] = {
> &qemu_drive_opts,
> &qemu_chardev_opts,
> @@ -641,6 +659,7 @@ static QemuOptsList *vm_config_groups[32] = {
> &qemu_machine_opts,
> &qemu_boot_opts,
> &qemu_iscsi_opts,
> + &qemu_vhost_scsi_opts,
> NULL,
> };
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 47cb5bd..4e7a03c 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -565,6 +565,10 @@ possible drivers and properties, use @code{-device ?} and
> ETEXI
>
> DEFHEADING()
> +DEF("vhost-scsi", HAS_ARG, QEMU_OPTION_vhost_scsi,
> + "-vhost-scsi wwpn=string0,tpgt=number0\n"
> + " add vhost-scsi device\n",
> + QEMU_ARCH_ALL)
>
> DEFHEADING(File system options:)
>
> diff --git a/vl.c b/vl.c
> index 91076f0..61c8284 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -144,6 +144,7 @@ int main(int argc, char **argv)
> #include "qemu-options.h"
> #include "qmp-commands.h"
> #include "main-loop.h"
> +#include "hw/vhost-scsi.h"
> #ifdef CONFIG_VIRTFS
> #include "fsdev/qemu-fsdev.h"
> #endif
> @@ -1858,6 +1859,14 @@ static int fsdev_init_func(QemuOpts *opts, void *opaque)
> }
> #endif
>
> +static int vhost_scsi_init_func(QemuOpts *opts, void *opaque)
> +{
> + if (!vhost_scsi_add_opts(opts)) {
> + return -1;
> + }
> + return 0;
> +}
> +
> static int mon_init_func(QemuOpts *opts, void *opaque)
> {
> CharDriverState *chr;
> @@ -2617,6 +2626,11 @@ int main(int argc, char **argv, char **envp)
> }
> break;
> #endif
> + case QEMU_OPTION_vhost_scsi:
> + if (!qemu_opts_parse(qemu_find_opts("vhost-scsi"), optarg, 0)) {
> + exit(1);
> + }
> + break;
> #ifdef CONFIG_SLIRP
> case QEMU_OPTION_tftp:
> legacy_tftp_prefix = optarg;
> @@ -3337,6 +3351,10 @@ int main(int argc, char **argv, char **envp)
> exit(1);
> }
> #endif
> + if (qemu_opts_foreach(qemu_find_opts("vhost-scsi"),
> + vhost_scsi_init_func, NULL, 1)) {
> + exit(1);
> + }
>
> os_daemonize();
>
> --
> 1.7.2.5
^ permalink raw reply
* Re: [RFC-v3 0/5] vhost-scsi: Add support for host virtualized target
From: Michael S. Tsirkin @ 2012-09-07 6:23 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Stefan Hajnoczi, kvm-devel, Jan Kiszka, qemu-devel, Zhi Yong Wu,
Anthony Liguori, target-devel, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <1345582331-22593-1-git-send-email-nab@linux-iscsi.org>
On Tue, Aug 21, 2012 at 08:52:06PM +0000, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> Hi folks,
>
> This is the third RFC for vhost-scsi patches against mainline QEMU v1.1
I rebased on top of 1.2 and put this in my tree:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git pci
Please check it out, meanwhile we'll see if anyone complains.
--
MST
^ permalink raw reply
* Re: [RFC-v3 0/5] vhost-scsi: Add support for host virtualized target
From: Michael S. Tsirkin @ 2012-09-07 6:32 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Stefan Hajnoczi, kvm-devel, Jan Kiszka, qemu-devel, Zhi Yong Wu,
Anthony Liguori, target-devel, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <20120907062322.GB9232@redhat.com>
On Fri, Sep 07, 2012 at 09:23:22AM +0300, Michael S. Tsirkin wrote:
> On Tue, Aug 21, 2012 at 08:52:06PM +0000, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger <nab@linux-iscsi.org>
> >
> > Hi folks,
> >
> > This is the third RFC for vhost-scsi patches against mainline QEMU v1.1
>
> I rebased on top of 1.2 and put this in my tree:
> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git pci
>
> Please check it out, meanwhile we'll see if anyone complains.
OK I will be the first :).
Looks like build *without* CONFIG_VHOST_SCSI
is broken now:
LINK sparc64-softmmu/qemu-system-sparc64
../hw/qdev-properties.o: In function `parse_vhost_scsi_dev':
/scm/qemu/hw/qdev-properties.c:706: undefined reference to
`find_vhost_scsi'
../hw/qdev-properties.o: In function `print_vhost_scsi_dev':
/scm/qemu/hw/qdev-properties.c:719: undefined reference to
`vhost_scsi_get_id'
../libhw64/vl.o: In function `vhost_scsi_init_func':
/scm/qemu/vl.c:1943: undefined reference to `vhost_scsi_add_opts'
hw/virtio-scsi.o: In function `virtio_scsi_set_status':
/scm/qemu/hw/virtio-scsi.c:733: undefined reference to `vhost_scsi_stop'
/scm/qemu/hw/virtio-scsi.c:724: undefined reference to
`vhost_scsi_start'
Please add stubs *and test* without CONFIG_VHOST_SCSI.
While at it can we please rename file to vhost_scsi.c, vhost_scsi.h?
qemu is inconsistent but vhost files all use _ as separator:
this means function names and file names are in sync.
Reverted for now, waiting for v4.
Thanks!
> --
> MST
^ permalink raw reply
* Re: [RFC-v3 0/5] vhost-scsi: Add support for host virtualized target
From: Michael S. Tsirkin @ 2012-09-07 6:37 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Stefan Hajnoczi, kvm-devel, Jan Kiszka, qemu-devel, Zhi Yong Wu,
Anthony Liguori, target-devel, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <20120907063237.GA13651@redhat.com>
On Fri, Sep 07, 2012 at 09:32:37AM +0300, Michael S. Tsirkin wrote:
> On Fri, Sep 07, 2012 at 09:23:22AM +0300, Michael S. Tsirkin wrote:
> > On Tue, Aug 21, 2012 at 08:52:06PM +0000, Nicholas A. Bellinger wrote:
> > > From: Nicholas Bellinger <nab@linux-iscsi.org>
> > >
> > > Hi folks,
> > >
> > > This is the third RFC for vhost-scsi patches against mainline QEMU v1.1
> >
> > I rebased on top of 1.2 and put this in my tree:
> > git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git pci
> >
> > Please check it out, meanwhile we'll see if anyone complains.
>
> OK I will be the first :).
> Looks like build *without* CONFIG_VHOST_SCSI
> is broken now:
> LINK sparc64-softmmu/qemu-system-sparc64
> ../hw/qdev-properties.o: In function `parse_vhost_scsi_dev':
> /scm/qemu/hw/qdev-properties.c:706: undefined reference to
> `find_vhost_scsi'
> ../hw/qdev-properties.o: In function `print_vhost_scsi_dev':
> /scm/qemu/hw/qdev-properties.c:719: undefined reference to
> `vhost_scsi_get_id'
> ../libhw64/vl.o: In function `vhost_scsi_init_func':
> /scm/qemu/vl.c:1943: undefined reference to `vhost_scsi_add_opts'
> hw/virtio-scsi.o: In function `virtio_scsi_set_status':
> /scm/qemu/hw/virtio-scsi.c:733: undefined reference to `vhost_scsi_stop'
> /scm/qemu/hw/virtio-scsi.c:724: undefined reference to
> `vhost_scsi_start'
>
> Please add stubs *and test* without CONFIG_VHOST_SCSI.
>
> While at it can we please rename file to vhost_scsi.c, vhost_scsi.h?
> qemu is inconsistent but vhost files all use _ as separator:
> this means function names and file names are in sync.
>
> Reverted for now, waiting for v4.
Please note vhost, net and monitor changes are all merged.
That's patches 1/5 and 2/5.
> Thanks!
>
> > --
> > MST
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Rusty Russell @ 2012-09-07 6:39 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: fes, aarcange, riel, kvm, yvugenfi, linux-kernel, mikew, yinghan,
Paolo Bonzini, virtualization
In-Reply-To: <20120907054202.GA3452@redhat.com>
"Michael S. Tsirkin" <mst@redhat.com> writes:
> On Fri, Sep 07, 2012 at 09:15:46AM +0930, Rusty Russell wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>> > Instead, VIRTIO_NET_F_HOST_MUST_SEND_GARP would be a "negative" feature:
>> > if set, the host _may not_ rely on the guest to send a gARP. Similarly
>> > if VIRTIO_BALLOON_F_MUST_TELL_HOST is set, the guest _may not_ use
>> > ballooned pages directly.
>> >
>> > There are _no_ other negative features besides
>> > VIRTIO_BALLOON_F_MUST_TELL_HOST in the spec, and for a good
>> > reason---because they're broken.
>> >
>> > (Hmm, actually we have one, VIRTIO_BLK_F_RO. It is also a bit broken,
>> > but it is not so important because it depends on user input more than
>> > hypervisor version).
>>
>> Yes, this is the key observation, and an important lesson for the
>> future. Thanks!
>> Note that these two negative features were in the original spec, where
>> it's assumed that every device supports them. That's not explicitly
>> documented, however.
>
> I'm curious what would we do for the future? I tried to imagine that _RO
> was not in the original spec, so virtio-blk expects a r/w device.
> Now we can not add _RW - old hypervisors do not set it, and old
> drivers do not ack it.
> What would a new flag with equivalent functionality be?
Backwards compatibility in the R/O case would actually work: just fail
writes. Because it's just friendly advice to the OS, really.
The final test is always: does it break users? If there are no users
who will notice, we can do anything. If there are users, we have to
keep backwards compatibility, and that implies we can't add "must know"
features.
> So it looks like a bug: we should teach driver to tell host first on leak?
> Yan, Vadim, can you comment please?
>
> Also if true, looks like this bit will be useful to detect a fixed driver on
> the hypervisor side - to avoid unmapping such pages? Rusty what do you
> think?
So, feature is unimplemented in qemu, and broken in drivers. I starting
to share Paolo's dislike of it.
Don't understand why we'd care about fixed drivers though, if we remove
the feature bit....
Cheers,
Rusty.
^ permalink raw reply
* [PATCH 0/5] vhost-scsi: Add support for host virtualized target
From: Nicholas A. Bellinger @ 2012-09-07 6:48 UTC (permalink / raw)
To: target-devel
Cc: Stefan Hajnoczi, kvm-devel, Michael S. Tsirkin, Jan Kiszka,
qemu-devel, Zhi Yong Wu, Anthony Liguori, Paolo Bonzini, lf-virt,
Christoph Hellwig
From: Nicholas Bellinger <nab@linux-iscsi.org>
Hello Anthony & Co,
This is the fourth installment to add host virtualized target support for
the mainline tcm_vhost fabric driver using Linux v3.6-rc into QEMU 1.3.0-rc.
The series is available directly from the following git branch:
git://git.kernel.org/pub/scm/virt/kvm/nab/qemu-kvm.git vhost-scsi-for-1.3
Note the code is cut against yesterday's QEMU head, and dispite the name
of the tree is based upon mainline qemu.org git code + has thus far been
running overnight with > 100K IOPs small block 4k workloads using v3.6-rc2+
based target code with RAMDISK_DR backstores.
Other than some minor fuzz between jumping from QEMU 1.2.0 -> 1.2.50, this
series is functionally identical to what's been posted for vhost-scsi RFC-v3
to qemu-devel.
Please consider applying these patches for an initial vhost-scsi merge into
QEMU 1.3.0-rc code, or let us know what else you'd like to see addressed for
this series to in order to merge.
Thank you!
--nab
Nicholas Bellinger (2):
monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
virtio-scsi: Set max_target=0 during vhost-scsi operation
Stefan Hajnoczi (3):
vhost: Pass device path to vhost_dev_init()
vhost-scsi: add -vhost-scsi host device for use with tcm-vhost
virtio-scsi: Add start/stop functionality for vhost-scsi
configure | 10 +++
hw/Makefile.objs | 1 +
hw/qdev-properties.c | 41 +++++++++++
hw/vhost-scsi.c | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++
hw/vhost-scsi.h | 62 ++++++++++++++++
hw/vhost.c | 5 +-
hw/vhost.h | 3 +-
hw/vhost_net.c | 2 +-
hw/virtio-pci.c | 2 +
hw/virtio-scsi.c | 55 ++++++++++++++-
hw/virtio-scsi.h | 1 +
monitor.c | 18 +++++
monitor.h | 1 +
net.c | 18 -----
net.h | 2 -
net/socket.c | 2 +-
net/tap.c | 4 +-
qemu-common.h | 1 +
qemu-config.c | 19 +++++
qemu-options.hx | 4 +
vl.c | 18 +++++
21 files changed, 431 insertions(+), 28 deletions(-)
create mode 100644 hw/vhost-scsi.c
create mode 100644 hw/vhost-scsi.h
--
1.7.2.5
^ permalink raw reply
* [PATCH 1/5] monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
From: Nicholas A. Bellinger @ 2012-09-07 6:48 UTC (permalink / raw)
To: target-devel
Cc: Anthony Liguori, Stefan Hajnoczi, kvm-devel, Michael S. Tsirkin,
Jan Kiszka, qemu-devel, Zhi Yong Wu, Anthony Liguori,
Paolo Bonzini, lf-virt, Christoph Hellwig
In-Reply-To: <1347000499-28701-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch renames+moves the net_handle_fd_param() caller used to
obtain a file descriptor from either qemu_parse_fd() (the normal case)
or from monitor_get_fd() (migration case) into a generically prefixed
monitor_handle_fd_param() to be used by vhost-scsi code.
Also update net/[socket,tap].c consumers to use the new prefix.
Reported-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
monitor.c | 18 ++++++++++++++++++
monitor.h | 1 +
net.c | 18 ------------------
net.h | 2 --
net/socket.c | 2 +-
net/tap.c | 4 ++--
6 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/monitor.c b/monitor.c
index 49dccfe..0641efe 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2389,6 +2389,24 @@ int monitor_get_fd(Monitor *mon, const char *fdname)
return -1;
}
+int monitor_handle_fd_param(Monitor *mon, const char *fdname)
+{
+ int fd;
+
+ if (!qemu_isdigit(fdname[0]) && mon) {
+
+ fd = monitor_get_fd(mon, fdname);
+ if (fd == -1) {
+ error_report("No file descriptor named %s found", fdname);
+ return -1;
+ }
+ } else {
+ fd = qemu_parse_fd(fdname);
+ }
+
+ return fd;
+}
+
/* mon_cmds and info_cmds would be sorted at runtime */
static mon_cmd_t mon_cmds[] = {
#include "hmp-commands.h"
diff --git a/monitor.h b/monitor.h
index 5f4de1b..d557e97 100644
--- a/monitor.h
+++ b/monitor.h
@@ -65,6 +65,7 @@ int monitor_read_block_device_key(Monitor *mon, const char *device,
void *opaque);
int monitor_get_fd(Monitor *mon, const char *fdname);
+int monitor_handle_fd_param(Monitor *mon, const char *fdname);
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
GCC_FMT_ATTR(2, 0);
diff --git a/net.c b/net.c
index 60043dd..e5d25d4 100644
--- a/net.c
+++ b/net.c
@@ -522,24 +522,6 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models,
return -1;
}
-int net_handle_fd_param(Monitor *mon, const char *param)
-{
- int fd;
-
- if (!qemu_isdigit(param[0]) && mon) {
-
- fd = monitor_get_fd(mon, param);
- if (fd == -1) {
- error_report("No file descriptor named %s found", param);
- return -1;
- }
- } else {
- fd = qemu_parse_fd(param);
- }
-
- return fd;
-}
-
static int net_init_nic(const NetClientOptions *opts, const char *name,
NetClientState *peer)
{
diff --git a/net.h b/net.h
index 2975056..04fda1d 100644
--- a/net.h
+++ b/net.h
@@ -168,8 +168,6 @@ int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret);
void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
-int net_handle_fd_param(Monitor *mon, const char *param);
-
#define POLYNOMIAL 0x04c11db6
unsigned compute_mcast_idx(const uint8_t *ep);
diff --git a/net/socket.c b/net/socket.c
index c172c24..7c602e4 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -629,7 +629,7 @@ int net_init_socket(const NetClientOptions *opts, const char *name,
if (sock->has_fd) {
int fd;
- fd = net_handle_fd_param(cur_mon, sock->fd);
+ fd = monitor_handle_fd_param(cur_mon, sock->fd);
if (fd == -1 || !net_socket_fd_init(peer, "socket", name, fd, 1)) {
return -1;
}
diff --git a/net/tap.c b/net/tap.c
index 1971525..a88ae8f 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -610,7 +610,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
return -1;
}
- fd = net_handle_fd_param(cur_mon, tap->fd);
+ fd = monitor_handle_fd_param(cur_mon, tap->fd);
if (fd == -1) {
return -1;
}
@@ -686,7 +686,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
int vhostfd;
if (tap->has_vhostfd) {
- vhostfd = net_handle_fd_param(cur_mon, tap->vhostfd);
+ vhostfd = monitor_handle_fd_param(cur_mon, tap->vhostfd);
if (vhostfd == -1) {
return -1;
}
--
1.7.2.5
^ permalink raw reply related
* [PATCH 2/5] vhost: Pass device path to vhost_dev_init()
From: Nicholas A. Bellinger @ 2012-09-07 6:48 UTC (permalink / raw)
To: target-devel
Cc: Stefan Hajnoczi, kvm-devel, Michael S. Tsirkin, Jan Kiszka,
qemu-devel, Zhi Yong Wu, Anthony Liguori, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <1347000499-28701-1-git-send-email-nab@linux-iscsi.org>
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
The path to /dev/vhost-net is currently hardcoded in vhost_dev_init().
This needs to be changed so that /dev/vhost-scsi can be used. Pass in
the device path instead of hardcoding it.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
hw/vhost.c | 5 +++--
hw/vhost.h | 3 ++-
hw/vhost_net.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 0fd8da8..d0ce5aa 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -747,14 +747,15 @@ static void vhost_eventfd_del(MemoryListener *listener,
{
}
-int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force)
+int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
+ bool force)
{
uint64_t features;
int r;
if (devfd >= 0) {
hdev->control = devfd;
} else {
- hdev->control = open("/dev/vhost-net", O_RDWR);
+ hdev->control = open(devpath, O_RDWR);
if (hdev->control < 0) {
return -errno;
}
diff --git a/hw/vhost.h b/hw/vhost.h
index 80e64df..0c47229 100644
--- a/hw/vhost.h
+++ b/hw/vhost.h
@@ -44,7 +44,8 @@ struct vhost_dev {
bool force;
};
-int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force);
+int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
+ bool force);
void vhost_dev_cleanup(struct vhost_dev *hdev);
bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index ecaa22d..df2c4a3 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -109,7 +109,7 @@ struct vhost_net *vhost_net_init(NetClientState *backend, int devfd,
(1 << VHOST_NET_F_VIRTIO_NET_HDR);
net->backend = r;
- r = vhost_dev_init(&net->dev, devfd, force);
+ r = vhost_dev_init(&net->dev, devfd, "/dev/vhost-net", force);
if (r < 0) {
goto fail;
}
--
1.7.2.5
^ permalink raw reply related
* [PATCH 3/5] vhost-scsi: add -vhost-scsi host device for use with tcm-vhost
From: Nicholas A. Bellinger @ 2012-09-07 6:48 UTC (permalink / raw)
To: target-devel
Cc: Anthony Liguori, Stefan Hajnoczi, kvm-devel, Michael S. Tsirkin,
Jan Kiszka, qemu-devel, Zhi Yong Wu, Anthony Liguori,
Paolo Bonzini, lf-virt, Christoph Hellwig
In-Reply-To: <1347000499-28701-1-git-send-email-nab@linux-iscsi.org>
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch adds a new type of host device that drives the vhost_scsi
device. The syntax to add vhost-scsi is:
qemu -vhost-scsi id=vhost-scsi0,wwpn=...,tpgt=123
The virtio-scsi emulated device will make use of vhost-scsi to process
virtio-scsi requests inside the kernel and hand them to the in-kernel
SCSI target stack using the tcm_vhost fabric driver.
The tcm_vhost driver was merged into the upstream linux kernel for 3.6-rc2,
and the commit can be found here:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=057cbf49a1f08297
Changelog v2 -> v3:
- Move qdev_prop_vhost_scsi + DEFINE_PROP_VHOST_SCSI defs into vhost-scsi.[c,h]
(reported by MST)
- Add enum vhost_scsi_vq_list for VHostSCSI->vqs[] enumeration (reported by MST)
- Add missing braces around single like if statement to following QEMU
style (reported by Blue Swirl)
- Change vhost_scsi_target->vhost_wwpn to char *, in order to drop casts to
pstrcpy in vhost_scsi_start() + vhost_scsi_stop() (reported by Blue Swirl)
- Change VHOST_SCSI_GET_ABI_VERSION to 'int' type (MST)
- Fix 4 byte alignment of vhost_scsi_target (MST)
- Convert fprintf(stderr, ...) usage to -> error_report() (reported by MST)
- Do explict memset of backend before calling VHOST_SCSI_CLEAR_ENDPOINT
in vhost_scsi_stop() (reported by MST)
- Add support for vhostfd passing in vhost_scsi_add() (reported by MST)
- Change vhost_scsi_add() to use monitor_handle_fd_param() (reported by MST)
Changelog v1 -> v2:
- Expose ABI version via VHOST_SCSI_GET_ABI_VERSION + use Rev 0 as
starting point for v3.6-rc code (Stefan + ALiguori + nab)
- Fix upstream qemu conflict in hw/qdev-properties.c
- Make GET_ABI_VERSION use int (nab + mst)
- Fix vhost-scsi case lables in configure (reported by paolo)
- Convert qdev_prop_vhost_scsi to use ->get() + ->set() following
qdev_prop_netdev (reported by paolo)
- Fix typo in qemu-options.hx definition of vhost-scsi (reported by paolo)
Changelog v0 -> v1:
- Add VHOST_SCSI_SET_ENDPOINT call (stefan)
- Enable vhost notifiers for multiple queues (Zhi)
- clear vhost-scsi endpoint on stopped (Zhi)
- Add CONFIG_VHOST_SCSI for QEMU build configure (nab)
- Rename vhost_vring_target -> vhost_scsi_target (mst + nab)
- Add support for VHOST_SCSI_GET_ABI_VERSION ioctl (aliguori + nab)
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
configure | 10 +++
hw/Makefile.objs | 1 +
hw/qdev-properties.c | 41 +++++++++++
hw/vhost-scsi.c | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++
hw/vhost-scsi.h | 62 ++++++++++++++++
qemu-common.h | 1 +
qemu-config.c | 19 +++++
qemu-options.hx | 4 +
vl.c | 18 +++++
9 files changed, 346 insertions(+), 0 deletions(-)
create mode 100644 hw/vhost-scsi.c
create mode 100644 hw/vhost-scsi.h
diff --git a/configure b/configure
index f0dbc03..1f03202 100755
--- a/configure
+++ b/configure
@@ -168,6 +168,7 @@ libattr=""
xfs=""
vhost_net="no"
+vhost_scsi="no"
kvm="no"
gprof="no"
debug_tcg="no"
@@ -513,6 +514,7 @@ Haiku)
usb="linux"
kvm="yes"
vhost_net="yes"
+ vhost_scsi="yes"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
audio_possible_drivers="$audio_possible_drivers fmod"
fi
@@ -818,6 +820,10 @@ for opt do
;;
--enable-vhost-net) vhost_net="yes"
;;
+ --disable-vhost-scsi) vhost_scsi="no"
+ ;;
+ --enable-vhost-scsi) vhost_scsi="yes"
+ ;;
--disable-opengl) opengl="no"
;;
--enable-opengl) opengl="yes"
@@ -3116,6 +3122,7 @@ echo "posix_madvise $posix_madvise"
echo "uuid support $uuid"
echo "libcap-ng support $cap_ng"
echo "vhost-net support $vhost_net"
+echo "vhost-scsi support $vhost_scsi"
echo "Trace backend $trace_backend"
echo "Trace output file $trace_file-<pid>"
echo "spice support $spice"
@@ -3828,6 +3835,9 @@ case "$target_arch2" in
if test "$vhost_net" = "yes" ; then
echo "CONFIG_VHOST_NET=y" >> $config_target_mak
fi
+ if test "$vhost_scsi" = "yes" ; then
+ echo "CONFIG_VHOST_SCSI=y" >> $config_target_mak
+ fi
fi
esac
case "$target_arch2" in
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 3ba5dd0..6ab75ec 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -169,6 +169,7 @@ obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o virtio-scsi.o
obj-$(CONFIG_SOFTMMU) += vhost_net.o
obj-$(CONFIG_VHOST_NET) += vhost.o
+obj-$(CONFIG_VHOST_SCSI) += vhost-scsi.o
obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/
obj-$(CONFIG_NO_PCI) += pci-stub.o
obj-$(CONFIG_VGA) += vga.o
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 8aca0d4..8b505ca 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -4,6 +4,7 @@
#include "blockdev.h"
#include "hw/block-common.h"
#include "net/hub.h"
+#include "vhost-scsi.h"
void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
{
@@ -696,6 +697,46 @@ PropertyInfo qdev_prop_vlan = {
.set = set_vlan,
};
+/* --- vhost-scsi --- */
+
+static int parse_vhost_scsi_dev(DeviceState *dev, const char *str, void **ptr)
+{
+ VHostSCSI *p;
+
+ p = find_vhost_scsi(str);
+ if (p == NULL) {
+ return -ENOENT;
+ }
+
+ *ptr = p;
+ return 0;
+}
+
+static const char *print_vhost_scsi_dev(void *ptr)
+{
+ VHostSCSI *p = ptr;
+
+ return (p) ? vhost_scsi_get_id(p) : "<null>";
+}
+
+static void get_vhost_scsi_dev(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ get_pointer(obj, v, opaque, print_vhost_scsi_dev, name, errp);
+}
+
+static void set_vhost_scsi_dev(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ set_pointer(obj, v, opaque, parse_vhost_scsi_dev, name, errp);
+}
+
+PropertyInfo qdev_prop_vhost_scsi = {
+ .name = "vhost-scsi",
+ .get = get_vhost_scsi_dev,
+ .set = set_vhost_scsi_dev,
+};
+
/* --- pointer --- */
/* Not a proper property, just for dirty hacks. TODO Remove it! */
diff --git a/hw/vhost-scsi.c b/hw/vhost-scsi.c
new file mode 100644
index 0000000..96da2fc
--- /dev/null
+++ b/hw/vhost-scsi.c
@@ -0,0 +1,190 @@
+/*
+ * vhost_scsi host device
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
+ *
+ * Changes for QEMU mainline + tcm_vhost kernel upstream:
+ * Nicholas Bellinger <nab@risingtidesystems.com>
+ *
+ * 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.
+ *
+ */
+
+#include <sys/ioctl.h>
+#include "config.h"
+#include "qemu-queue.h"
+#include "monitor.h"
+#include "vhost-scsi.h"
+#include "vhost.h"
+
+struct VHostSCSI {
+ const char *id;
+ const char *wwpn;
+ uint16_t tpgt;
+ int vhostfd;
+ struct vhost_dev dev;
+ struct vhost_virtqueue vqs[VHOST_SCSI_VQ_NUM];
+ QLIST_ENTRY(VHostSCSI) list;
+};
+
+static QLIST_HEAD(, VHostSCSI) vhost_scsi_list =
+ QLIST_HEAD_INITIALIZER(vhost_scsi_list);
+
+VHostSCSI *find_vhost_scsi(const char *id)
+{
+ VHostSCSI *vs;
+
+ QLIST_FOREACH(vs, &vhost_scsi_list, list) {
+ if (!strcmp(id, vs->id)) {
+ return vs;
+ }
+ }
+ return NULL;
+}
+
+const char *vhost_scsi_get_id(VHostSCSI *vs)
+{
+ return vs->id;
+}
+
+int vhost_scsi_start(VHostSCSI *vs, VirtIODevice *vdev)
+{
+ int ret, abi_version;
+ struct vhost_scsi_target backend;
+
+ if (!vhost_dev_query(&vs->dev, vdev)) {
+ return -ENOTSUP;
+ }
+
+ vs->dev.nvqs = VHOST_SCSI_VQ_NUM;
+ vs->dev.vqs = vs->vqs;
+
+ ret = vhost_dev_enable_notifiers(&vs->dev, vdev);
+ if (ret < 0) {
+ return ret;
+ }
+
+ ret = vhost_dev_start(&vs->dev, vdev);
+ if (ret < 0) {
+ return ret;
+ }
+
+ ret = ioctl(vs->dev.control, VHOST_SCSI_GET_ABI_VERSION, &abi_version);
+ if (ret < 0) {
+ ret = -errno;
+ vhost_dev_stop(&vs->dev, vdev);
+ return ret;
+ }
+ if (abi_version > VHOST_SCSI_ABI_VERSION) {
+ error_report("vhost-scsi: The running tcm_vhost kernel abi_version:"
+ " %d is greater than vhost_scsi userspace supports: %d, please"
+ " upgrade your version of QEMU\n", abi_version,
+ VHOST_SCSI_ABI_VERSION);
+ ret = -ENOSYS;
+ vhost_dev_stop(&vs->dev, vdev);
+ return ret;
+ }
+ fprintf(stdout, "TCM_vHost ABI version: %d\n", abi_version);
+
+ memset(&backend, 0, sizeof(backend));
+ pstrcpy(backend.vhost_wwpn, sizeof(backend.vhost_wwpn), vs->wwpn);
+ backend.vhost_tpgt = vs->tpgt;
+ ret = ioctl(vs->dev.control, VHOST_SCSI_SET_ENDPOINT, &backend);
+ if (ret < 0) {
+ ret = -errno;
+ vhost_dev_stop(&vs->dev, vdev);
+ return ret;
+ }
+
+ return 0;
+}
+
+void vhost_scsi_stop(VHostSCSI *vs, VirtIODevice *vdev)
+{
+ int ret;
+ struct vhost_scsi_target backend;
+
+ memset(&backend, 0, sizeof(backend));
+ pstrcpy(backend.vhost_wwpn, sizeof(backend.vhost_wwpn), vs->wwpn);
+ backend.vhost_tpgt = vs->tpgt;
+ ret = ioctl(vs->dev.control, VHOST_SCSI_CLEAR_ENDPOINT, &backend);
+ if (ret < 0) {
+ error_report("vhost-scsi: Failed to clear endpoint\n");
+ }
+
+ vhost_dev_stop(&vs->dev, vdev);
+}
+
+static VHostSCSI *vhost_scsi_add(const char *id, const char *wwpn,
+ uint16_t tpgt, const char *vhostfd_str)
+{
+ VHostSCSI *vs;
+ int ret;
+
+ vs = g_malloc0(sizeof(*vs));
+ if (!vs) {
+ error_report("vhost-scsi: unable to allocate *vs\n");
+ return NULL;
+ }
+ vs->vhostfd = -1;
+
+ if (vhostfd_str) {
+ vs->vhostfd = monitor_handle_fd_param(cur_mon, vhostfd_str);
+ if (vs->vhostfd == -1) {
+ error_report("vhost-scsi: unable to parse vs->vhostfd\n");
+ return NULL;
+ }
+ }
+ /* TODO set up vhost-scsi device and bind to tcm_vhost/$wwpm/tpgt_$tpgt */
+ ret = vhost_dev_init(&vs->dev, vs->vhostfd, "/dev/vhost-scsi", false);
+ if (ret < 0) {
+ error_report("vhost-scsi: vhost initialization failed: %s\n",
+ strerror(-ret));
+ return NULL;
+ }
+ vs->dev.backend_features = 0;
+ vs->dev.acked_features = 0;
+
+ vs->id = g_strdup(id);
+ vs->wwpn = g_strdup(wwpn);
+ vs->tpgt = tpgt;
+ QLIST_INSERT_HEAD(&vhost_scsi_list, vs, list);
+
+ return vs;
+}
+
+VHostSCSI *vhost_scsi_add_opts(QemuOpts *opts)
+{
+ const char *id;
+ const char *wwpn, *vhostfd;
+ uint64_t tpgt;
+
+ id = qemu_opts_id(opts);
+ if (!id) {
+ error_report("vhost-scsi: no id specified\n");
+ return NULL;
+ }
+ if (find_vhost_scsi(id)) {
+ error_report("duplicate vhost-scsi: \"%s\"\n", id);
+ return NULL;
+ }
+
+ wwpn = qemu_opt_get(opts, "wwpn");
+ if (!wwpn) {
+ error_report("vhost-scsi: \"%s\" missing wwpn\n", id);
+ return NULL;
+ }
+
+ tpgt = qemu_opt_get_number(opts, "tpgt", UINT64_MAX);
+ if (tpgt > UINT16_MAX) {
+ error_report("vhost-scsi: \"%s\" needs a 16-bit tpgt\n", id);
+ return NULL;
+ }
+ vhostfd = qemu_opt_get(opts, "vhostfd");
+
+ return vhost_scsi_add(id, wwpn, tpgt, vhostfd);
+}
diff --git a/hw/vhost-scsi.h b/hw/vhost-scsi.h
new file mode 100644
index 0000000..68de51a
--- /dev/null
+++ b/hw/vhost-scsi.h
@@ -0,0 +1,62 @@
+/*
+ * vhost_scsi host device
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
+ *
+ * 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_SCSI_H
+#define VHOST_SCSI_H
+
+#include "qemu-common.h"
+#include "qemu-option.h"
+#include "qdev.h"
+
+/*
+ * Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
+ *
+ * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
+ * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
+ */
+
+#define VHOST_SCSI_ABI_VERSION 0
+
+/* TODO #include <linux/vhost.h> properly */
+/* For VHOST_SCSI_SET_ENDPOINT/VHOST_SCSI_CLEAR_ENDPOINT ioctl */
+struct vhost_scsi_target {
+ int abi_version;
+ char vhost_wwpn[224];
+ unsigned short vhost_tpgt;
+ unsigned short reserved;
+};
+
+enum vhost_scsi_vq_list {
+ VHOST_SCSI_VQ_CTL = 0,
+ VHOST_SCSI_VQ_EVT = 1,
+ VHOST_SCSI_VQ_IO = 2,
+ VHOST_SCSI_VQ_NUM = 3,
+};
+
+#define VHOST_VIRTIO 0xAF
+#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
+#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
+#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
+
+extern PropertyInfo qdev_prop_vhost_scsi;
+
+#define DEFINE_PROP_VHOST_SCSI(_n, _s, _f) \
+ DEFINE_PROP(_n, _s, _f, qdev_prop_vhost_scsi, VHostSCSI*)
+
+VHostSCSI *find_vhost_scsi(const char *id);
+const char *vhost_scsi_get_id(VHostSCSI *vs);
+VHostSCSI *vhost_scsi_add_opts(QemuOpts *opts);
+int vhost_scsi_start(VHostSCSI *vs, VirtIODevice *vdev);
+void vhost_scsi_stop(VHostSCSI *vs, VirtIODevice *vdev);
+
+#endif
diff --git a/qemu-common.h b/qemu-common.h
index f9deca6..ec36002 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -280,6 +280,7 @@ typedef struct EventNotifier EventNotifier;
typedef struct VirtIODevice VirtIODevice;
typedef struct QEMUSGList QEMUSGList;
typedef struct SHPCDevice SHPCDevice;
+typedef struct VHostSCSI VHostSCSI;
typedef uint64_t pcibus_t;
diff --git a/qemu-config.c b/qemu-config.c
index 5c3296b..2d4884c 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -626,6 +626,24 @@ QemuOptsList qemu_boot_opts = {
},
};
+QemuOptsList qemu_vhost_scsi_opts = {
+ .name = "vhost-scsi",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_vhost_scsi_opts.head),
+ .desc = {
+ {
+ .name = "wwpn",
+ .type = QEMU_OPT_STRING,
+ }, {
+ .name = "tpgt",
+ .type = QEMU_OPT_NUMBER,
+ }, {
+ .name = "vhostfd",
+ .type = QEMU_OPT_STRING,
+ },
+ { /* end of list */ }
+ },
+};
+
static QemuOptsList *vm_config_groups[32] = {
&qemu_drive_opts,
&qemu_chardev_opts,
@@ -641,6 +659,7 @@ static QemuOptsList *vm_config_groups[32] = {
&qemu_machine_opts,
&qemu_boot_opts,
&qemu_iscsi_opts,
+ &qemu_vhost_scsi_opts,
NULL,
};
diff --git a/qemu-options.hx b/qemu-options.hx
index 47cb5bd..4e7a03c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -565,6 +565,10 @@ possible drivers and properties, use @code{-device ?} and
ETEXI
DEFHEADING()
+DEF("vhost-scsi", HAS_ARG, QEMU_OPTION_vhost_scsi,
+ "-vhost-scsi wwpn=string0,tpgt=number0\n"
+ " add vhost-scsi device\n",
+ QEMU_ARCH_ALL)
DEFHEADING(File system options:)
diff --git a/vl.c b/vl.c
index 91076f0..61c8284 100644
--- a/vl.c
+++ b/vl.c
@@ -144,6 +144,7 @@ int main(int argc, char **argv)
#include "qemu-options.h"
#include "qmp-commands.h"
#include "main-loop.h"
+#include "hw/vhost-scsi.h"
#ifdef CONFIG_VIRTFS
#include "fsdev/qemu-fsdev.h"
#endif
@@ -1858,6 +1859,14 @@ static int fsdev_init_func(QemuOpts *opts, void *opaque)
}
#endif
+static int vhost_scsi_init_func(QemuOpts *opts, void *opaque)
+{
+ if (!vhost_scsi_add_opts(opts)) {
+ return -1;
+ }
+ return 0;
+}
+
static int mon_init_func(QemuOpts *opts, void *opaque)
{
CharDriverState *chr;
@@ -2617,6 +2626,11 @@ int main(int argc, char **argv, char **envp)
}
break;
#endif
+ case QEMU_OPTION_vhost_scsi:
+ if (!qemu_opts_parse(qemu_find_opts("vhost-scsi"), optarg, 0)) {
+ exit(1);
+ }
+ break;
#ifdef CONFIG_SLIRP
case QEMU_OPTION_tftp:
legacy_tftp_prefix = optarg;
@@ -3337,6 +3351,10 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
#endif
+ if (qemu_opts_foreach(qemu_find_opts("vhost-scsi"),
+ vhost_scsi_init_func, NULL, 1)) {
+ exit(1);
+ }
os_daemonize();
--
1.7.2.5
^ permalink raw reply related
* [PATCH 4/5] virtio-scsi: Add start/stop functionality for vhost-scsi
From: Nicholas A. Bellinger @ 2012-09-07 6:48 UTC (permalink / raw)
To: target-devel
Cc: Stefan Hajnoczi, kvm-devel, Michael S. Tsirkin, Jan Kiszka,
qemu-devel, Zhi Yong Wu, Anthony Liguori, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <1347000499-28701-1-git-send-email-nab@linux-iscsi.org>
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This patch starts and stops vhost as the virtio device transitions
through its status phases. Vhost can only be started once the guest
reports its driver has successfully initialized, which means the
virtqueues have been set up by the guest.
v3: - Add vhost-scsi.h include for DEFINE_PROP_VHOST_SCSI (mst + nab)
- Move vhost-scsi related struct members ahead of *cmd_vqs[0] within
VirtIOSCSI definition. (paolo + nab)
v2: - Squash virtio-scsi: use the vhost-scsi host device from stefan (nab)
- Fix up virtio_scsi_properties[] conflict w/ upstream qemu (nab)
- Drop usage of to_virtio_scsi() in virtio_scsi_set_status()
(reported by paolo)
- Use modern VirtIOSCSIConf define in virtio-scsi.h (reported by paolo)
- Use s->conf->vhost_scsi instead of proxyconf->vhost_scsi in
virtio_scsi_init() (reported by paolo)
- Only register QEMU SCSI bus is vhost-scsi is not active (reported
by paolo)
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
hw/virtio-pci.c | 2 ++
hw/virtio-scsi.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
hw/virtio-scsi.h | 1 +
3 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 125eded..8ec7cf1 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -22,6 +22,7 @@
#include "virtio-net.h"
#include "virtio-serial.h"
#include "virtio-scsi.h"
+#include "vhost-scsi.h"
#include "pci.h"
#include "qemu-error.h"
#include "msi.h"
@@ -1036,6 +1037,7 @@ static void virtio_scsi_exit_pci(PCIDevice *pci_dev)
}
static Property virtio_scsi_properties[] = {
+ DEFINE_PROP_VHOST_SCSI("vhost-scsi", VirtIOPCIProxy, scsi.vhost_scsi),
DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, DEV_NVECTORS_UNSPECIFIED),
DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOPCIProxy, host_features, scsi),
diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index 5f737ac..edda097 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -13,9 +13,13 @@
*
*/
+#include "qemu-common.h"
+#include "qemu-error.h"
+#include "vhost-scsi.h"
#include "virtio-scsi.h"
#include <hw/scsi.h>
#include <hw/scsi-defs.h>
+#include "vhost.h"
#define VIRTIO_SCSI_VQ_SIZE 128
#define VIRTIO_SCSI_CDB_SIZE 32
@@ -144,6 +148,10 @@ typedef struct {
uint32_t cdb_size;
int resetting;
bool events_dropped;
+
+ bool vhost_started;
+ VHostSCSI *vhost_scsi;
+
VirtQueue *ctrl_vq;
VirtQueue *event_vq;
VirtQueue *cmd_vqs[0];
@@ -699,6 +707,38 @@ static struct SCSIBusInfo virtio_scsi_scsi_info = {
.load_request = virtio_scsi_load_request,
};
+static bool virtio_scsi_started(VirtIOSCSI *s, uint8_t val)
+{
+ return (val & VIRTIO_CONFIG_S_DRIVER_OK) && s->vdev.vm_running;
+}
+
+static void virtio_scsi_set_status(VirtIODevice *vdev, uint8_t val)
+{
+ VirtIOSCSI *s = (VirtIOSCSI *)vdev;
+ bool start = virtio_scsi_started(s, val);
+
+ if (s->vhost_started == start) {
+ return;
+ }
+
+ if (start) {
+ int ret;
+
+ ret = vhost_scsi_start(s->vhost_scsi, vdev);
+ if (ret < 0) {
+ error_report("virtio-scsi: unable to start vhost: %s\n",
+ strerror(-ret));
+
+ /* There is no userspace virtio-scsi fallback so exit */
+ exit(1);
+ }
+ } else {
+ vhost_scsi_stop(s->vhost_scsi, vdev);
+ }
+
+ s->vhost_started = start;
+}
+
VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf)
{
VirtIOSCSI *s;
@@ -712,12 +752,17 @@ VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf)
s->qdev = dev;
s->conf = proxyconf;
+ s->vhost_started = false;
+ s->vhost_scsi = s->conf->vhost_scsi;
/* TODO set up vdev function pointers */
s->vdev.get_config = virtio_scsi_get_config;
s->vdev.set_config = virtio_scsi_set_config;
s->vdev.get_features = virtio_scsi_get_features;
s->vdev.reset = virtio_scsi_reset;
+ if (s->vhost_scsi) {
+ s->vdev.set_status = virtio_scsi_set_status;
+ }
s->ctrl_vq = virtio_add_queue(&s->vdev, VIRTIO_SCSI_VQ_SIZE,
virtio_scsi_handle_ctrl);
@@ -743,5 +788,9 @@ void virtio_scsi_exit(VirtIODevice *vdev)
{
VirtIOSCSI *s = (VirtIOSCSI *)vdev;
unregister_savevm(s->qdev, "virtio-scsi", s);
+
+ /* This will stop vhost backend if appropriate. */
+ virtio_scsi_set_status(vdev, 0);
+
virtio_cleanup(vdev);
}
diff --git a/hw/virtio-scsi.h b/hw/virtio-scsi.h
index 4bc889d..74e9422 100644
--- a/hw/virtio-scsi.h
+++ b/hw/virtio-scsi.h
@@ -22,6 +22,7 @@
#define VIRTIO_SCSI_F_CHANGE 2
struct VirtIOSCSIConf {
+ VHostSCSI *vhost_scsi;
uint32_t num_queues;
uint32_t max_sectors;
uint32_t cmd_per_lun;
--
1.7.2.5
^ permalink raw reply related
* [PATCH 5/5] virtio-scsi: Set max_target=0 during vhost-scsi operation
From: Nicholas A. Bellinger @ 2012-09-07 6:48 UTC (permalink / raw)
To: target-devel
Cc: Stefan Hajnoczi, kvm-devel, Michael S. Tsirkin, Jan Kiszka,
qemu-devel, Zhi Yong Wu, Anthony Liguori, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <1347000499-28701-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
This QEMU patch sets VirtIOSCSIConfig->max_target=0 for vhost-scsi operation
to restrict virtio-scsi LLD guest scanning to max_id=0 (a single target ID
instance) when connected to individual tcm_vhost endpoints.
This ensures that virtio-scsi LLD only attempts to scan target IDs up to
VIRTIO_SCSI_MAX_TARGET when connected via virtio-scsi-raw.
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
hw/virtio-scsi.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index edda097..ab5ca72 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -546,7 +546,11 @@ static void virtio_scsi_get_config(VirtIODevice *vdev,
stl_raw(&scsiconf->sense_size, s->sense_size);
stl_raw(&scsiconf->cdb_size, s->cdb_size);
stl_raw(&scsiconf->max_channel, VIRTIO_SCSI_MAX_CHANNEL);
- stl_raw(&scsiconf->max_target, VIRTIO_SCSI_MAX_TARGET);
+ if (s->vhost_scsi) {
+ stl_raw(&scsiconf->max_target, 0);
+ } else {
+ stl_raw(&scsiconf->max_target, VIRTIO_SCSI_MAX_TARGET);
+ }
stl_raw(&scsiconf->max_lun, VIRTIO_SCSI_MAX_LUN);
}
--
1.7.2.5
^ permalink raw reply related
* Re: [RFC-v3 0/5] vhost-scsi: Add support for host virtualized target
From: Nicholas A. Bellinger @ 2012-09-07 6:56 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Stefan Hajnoczi, kvm-devel, Jan Kiszka, qemu-devel, Zhi Yong Wu,
Anthony Liguori, target-devel, Paolo Bonzini, lf-virt,
Christoph Hellwig
In-Reply-To: <20120907063757.GA16041@redhat.com>
On Fri, 2012-09-07 at 09:37 +0300, Michael S. Tsirkin wrote:
> On Fri, Sep 07, 2012 at 09:32:37AM +0300, Michael S. Tsirkin wrote:
> > On Fri, Sep 07, 2012 at 09:23:22AM +0300, Michael S. Tsirkin wrote:
> > > On Tue, Aug 21, 2012 at 08:52:06PM +0000, Nicholas A. Bellinger wrote:
> > > > From: Nicholas Bellinger <nab@linux-iscsi.org>
> > > >
> > > > Hi folks,
> > > >
> > > > This is the third RFC for vhost-scsi patches against mainline QEMU v1.1
> > >
> > > I rebased on top of 1.2 and put this in my tree:
> > > git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git pci
> > >
> > > Please check it out, meanwhile we'll see if anyone complains.
> >
> > OK I will be the first :).
> > Looks like build *without* CONFIG_VHOST_SCSI
> > is broken now:
> > LINK sparc64-softmmu/qemu-system-sparc64
> > ../hw/qdev-properties.o: In function `parse_vhost_scsi_dev':
> > /scm/qemu/hw/qdev-properties.c:706: undefined reference to
> > `find_vhost_scsi'
> > ../hw/qdev-properties.o: In function `print_vhost_scsi_dev':
> > /scm/qemu/hw/qdev-properties.c:719: undefined reference to
> > `vhost_scsi_get_id'
> > ../libhw64/vl.o: In function `vhost_scsi_init_func':
> > /scm/qemu/vl.c:1943: undefined reference to `vhost_scsi_add_opts'
> > hw/virtio-scsi.o: In function `virtio_scsi_set_status':
> > /scm/qemu/hw/virtio-scsi.c:733: undefined reference to `vhost_scsi_stop'
> > /scm/qemu/hw/virtio-scsi.c:724: undefined reference to
> > `vhost_scsi_start'
> >
> > Please add stubs *and test* without CONFIG_VHOST_SCSI.
> >
> > While at it can we please rename file to vhost_scsi.c, vhost_scsi.h?
> > qemu is inconsistent but vhost files all use _ as separator:
> > this means function names and file names are in sync.
> >
> > Reverted for now, waiting for v4.
>
> Please note vhost, net and monitor changes are all merged.
> That's patches 1/5 and 2/5.
Hi MST!
Looks like we just cross emails here within 10 mins here..
I'm happy to respin a PATCH and/or GIT PULL request minus 1-2 depending
on the vhost-scsi workflow that ALiguori is comfortable with here.
Thank you!
--nab
^ permalink raw reply
* [RFCv2 1/2] virtio_console: Add support for DMA memory allocation
From: sjur.brandeland @ 2012-09-07 6:57 UTC (permalink / raw)
To: Michael S . Tsirkin
Cc: Sjur Brændeland, Linus Walleij, linux-kernel, virtualization,
Amit Shah, Sjur Brændeland
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Add feature VIRTIO_CONSOLE_F_DMA_MEM. If the architecture has
DMA support and this feature bit is set, the virtio data buffers
will be allocated from DMA memory. If the device requests
the feature VIRTIO_CONSOLE_F_DMA_MEM, but the architecture
don't support DMA the driver's probe function will fail.
This is needed for using virtio_console from the remoteproc
framework.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
cc: Rusty Russell <rusty@rustcorp.com.au>
cc: Michael S. Tsirkin <mst@redhat.com>
cc: Amit Shah <amit.shah@redhat.com>
cc: Ohad Ben-Cohen <ohad@wizery.com>
cc: Linus Walleij <linus.walleij@linaro.org>
cc: virtualization@lists.linux-foundation.org
cc: linux-kernel@vger.kernel.org
---
drivers/char/virtio_console.c | 91 +++++++++++++++++++++++++++++++++-------
include/linux/virtio_console.h | 1 +
2 files changed, 77 insertions(+), 15 deletions(-)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index cdf2f54..469c05f 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -35,8 +35,15 @@
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/module.h>
+#include <linux/dma-mapping.h>
#include "../tty/hvc/hvc_console.h"
+#ifdef CONFIG_HAS_DMA
+#define VIRTIO_CONSOLE_HAS_DMA (1)
+#else
+#define VIRTIO_CONSOLE_HAS_DMA (0)
+#endif
+
/*
* This is a global struct for storing common data for all the devices
* this driver handles.
@@ -334,20 +341,56 @@ static inline bool use_multiport(struct ports_device *portdev)
return portdev->vdev->features[0] & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
}
-static void free_buf(struct port_buffer *buf)
+/* Allocate data buffer from DMA memory if requested */
+static inline void *
+alloc_databuf(struct virtio_device *vdev, size_t size, gfp_t flag)
+{
+ if (VIRTIO_CONSOLE_HAS_DMA &&
+ virtio_has_feature(vdev, VIRTIO_CONSOLE_F_DMA_MEM)) {
+ struct device *dev = &vdev->dev;
+ dma_addr_t dma;
+ /*
+ * Allocate DMA memory from ancestors. Finding the ancestor
+ * is a bit quirky when DMA_MEMORY_INCLUDES_CHILDREN is not
+ * implemented.
+ */
+ dev = dev->parent ? dev->parent : dev;
+ dev = dev->parent ? dev->parent : dev;
+ return dma_alloc_coherent(dev, size, &dma, flag);
+ }
+ return kzalloc(size, flag);
+}
+
+static inline void
+free_databuf(struct virtio_device *vdev, size_t size, void *cpu_addr)
+{
+ if (VIRTIO_CONSOLE_HAS_DMA &&
+ virtio_has_feature(vdev, VIRTIO_CONSOLE_F_DMA_MEM)) {
+ struct device *dev = &vdev->dev;
+ dma_addr_t dma = virt_to_bus(cpu_addr);
+ dev = dev->parent ? dev->parent : dev;
+ dev = dev->parent ? dev->parent : dev;
+ dma_free_coherent(dev, size, cpu_addr, dma);
+ return;
+ }
+ kfree(cpu_addr);
+}
+
+static void
+free_buf(struct virtqueue *vq, struct port_buffer *buf, size_t buf_size)
{
- kfree(buf->buf);
+ free_databuf(vq->vdev, buf_size, buf);
kfree(buf);
}
-static struct port_buffer *alloc_buf(size_t buf_size)
+static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size)
{
struct port_buffer *buf;
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
if (!buf)
goto fail;
- buf->buf = kzalloc(buf_size, GFP_KERNEL);
+ buf->buf = alloc_databuf(vq->vdev, buf_size, GFP_KERNEL);
if (!buf->buf)
goto free_buf;
buf->len = 0;
@@ -414,7 +457,7 @@ static void discard_port_data(struct port *port)
port->stats.bytes_discarded += buf->len - buf->offset;
if (add_inbuf(port->in_vq, buf) < 0) {
err++;
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
}
port->inbuf = NULL;
buf = get_inbuf(port);
@@ -485,7 +528,7 @@ static void reclaim_consumed_buffers(struct port *port)
return;
}
while ((buf = virtqueue_get_buf(port->out_vq, &len))) {
- kfree(buf);
+ free_databuf(port->portdev->vdev, len, buf);
port->outvq_full = false;
}
}
@@ -672,6 +715,7 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
char *buf;
ssize_t ret;
bool nonblock;
+ struct virtio_device *vdev;
/* Userspace could be out to fool us */
if (!count)
@@ -694,9 +738,10 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
if (!port->guest_connected)
return -ENODEV;
+ vdev = port->portdev->vdev;
count = min((size_t)(32 * 1024), count);
- buf = kmalloc(count, GFP_KERNEL);
+ buf = alloc_databuf(vdev, count, GFP_KERNEL);
if (!buf)
return -ENOMEM;
@@ -720,7 +765,8 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
goto out;
free_buf:
- kfree(buf);
+ free_databuf(vdev, count, buf);
+
out:
return ret;
}
@@ -1102,7 +1148,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock)
nr_added_bufs = 0;
do {
- buf = alloc_buf(PAGE_SIZE);
+ buf = alloc_buf(vq, PAGE_SIZE);
if (!buf)
break;
@@ -1110,7 +1156,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock)
ret = add_inbuf(vq, buf);
if (ret < 0) {
spin_unlock_irq(lock);
- free_buf(buf);
+ free_buf(vq, buf, PAGE_SIZE);
break;
}
nr_added_bufs++;
@@ -1234,7 +1280,7 @@ static int add_port(struct ports_device *portdev, u32 id)
free_inbufs:
while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
free_device:
device_destroy(pdrvdata.class, port->dev->devt);
free_cdev:
@@ -1276,7 +1322,7 @@ static void remove_port_data(struct port *port)
/* Remove buffers we queued up for the Host to send us data in. */
while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
- free_buf(buf);
+ free_buf(port->in_vq, buf, PAGE_SIZE);
}
/*
@@ -1478,7 +1524,7 @@ static void control_work_handler(struct work_struct *work)
if (add_inbuf(portdev->c_ivq, buf) < 0) {
dev_warn(&portdev->vdev->dev,
"Error adding buffer to queue\n");
- free_buf(buf);
+ free_buf(portdev->c_ivq, buf, PAGE_SIZE);
}
}
spin_unlock(&portdev->cvq_lock);
@@ -1674,10 +1720,10 @@ static void remove_controlq_data(struct ports_device *portdev)
return;
while ((buf = virtqueue_get_buf(portdev->c_ivq, &len)))
- free_buf(buf);
+ free_buf(portdev->c_ivq, buf, PAGE_SIZE);
while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq)))
- free_buf(buf);
+ free_buf(portdev->c_ivq, buf, PAGE_SIZE);
}
/*
@@ -1698,6 +1744,17 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
/* Ensure to read early_put_chars now */
barrier();
+ /* Refuse to bind if F_DMA_MEM request cannot be met */
+ if (!VIRTIO_CONSOLE_HAS_DMA &&
+ (vdev->config->get_features(vdev) &
+ (1 << VIRTIO_CONSOLE_F_DMA_MEM))) {
+
+ dev_err(&vdev->dev,
+ "DMA_MEM requested but arch does not support DMA\n");
+ err = -ENODEV;
+ goto fail;
+ }
+
portdev = kmalloc(sizeof(*portdev), GFP_KERNEL);
if (!portdev) {
err = -ENOMEM;
@@ -1836,6 +1893,10 @@ static struct virtio_device_id id_table[] = {
static unsigned int features[] = {
VIRTIO_CONSOLE_F_SIZE,
VIRTIO_CONSOLE_F_MULTIPORT,
+#if VIRTIO_CONSOLE_HAS_DMA
+ VIRTIO_CONSOLE_F_DMA_MEM,
+#endif
+
};
#ifdef CONFIG_PM
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index bdf4b00..b27f7fa 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -38,6 +38,7 @@
/* Feature bits */
#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
+#define VIRTIO_CONSOLE_F_DMA_MEM 2 /* Use DMA memory in vrings */
#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
--
1.7.9.5
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related
* [PATCHv2] virtio: Don't access device data after unregistration.
From: sjur.brandeland @ 2012-09-07 6:57 UTC (permalink / raw)
To: Michael S . Tsirkin
Cc: Sjur Brændeland, Guzman Lugo, Fernadndo, linux-kernel,
virtualization, Sjur Brændeland
In-Reply-To: <1347001066-13521-1-git-send-email-sjur.brandeland@stericsson.com>
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Fix panic in virtio.c when CONFIG_DEBUG_SLAB is set.
device_unregister() drops reference to device so put_device()
could invoke release callback. In this case the release
callback will free the device. Make sure we don't access
device after unregister by fetching the device index
before calling unregister.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
cc: Guzman Lugo, Fernadndo <fernando.lugo@ti.com>
cc: Michael S. Tsirkin <mst@redhat.com>
cc: Rusty Russell <rusty@rustcorp.com.au>
cc: Ohad Ben-Cohen <ohad@wizery.com>
cc: virtualization@lists.linux-foundation.org
cc: linux-kernel@vger.kernel.org
---
drivers/virtio/virtio.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index c3b3f7f..faee112 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -225,8 +225,15 @@ EXPORT_SYMBOL_GPL(register_virtio_device);
void unregister_virtio_device(struct virtio_device *dev)
{
+ /*
+ * device_unregister() drops reference to device so put_device could
+ * invoke release callback. In case that callback will free the device,
+ * make sure we don't access device after this call.
+ */
+
+ int index = dev->index;
device_unregister(&dev->dev);
- ida_simple_remove(&virtio_index_ida, dev->index);
+ ida_simple_remove(&virtio_index_ida, index);
}
EXPORT_SYMBOL_GPL(unregister_virtio_device);
--
1.7.5.4
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related
* [RFCv2 2/2] virtio_console: Add feature to disable console port
From: sjur.brandeland @ 2012-09-07 6:57 UTC (permalink / raw)
To: Michael S . Tsirkin
Cc: Sjur Brændeland, Linus Walleij, linux-kernel, virtualization,
Amit Shah, Sjur Brændeland
In-Reply-To: <1347001066-13521-1-git-send-email-sjur.brandeland@stericsson.com>
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Add the feature VIRTIO_CONSOLE_F_NO_HVC. With this bit set
only port-devices are created. The console port and
port control virtio-queues are not created.
The console port is not suited for communicating
to a remote processor because of it's blocking behavior.
But the port-device supports efficient non-blocking IO
to a remote processor.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
cc: Rusty Russell <rusty@rustcorp.com.au>
cc: Michael S. Tsirkin <mst@redhat.com>
cc: Amit Shah <amit.shah@redhat.com>
cc: Ohad Ben-Cohen <ohad@wizery.com>
cc: Linus Walleij <linus.walleij@linaro.org>
cc: virtualization@lists.linux-foundation.org
cc: linux-kernel@vger.kernel.org
---
drivers/char/virtio_console.c | 6 +++++-
include/linux/virtio_console.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 469c05f..7408c00 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1244,10 +1244,13 @@ static int add_port(struct ports_device *portdev, u32 id)
goto free_device;
}
+ /* Don't initialize the port_console if F_NO_HVC is set*/
+ if (virtio_has_feature(port->portdev->vdev, VIRTIO_CONSOLE_F_NO_HVC))
+ port->host_connected = true;
/*
* If we're not using multiport support, this has to be a console port
*/
- if (!use_multiport(port->portdev)) {
+ else if (!use_multiport(port->portdev)) {
err = init_port_console(port);
if (err)
goto free_inbufs;
@@ -1896,6 +1899,7 @@ static unsigned int features[] = {
#if VIRTIO_CONSOLE_HAS_DMA
VIRTIO_CONSOLE_F_DMA_MEM,
#endif
+ VIRTIO_CONSOLE_F_NO_HVC,
};
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index b27f7fa..a7c8974 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -39,6 +39,7 @@
#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
#define VIRTIO_CONSOLE_F_DMA_MEM 2 /* Use DMA memory in vrings */
+#define VIRTIO_CONSOLE_F_NO_HVC 3 /* Disable use of HVC */
#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
--
1.7.9.5
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related
* Re: [RFC 1/2] virtio_console: Add support for DMA memory allocation
From: Sjur Brændeland @ 2012-09-07 8:35 UTC (permalink / raw)
To: Ohad Ben-Cohen, Rusty Russell
Cc: Amit Shah, Linus Walleij, virtualization, linux-kernel,
Michael S. Tsirkin
In-Reply-To: <87k3w7j49i.fsf@rustcorp.com.au>
Hi Ohad,
>> A simplest thing to do is change dev id. rusty?
>
> For generic usage, this is correct. But my opinion is that fallback on
> feature non-ack is quality-of-implementation issue: great to have, but
> there are cases where you just want to fail with "you're too old".
>
> And in this case, an old system simply will never work. So it's a
> question of how graceful the failure is.
>
> Can your userspace loader can refuse to proceed if the driver doesn't
> ack the bits? If so, it's simpler than a whole new ID.
Ohad: Are there any way we could avoid starting up the remote processor
if mandatory virtio features (such as DMA memory) are not supported by
the virtio-driver?
Regards,
Sjur
^ permalink raw reply
* Re: [RFC 1/2] virtio_console: Add support for DMA memory allocation
From: Sjur Brændeland @ 2012-09-07 9:24 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Linus Walleij, linux-kernel, virtualization, Amit Shah
In-Reply-To: <20120905191657.GA15868@redhat.com>
Hi Michael.
>> Not just fail to work, the kernel will panic on the BUG_ON().
>> Remoteproc gets the virtio configuration from firmware loaded
>> from user space. So this type of problem might be triggered
>> for other virtio drivers as well.
>
> how?
...
>> Even if we fix this particular problem, the general problem
>> still exists: bogus virtio declarations in remoteproc's firmware
>> may cause BUG_ON().
>
> which BUG_ON exactly?
I am afraid I have been barking up the wrong tree here.
Please ignore my previous rambling about panics related
to device features.
I hit the BUG() in virtio_check_driver_offered_feature():
First I did not declare the feature because DMA was not set:
static unsigned int features[] = {
...
#if VIRTIO_CONSOLE_HAS_DMA
VIRTIO_CONSOLE_F_DMA_MEM,
#endif
};
and then in probe I checked if the feature was supported:
virtio_has_feature(vdev, VIRTIO_CONSOLE_F_DMA_MEM)
This triggered the BUG() in virtio_check_driver_offered_feature(),
because the driver was asking for a unknown-feature.
I can get avoid this by simply checking the devices feature bits directly
instead of using virtio_has_feature().
Regards,
Sjur
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Paolo Bonzini @ 2012-09-07 9:27 UTC (permalink / raw)
To: Rusty Russell
Cc: fes, aarcange, riel, kvm, Michael S. Tsirkin, yvugenfi,
linux-kernel, mikew, yinghan, virtualization
In-Reply-To: <87vcfqfia1.fsf@rustcorp.com.au>
Il 07/09/2012 08:39, Rusty Russell ha scritto:
>> > So it looks like a bug: we should teach driver to tell host first on leak?
>> > Yan, Vadim, can you comment please?
>> >
>> > Also if true, looks like this bit will be useful to detect a fixed driver on
>> > the hypervisor side - to avoid unmapping such pages? Rusty what do you
>> > think?
> So, feature is unimplemented in qemu, and broken in drivers. I starting
> to share Paolo's dislike of it.
>
> Don't understand why we'd care about fixed drivers though, if we remove
> the feature bit....
Hmm, Michael has a point here. Basically, the Windows driver is using
silent deflate, but not telling the host (yet) about it. So, we must
assume that a driver that does not negotiate
VIRTIO_BALLOON_F_MUST_TELL_HOST _will_ use silent deflate.
Here's a way to proceed.
We add VIRTIO_BALLOON_F_SILENT_DEFLATE, which is negotiated normally.
If not available, at worst the guest driver may refuse to start, or
revert to using the deflateq.
We rename VIRTIO_BALLOON_F_MUST_TELL_HOST to WILL_TELL_HOST, since
that's how it's being used. Now for the device there are three cases:
- does not support silent deflate at all: it should always propose
VIRTIO_BALLOON_F_WILL_TELL_HOST; if the (bad) driver does not
negotiate it, the device must assume that the guest will use silent
deflate, and fail to start the guest if the device does not support
silent deflate.
- optionally supports silent deflate: it should always propose
VIRTIO_BALLOON_F_WILL_TELL_HOST; if the (bad) driver does not
negotiate it, the device must assume that the guest will use silent
deflate
- always supports silent deflate: does not need to do anything,
current behavior works fine. But the driver might as well propose
VIRTIO_BALLOON_F_WILL_TELL_HOST, so that migration works fine. (This
is a hardware change, so it must be versioned, yadda yadda).
I can prepare a spec patch for this.
BTW, since we have in the archives an example of using silent deflate,
here is an example of non-silent deflate. It may help understanding the
above with an actual example of a device. Suppose a guest is using PCI
passthrough, so it has all memory pinned.
- If the guest will _not_ use silent deflate, we can unlock memory on
inflate and lock it back on deflate. (The question is what to do if
locking fail; left for when someone actually implements this thing).
- If the guest will use silent deflate, we cannot do that.
So this is the second case above. The device must propose
VIRTIO_BALLOON_F_WILL_TELL_HOST. Then:
- if the guest negotiates VIRTIO_BALLOON_F_SILENT_DEFLATE,
we cannot do the munlock/mlock
- if the guest negotiates VIRTIO_BALLOON_F_WILL_TELL_HOST,
we can do the munlock/mlock
- if the guest does not negotiate either, the driver is buggy
and we cannot do the munlock/mlock
Paolo
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Michael S. Tsirkin @ 2012-09-07 10:43 UTC (permalink / raw)
To: Rusty Russell
Cc: fes, aarcange, riel, kvm, yvugenfi, linux-kernel, mikew, yinghan,
Paolo Bonzini, virtualization
In-Reply-To: <87vcfqfia1.fsf@rustcorp.com.au>
On Fri, Sep 07, 2012 at 04:09:50PM +0930, Rusty Russell wrote:
> > So it looks like a bug: we should teach driver to tell host first on leak?
> > Yan, Vadim, can you comment please?
> >
> > Also if true, looks like this bit will be useful to detect a fixed driver on
> > the hypervisor side - to avoid unmapping such pages? Rusty what do you
> > think?
>
> So, feature is unimplemented in qemu, and broken in drivers. I starting
> to share Paolo's dislike of it.
What is broken in drivers?
To me it looks like it works exactly as advertized: linux and bsd ack
TELL_HOST and tells host first. windows does not do either. Do windows
drivers currently are not broken: they just do not support the feature.
The claim that drivers and hyprevisors do not support it is false:
qemu does not support it but drivers do and in non trivial way.
> Don't understand why we'd care about fixed drivers though, if we remove
> the feature bit....
>
> Cheers,
> Rusty.
Do we really know there are no hypervisors implementing it?
As I said above drivers do have support.
--
MST
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Michael S. Tsirkin @ 2012-09-07 10:53 UTC (permalink / raw)
To: Paolo Bonzini
Cc: fes, aarcange, riel, yvugenfi, kvm, linux-kernel, mikew, yinghan,
virtualization
In-Reply-To: <5049BE0E.6040202@redhat.com>
On Fri, Sep 07, 2012 at 11:27:42AM +0200, Paolo Bonzini wrote:
> Il 07/09/2012 08:39, Rusty Russell ha scritto:
> >> > So it looks like a bug: we should teach driver to tell host first on leak?
> >> > Yan, Vadim, can you comment please?
> >> >
> >> > Also if true, looks like this bit will be useful to detect a fixed driver on
> >> > the hypervisor side - to avoid unmapping such pages? Rusty what do you
> >> > think?
> > So, feature is unimplemented in qemu, and broken in drivers. I starting
> > to share Paolo's dislike of it.
> >
> > Don't understand why we'd care about fixed drivers though, if we remove
> > the feature bit....
>
> Hmm, Michael has a point here. Basically, the Windows driver is using
> silent deflate, but not telling the host (yet) about it. So, we must
> assume that a driver that does not negotiate
> VIRTIO_BALLOON_F_MUST_TELL_HOST _will_ use silent deflate.
>
> Here's a way to proceed.
>
> We add VIRTIO_BALLOON_F_SILENT_DEFLATE, which is negotiated normally.
> If not available, at worst the guest driver may refuse to start, or
> revert to using the deflateq.
>
> We rename VIRTIO_BALLOON_F_MUST_TELL_HOST to WILL_TELL_HOST, since
> that's how it's being used. Now for the device there are three cases:
>
> - does not support silent deflate at all: it should always propose
> VIRTIO_BALLOON_F_WILL_TELL_HOST; if the (bad) driver does not
> negotiate it, the device must assume that the guest will use silent
> deflate, and fail to start the guest if the device does not support
> silent deflate.
>
> - optionally supports silent deflate: it should always propose
> VIRTIO_BALLOON_F_WILL_TELL_HOST; if the (bad) driver does not
> negotiate it, the device must assume that the guest will use silent
> deflate
>
> - always supports silent deflate: does not need to do anything,
> current behavior works fine. But the driver might as well propose
> VIRTIO_BALLOON_F_WILL_TELL_HOST, so that migration works fine. (This
> is a hardware change, so it must be versioned, yadda yadda).
>
> I can prepare a spec patch for this.
>
>
> BTW, since we have in the archives an example of using silent deflate,
> here is an example of non-silent deflate. It may help understanding the
> above with an actual example of a device. Suppose a guest is using PCI
> passthrough, so it has all memory pinned.
>
> - If the guest will _not_ use silent deflate, we can unlock memory on
> inflate and lock it back on deflate. (The question is what to do if
> locking fail; left for when someone actually implements this thing).
>
> - If the guest will use silent deflate, we cannot do that.
>
> So this is the second case above. The device must propose
> VIRTIO_BALLOON_F_WILL_TELL_HOST. Then:
>
> - if the guest negotiates VIRTIO_BALLOON_F_SILENT_DEFLATE,
> we cannot do the munlock/mlock
>
> - if the guest negotiates VIRTIO_BALLOON_F_WILL_TELL_HOST,
> we can do the munlock/mlock
>
> - if the guest does not negotiate either, the driver is buggy
> and we cannot do the munlock/mlock
>
> Paolo
Let us start with what is broken currently. Looking at
it very closely, I think the answer is nothing.
Even migration in qemu is not broken as you claimed initially.
Next, consider the interface proposed here. You defacto declare
all existing drivers buggy. This is a wrong thing to do.
You also use two feature bits for a single simple thing,
this is inelegant.
Last, let us consider how existing feature can be used
in the hypervisor. If driver did not ack
MUST_TELL_HOST, it is *not* buggy but it means we can not
do munlock. This applies to current windows drivers.
If driver *did* ack MUST_TELL_HOST, we can munlock
and mlock back on leak.
Seems useful, driver support is already there,
so removing the MUST_TELL_HOST bit seems like a bad idea.
--
MST
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Paolo Bonzini @ 2012-09-07 11:20 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: fes, aarcange, riel, yvugenfi, kvm, linux-kernel, mikew, yinghan,
virtualization
In-Reply-To: <20120907105335.GB17211@redhat.com>
Il 07/09/2012 12:53, Michael S. Tsirkin ha scritto:
> Let us start with what is broken currently. Looking at
> it very closely, I think the answer is nothing.
> Even migration in qemu is not broken as you claimed initially.
Correct, migration would be broken as soon as QEMU starts using
MUST_TELL_HOST. I'm trying to think ahead, since we have many ideas
floating around on the implementation of ballooning.
If you implement the mlock/munlock trick, you must start using
MUST_TELL_HOST in QEMU to advertise it to guests, and migration breaks.
> Next, consider the interface proposed here. You defacto declare
> all existing drivers buggy.
No, only Windows (and it is buggy, it calls tell_host last). Linux and
BSD drivers do negotiate MUST_TELL_HOST, and are not buggy.
> This is a wrong thing to do.
> You also use two feature bits for a single simple thing,
> this is inelegant.
True, but the choice is:
1) add a once-only hack to QEMU that fixes migration of
VIRTIO_BALLOON_F_MUST_TELL_HOST;
2) always advertise VIRTIO_BALLOON_F_MUST_TELL_HOST. If you do this,
guests cannot use anymore silent deflate, which is a regression.
3) use two bits. One tells the device that the driver supports chatty
deflate; one tells the driver that the device supports silent deflate.
So in the end you do use two feature bits for two different things.
Plus, both feature bits are "positive" and I'm happy.
> Last, let us consider how existing feature can be used
> in the hypervisor. If driver did not ack
> MUST_TELL_HOST, it is *not* buggy but it means we can not
> do munlock. This applies to current windows drivers.
> If driver *did* ack MUST_TELL_HOST, we can munlock
> and mlock back on leak.
> Seems useful, driver support is already there,
> so removing the MUST_TELL_HOST bit seems like a bad idea.
Indeed, repurposing MUST_TELL_HOST to WILL_TELL_HOST is better than
killing it.
Paolo
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Michael S. Tsirkin @ 2012-09-07 12:17 UTC (permalink / raw)
To: Paolo Bonzini
Cc: fes, aarcange, riel, yvugenfi, kvm, linux-kernel, mikew, yinghan,
virtualization
In-Reply-To: <5049D899.60705@redhat.com>
On Fri, Sep 07, 2012 at 01:20:57PM +0200, Paolo Bonzini wrote:
> Il 07/09/2012 12:53, Michael S. Tsirkin ha scritto:
> > Let us start with what is broken currently. Looking at
> > it very closely, I think the answer is nothing.
> > Even migration in qemu is not broken as you claimed initially.
>
> Correct, migration would be broken as soon as QEMU starts using
> MUST_TELL_HOST. I'm trying to think ahead, since we have many ideas
> floating around on the implementation of ballooning.
>
> If you implement the mlock/munlock trick, you must start using
> MUST_TELL_HOST in QEMU to advertise it to guests, and migration breaks.
Migration does not break.
Since I wrote this code in qemu let me explain what is going on.
qemu requires that local and remote side are started with
same feature bits.
To support cross version migration, code in hw/pc_piix.c
disables features if you require migration from/to old qemu.
At some point I added a sanity check:
if we get guest features we know that any bit
set there must be set in host features.
Yes, this catches some user mistakes.
This was never intended as a compatibility guarantee.
User is still required to start qemu such
that host features match exactly, anything else
can lead to failures some of them hard to debug.
Here is a simple example:
1. guest reads host features
2. guest is migrated - check passes since no features are acked
3. guest acks features -> failure
This applies to any feature. Nothing special with this one.
Yes, we can if we want to make this more robust
against user errors, e.g. by migrating host feature
bits. Patches welcome. If we do it will help all
features, not just this one.
> > Next, consider the interface proposed here. You defacto declare
> > all existing drivers buggy.
>
> No, only Windows (and it is buggy, it calls tell_host last).
It is not buggy. It does not ack MUST_TELL_HOST. So it is free to tell
host at any point, it behaves exactly
to spec. You can not retroactively declare drivers buggy like that.
> Linux and
> BSD drivers do negotiate MUST_TELL_HOST, and are not buggy.
>
> > This is a wrong thing to do.
> > You also use two feature bits for a single simple thing,
> > this is inelegant.
>
> True, but the choice is:
>
> 1) add a once-only hack to QEMU that fixes migration of
> VIRTIO_BALLOON_F_MUST_TELL_HOST;
>
> 2) always advertise VIRTIO_BALLOON_F_MUST_TELL_HOST. If you do this,
> guests cannot use anymore silent deflate, which is a regression.
>
> 3) use two bits. One tells the device that the driver supports chatty
> deflate; one tells the driver that the device supports silent deflate.
The right thing to do is either
4. realize we can not address all user errors, so no real issue
5. address this class of user errors by migrating host features
> So in the end you do use two feature bits for two different things.
> Plus, both feature bits are "positive" and I'm happy.
I am not happy.
We lose compatibility with all existing drivers
so it will take years until the feature is actually
useful.
> > Last, let us consider how existing feature can be used
> > in the hypervisor. If driver did not ack
> > MUST_TELL_HOST, it is *not* buggy but it means we can not
> > do munlock. This applies to current windows drivers.
> > If driver *did* ack MUST_TELL_HOST, we can munlock
> > and mlock back on leak.
> > Seems useful, driver support is already there,
> > so removing the MUST_TELL_HOST bit seems like a bad idea.
>
> Indeed, repurposing MUST_TELL_HOST to WILL_TELL_HOST is better than
> killing it.
>
> Paolo
Is this just a matter of naming? Same functionality:
driver that acks this bit will tell host first,
driver that does not will not?
If yes that is fine.
--
MST
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Paolo Bonzini @ 2012-09-07 12:22 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: fes, aarcange, riel, yvugenfi, kvm, linux-kernel, mikew, yinghan,
virtualization
In-Reply-To: <20120907121712.GA17397@redhat.com>
Il 07/09/2012 14:17, Michael S. Tsirkin ha scritto:
>>> Next, consider the interface proposed here. You defacto declare
>>> all existing drivers buggy.
>>
>> No, only Windows (and it is buggy, it calls tell_host last).
>
> It is not buggy. It does not ack MUST_TELL_HOST. So it is free to tell
> host at any point, it behaves exactly
> to spec. You can not retroactively declare drivers buggy like that.
Well, according to your reading of the spec.
In the spec I'm reading "Host must be told before pages from the balloon
are used". Doesn't say anything about the guest.
Now, indeed a very free interpretation is "Guest will tell host before
pages from the balloon are used". It turns out that it's exactly what
guests have been doing, hence that's exactly what I'm proposing now:
rename the feature to VIRTIO_BALLOON_F_WILL_TELL_HOST.
>> True, but the choice is:
>>
>> 1) add a once-only hack to QEMU that fixes migration of
>> VIRTIO_BALLOON_F_MUST_TELL_HOST;
>>
>> 2) always advertise VIRTIO_BALLOON_F_MUST_TELL_HOST. If you do this,
>> guests cannot use anymore silent deflate, which is a regression.
>>
>> 3) use two bits. One tells the device that the driver supports chatty
>> deflate; one tells the driver that the device supports silent deflate.
>
> The right thing to do is either
> 4. realize we can not address all user errors, so no real issue
> 5. address this class of user errors by migrating host features
>
>> So in the end you do use two feature bits for two different things.
>> Plus, both feature bits are "positive" and I'm happy.
>
> I am not happy.
> We lose compatibility with all existing drivers
How so?
> so it will take years until the feature is actually
> useful.
No, we don't! Windows guests will just not be able to use munlock/mlock
until the driver is fixed. Which will probably happen before someone
writes the munlock/mlock code.
> Is this just a matter of naming? Same functionality:
> driver that acks this bit will tell host first,
> driver that does not will not?
>
> If yes that is fine.
Yes, that part we agree on I think. We disagree that (after the rename)
QEMU should start always proposing VIRTIO_BALLOON_F_WILL_TELL_HOST.
_Plus_ adding the new feature bit, which is needed to actually tell the
driver that the host supports the silent deflate. Spec patch on the way.
Paolo
^ permalink raw reply
* Re: [PATCH] virtio-balloon spec: provide a version of the "silent deflate" feature that works
From: Michael S. Tsirkin @ 2012-09-07 12:44 UTC (permalink / raw)
To: Paolo Bonzini
Cc: fes, aarcange, riel, yvugenfi, kvm, linux-kernel, mikew, yinghan,
virtualization
In-Reply-To: <5049E717.8080307@redhat.com>
On Fri, Sep 07, 2012 at 02:22:47PM +0200, Paolo Bonzini wrote:
> Il 07/09/2012 14:17, Michael S. Tsirkin ha scritto:
> >>> Next, consider the interface proposed here. You defacto declare
> >>> all existing drivers buggy.
> >>
> >> No, only Windows (and it is buggy, it calls tell_host last).
> >
> > It is not buggy. It does not ack MUST_TELL_HOST. So it is free to tell
> > host at any point, it behaves exactly
> > to spec. You can not retroactively declare drivers buggy like that.
>
> Well, according to your reading of the spec.
>
> In the spec I'm reading "Host must be told before pages from the balloon
> are used". Doesn't say anything about the guest.
No? How is host told then? By divine force?
> Now, indeed a very free interpretation is "Guest will tell host before
> pages from the balloon are used". It turns out that it's exactly what
> guests have been doing, hence that's exactly what I'm proposing now:
> rename the feature to VIRTIO_BALLOON_F_WILL_TELL_HOST.
Rename is fine.
> >> True, but the choice is:
> >>
> >> 1) add a once-only hack to QEMU that fixes migration of
> >> VIRTIO_BALLOON_F_MUST_TELL_HOST;
> >>
> >> 2) always advertise VIRTIO_BALLOON_F_MUST_TELL_HOST. If you do this,
> >> guests cannot use anymore silent deflate, which is a regression.
> >>
> >> 3) use two bits. One tells the device that the driver supports chatty
> >> deflate; one tells the driver that the device supports silent deflate.
> >
> > The right thing to do is either
> > 4. realize we can not address all user errors, so no real issue
> > 5. address this class of user errors by migrating host features
> >
> >> So in the end you do use two feature bits for two different things.
> >> Plus, both feature bits are "positive" and I'm happy.
> >
> > I am not happy.
> > We lose compatibility with all existing drivers
>
> How so?
>
> > so it will take years until the feature is actually
> > useful.
>
> No, we don't! Windows guests will just not be able to use munlock/mlock
> until the driver is fixed. Which will probably happen before someone
> writes the munlock/mlock code.
If the only change is rename then ofcourse things keep working.
I don't care about the name it is up to Rusty.
> > Is this just a matter of naming? Same functionality:
> > driver that acks this bit will tell host first,
> > driver that does not will not?
> >
> > If yes that is fine.
>
> Yes, that part we agree on I think. We disagree that (after the rename)
> QEMU should start always proposing VIRTIO_BALLOON_F_WILL_TELL_HOST.
Not always. It must be off if compatibility with old qemu is disabled.
> _Plus_ adding the new feature bit, which is needed to actually tell the
This part I do not get. What is silent deflate, why is it useful
and what it has to do with what we are discussing here?
> driver that the host supports the silent deflate.
> Spec patch on the way.
>
> Paolo
Hang on.
Can we please talk about motivation? These patches which come
without motivation are very hard to review.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox