[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/57] vhost-scsi: support inflight io track
From: |
Paolo Bonzini |
Subject: |
[PULL 12/57] vhost-scsi: support inflight io track |
Date: |
Sat, 19 Sep 2020 11:58:31 -0400 |
From: Li Feng <fengli@smartx.com>
Qemu will send GET_INFLIGHT_FD and SET_INFLIGH_FD to backend, and
the backend setup the inflight memory to track the io.
Change-Id: I805d6189996f7a1b44c65f0b12ef7473b1789510
Signed-off-by: Li Feng <fengli@smartx.com>
Message-Id: <20200909122021.1055174-1-fengli@smartx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/vhost-scsi-common.c | 27 +++++++++++++++++++++++++++
include/hw/virtio/vhost-scsi-common.h | 2 ++
2 files changed, 29 insertions(+)
diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c
index 8ec49d7fef..767f827e55 100644
--- a/hw/scsi/vhost-scsi-common.c
+++ b/hw/scsi/vhost-scsi-common.c
@@ -32,6 +32,8 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+ VirtIOSCSICommon *vs = (VirtIOSCSICommon *)vsc;
+
if (!k->set_guest_notifiers) {
error_report("binding does not support guest notifiers");
return -ENOSYS;
@@ -49,6 +51,23 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
}
vsc->dev.acked_features = vdev->guest_features;
+
+ assert(vsc->inflight == NULL);
+ vsc->inflight = g_new0(struct vhost_inflight, 1);
+ ret = vhost_dev_get_inflight(&vsc->dev,
+ vs->conf.virtqueue_size,
+ vsc->inflight);
+ if (ret < 0) {
+ error_report("Error get inflight: %d", -ret);
+ goto err_guest_notifiers;
+ }
+
+ ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight);
+ if (ret < 0) {
+ error_report("Error set inflight: %d", -ret);
+ goto err_guest_notifiers;
+ }
+
ret = vhost_dev_start(&vsc->dev, vdev);
if (ret < 0) {
error_report("Error start vhost dev");
@@ -66,6 +85,9 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
return ret;
err_guest_notifiers:
+ g_free(vsc->inflight);
+ vsc->inflight = NULL;
+
k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, false);
err_host_notifiers:
vhost_dev_disable_notifiers(&vsc->dev, vdev);
@@ -89,6 +111,11 @@ void vhost_scsi_common_stop(VHostSCSICommon *vsc)
}
assert(ret >= 0);
+ if (vsc->inflight) {
+ vhost_dev_free_inflight(vsc->inflight);
+ vsc->inflight = NULL;
+ }
+
vhost_dev_disable_notifiers(&vsc->dev, vdev);
}
diff --git a/include/hw/virtio/vhost-scsi-common.h
b/include/hw/virtio/vhost-scsi-common.h
index 5f0bf73d9d..3be152e45b 100644
--- a/include/hw/virtio/vhost-scsi-common.h
+++ b/include/hw/virtio/vhost-scsi-common.h
@@ -37,6 +37,8 @@ struct VHostSCSICommon {
int lun;
uint64_t host_features;
bool migratable;
+
+ struct vhost_inflight *inflight;
};
int vhost_scsi_common_start(VHostSCSICommon *vsc);
--
2.26.2
- [PULL 02/57] iotests: Work around failing readlink -f, (continued)
- [PULL 02/57] iotests: Work around failing readlink -f, Paolo Bonzini, 2020/09/19
- [PULL 04/57] ninjatool: rebuild multi-output targets if outputs are missing, Paolo Bonzini, 2020/09/19
- [PULL 01/57] tests: add missing genh dependency, Paolo Bonzini, 2020/09/19
- [PULL 07/57] WHPX: vmware cpuid leaf for tsc and apic frequency, Paolo Bonzini, 2020/09/19
- [PULL 03/57] meson: clean up build_by_default, Paolo Bonzini, 2020/09/19
- [PULL 06/57] meson: error out if qemu_suffix starts with /, Paolo Bonzini, 2020/09/19
- [PULL 05/57] meson: fix MSI rule, Paolo Bonzini, 2020/09/19
- [PULL 08/57] configure: Do not intent to build WHPX on 32-bit host, Paolo Bonzini, 2020/09/19
- [PULL 09/57] MAINTAINERS: add Paolo Bonzini as RCU maintainer, Paolo Bonzini, 2020/09/19
- [PULL 16/57] doc: Cleanup "'-mem-path' fallback to RAM" deprecation text, Paolo Bonzini, 2020/09/19
- [PULL 12/57] vhost-scsi: support inflight io track,
Paolo Bonzini <=
- [PULL 10/57] target/i386: support KVM_FEATURE_ASYNC_PF_INT, Paolo Bonzini, 2020/09/19
- [PULL 11/57] memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc, Paolo Bonzini, 2020/09/19
- [PULL 17/57] numa: remove fixup numa_state->num_nodes to MAX_NODES, Paolo Bonzini, 2020/09/19
- [PULL 23/57] hw/char/serial: Remove old DEBUG_SERIAL commented code, Paolo Bonzini, 2020/09/19
- [PULL 24/57] hw/char/serial: Rename I/O read/write trace events, Paolo Bonzini, 2020/09/19
- [PULL 28/57] hw: megasas: return -1 when 'megasas_map_sgl' fails, Paolo Bonzini, 2020/09/19
- [PULL 19/57] hw/char/serial: Remove TYPE_SERIAL_IO, Paolo Bonzini, 2020/09/19
- [PULL 14/57] acpi: i386: Move VMBus DSDT entry to SB, Paolo Bonzini, 2020/09/19
- [PULL 13/57] Simplify the .gitignore file, Paolo Bonzini, 2020/09/19
- [PULL 15/57] numa: drop support for '-numa node' (without memory specified), Paolo Bonzini, 2020/09/19