Skip to contentSkip to conversation

tcm_vhost/virtio-scsi WIP code for-3.6

PATCH Superseded Nicholas A. Bellinger 8 participants 57 messages Jul 4, 2012 – Jul 10, 2012

Subsystems (5)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover tcm_vhost/virtio-scsi WIP code for-3.6

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

Please have a look vhost + virtio-scsi folks (mst + paolo CC'ed) and let us know if you have any concerns.

Thanks!

--nab

Nicholas Bellinger (4):
vhost: Add vhost_scsi specific defines
tcm_vhost: Initial merge for vhost level target fabric driver
virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN
scanning
virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

Stefan Hajnoczi (2):
vhost: Separate vhost-net features from vhost features
vhost: make vhost work queue visible

 drivers/scsi/virtio_scsi.c |   20 +-
 drivers/vhost/Kconfig      |    6 +
 drivers/vhost/Makefile     |    1 +
 drivers/vhost/net.c        |    4 +-
 drivers/vhost/tcm_vhost.c  | 1592 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/vhost/tcm_vhost.h  |   70 ++
 drivers/vhost/vhost.c      |    5 +-
 drivers/vhost/vhost.h      |    6 +-
 drivers/virtio/virtio.c    |    5 +-
 include/linux/vhost.h      |    9 +
 include/linux/virtio.h     |    1 +
 11 files changed, 1708 insertions(+), 11 deletions(-)
 create mode 100644 drivers/vhost/tcm_vhost.c
 create mode 100644 drivers/vhost/tcm_vhost.h
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 1/6 vhost: Separate vhost-net features from vhost features

From: Stefan Hajnoczi <[email protected]>

In order for other vhost devices to use the VHOST_FEATURES bits the vhost-net specific bits need to be moved to their own VHOST_NET_FEATURES constant.

Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 drivers/vhost/net.c   |    4 ++--
 drivers/vhost/vhost.h |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/vhost/net.c +2 -2
index f82a739..072cbba 100644
@@ -823,14 +823,14 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
 			return -EFAULT;
 		return vhost_net_set_backend(n, backend.index, backend.fd);
 	case VHOST_GET_FEATURES:
-		features = VHOST_FEATURES;
+		features = VHOST_NET_FEATURES;
 		if (copy_to_user(featurep, &features, sizeof features))
 			return -EFAULT;
 		return 0;
 	case VHOST_SET_FEATURES:
 		if (copy_from_user(&features, featurep, sizeof features))
 			return -EFAULT;
-		if (features & ~VHOST_FEATURES)
+		if (features & ~VHOST_NET_FEATURES)
 			return -EOPNOTSUPP;
 		return vhost_net_set_features(n, features);
 	case VHOST_RESET_OWNER:
drivers/vhost/vhost.h +2 -1
index 8de1fd5..07b9763 100644
@@ -201,7 +201,8 @@ enum {
 	VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |
 			 (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
 			 (1ULL << VIRTIO_RING_F_EVENT_IDX) |
-			 (1ULL << VHOST_F_LOG_ALL) |
+			 (1ULL << VHOST_F_LOG_ALL),
+	VHOST_NET_FEATURES = VHOST_FEATURES |
 			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
 			 (1ULL << VIRTIO_NET_F_MRG_RXBUF),
 };
Signature · 1 line
1.7.2.5
#3 lore raw

PATCH 2/6 vhost: make vhost work queue visible

In reply to Nicholas A. Bellinger

From: Stefan Hajnoczi <[email protected]>

The vhost work queue allows processing to be done in vhost worker thread context, which uses the owner process mm. Access to the vring and guest memory is typically only possible from vhost worker context so it is useful to allow work to be queued directly by users.

Currently vhost_net only uses the poll wrappers which do not expose the work queue functions. However, for tcm_vhost (vhost_scsi) it will be necessary to queue custom work.

Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 drivers/vhost/vhost.c |    5 ++---
 drivers/vhost/vhost.h |    3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/vhost/vhost.c +2 -3
index 94dbd25..1aab08b 100644
@@ -64,7 +64,7 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync,
 	return 0;
 }
 
-static void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
+void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
 {
 	INIT_LIST_HEAD(&work->node);
 	work->fn = fn;
@@ -137,8 +137,7 @@ void vhost_poll_flush(struct vhost_poll *poll)
 	vhost_work_flush(poll->dev, &poll->work);
 }
 
-static inline void vhost_work_queue(struct vhost_dev *dev,
-				    struct vhost_work *work)
+void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 {
 	unsigned long flags;
 
drivers/vhost/vhost.h +3 -0
index 07b9763..1125af3 100644
@@ -43,6 +43,9 @@ struct vhost_poll {
 	struct vhost_dev	 *dev;
 };
 
+void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
+void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
+
 void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
 		     unsigned long mask, struct vhost_dev *dev);
 void vhost_poll_start(struct vhost_poll *poll, struct file *file);
Signature · 1 line
1.7.2.5
#4 lore raw

PATCH 2/6 vhost: make vhost work queue visible

In reply to Nicholas A. Bellinger

From: Stefan Hajnoczi <[email protected]>

The vhost work queue allows processing to be done in vhost worker thread context, which uses the owner process mm. Access to the vring and guest memory is typically only possible from vhost worker context so it is useful to allow work to be queued directly by users.

Currently vhost_net only uses the poll wrappers which do not expose the work queue functions. However, for tcm_vhost (vhost_scsi) it will be necessary to queue custom work.

Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 drivers/vhost/vhost.c |    5 ++---
 drivers/vhost/vhost.h |    3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/vhost/vhost.c +2 -3
index 94dbd25..1aab08b 100644
@@ -64,7 +64,7 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync,
 	return 0;
 }
 
-static void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
+void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
 {
 	INIT_LIST_HEAD(&work->node);
 	work->fn = fn;
@@ -137,8 +137,7 @@ void vhost_poll_flush(struct vhost_poll *poll)
 	vhost_work_flush(poll->dev, &poll->work);
 }
 
-static inline void vhost_work_queue(struct vhost_dev *dev,
-				    struct vhost_work *work)
+void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 {
 	unsigned long flags;
 
drivers/vhost/vhost.h +3 -0
index 07b9763..1125af3 100644
@@ -43,6 +43,9 @@ struct vhost_poll {
 	struct vhost_dev	 *dev;
 };
 
+void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
+void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
+
 void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
 		     unsigned long mask, struct vhost_dev *dev);
 void vhost_poll_start(struct vhost_poll *poll, struct file *file);
Signature · 1 line
1.7.2.5
#5 lore raw

PATCH 3/6 vhost: Add vhost_scsi specific defines

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch adds the initial vhost_scsi_ioctl() callers for VHOST_SCSI_SET_ENDPOINT and VHOST_SCSI_CLEAR_ENDPOINT respectively, and also adds struct vhost_vring_target that is used by tcm_vhost code when locating target ports during qemu setup.

Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>,
---
 include/linux/vhost.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
include/linux/vhost.h +9 -0
index e847f1e..33b313b 100644
@@ -24,7 +24,11 @@ struct vhost_vring_state {
 struct vhost_vring_file {
 	unsigned int index;
 	int fd; /* Pass -1 to unbind from file. */
+};
 
+struct vhost_vring_target {
+	unsigned char vhost_wwpn[224];
+	unsigned short vhost_tpgt;
 };
 
 struct vhost_vring_addr {
@@ -121,6 +125,11 @@ struct vhost_memory {
  * device.  This can be used to stop the ring (e.g. for migration). */
 #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
 
+/* VHOST_SCSI specific defines */
+
+#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_vring_target)
+#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_vring_target)
+
 /* Feature bits */
 /* Log all write descriptors. Can be changed while device is active. */
 #define VHOST_F_LOG_ALL 26
Signature · 1 line
1.7.2.5
#6 lore raw

PATCH 3/6 vhost: Add vhost_scsi specific defines

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch adds the initial vhost_scsi_ioctl() callers for VHOST_SCSI_SET_ENDPOINT and VHOST_SCSI_CLEAR_ENDPOINT respectively, and also adds struct vhost_vring_target that is used by tcm_vhost code when locating target ports during qemu setup.

Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>,
---
 include/linux/vhost.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
include/linux/vhost.h +9 -0
index e847f1e..33b313b 100644
@@ -24,7 +24,11 @@ struct vhost_vring_state {
 struct vhost_vring_file {
 	unsigned int index;
 	int fd; /* Pass -1 to unbind from file. */
+};
 
+struct vhost_vring_target {
+	unsigned char vhost_wwpn[224];
+	unsigned short vhost_tpgt;
 };
 
 struct vhost_vring_addr {
@@ -121,6 +125,11 @@ struct vhost_memory {
  * device.  This can be used to stop the ring (e.g. for migration). */
 #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
 
+/* VHOST_SCSI specific defines */
+
+#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_vring_target)
+#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_vring_target)
+
 /* Feature bits */
 /* Log all write descriptors. Can be changed while device is active. */
 #define VHOST_F_LOG_ALL 26
Signature · 1 line
1.7.2.5
#7 lore raw

PATCH 4/6 tcm_vhost: Initial merge for vhost level target fabric driver

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch adds the initial code for tcm_vhost, a Vhost level TCM fabric driver for virtio SCSI initiators into KVM guest.

This code is currently up and running on v3.5-rc2 host+guest along with the virtio-scsi vdev->scan() patch to allow a proper scsi_scan_host() to occur once the tcm_vhost nexus has been established by the paravirtualized virtio-scsi client.

(nab: Merge into single source + header file, and move to drivers/vhost/)

Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Jens Axboe <[email protected]>
---
 drivers/vhost/Kconfig     |    6 +
 drivers/vhost/Makefile    |    1 +
 drivers/vhost/tcm_vhost.c | 1592 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/vhost/tcm_vhost.h |   70 ++
 4 files changed, 1669 insertions(+), 0 deletions(-)
 create mode 100644 drivers/vhost/tcm_vhost.c
 create mode 100644 drivers/vhost/tcm_vhost.h
drivers/vhost/Kconfig +6 -0
index e4e2fd1..a8642e2 100644
@@ -9,3 +9,9 @@ config VHOST_NET
 	  To compile this driver as a module, choose M here: the module will
 	  be called vhost_net.
 
+config TCM_VHOST
+	tristate "TCM_VHOST fabric module (EXPERIMENTAL)"
+	depends on TARGET_CORE && EVENTFD && EXPERINETAL && m
+	default n
+	---help---
+	Say M here to enable the TCM_VHOST fabric module for use with virtio-scsi guests
drivers/vhost/Makefile +1 -0
index 72dd020..b10c7b1 100644
@@ -1,2 +1,3 @@
 obj-$(CONFIG_VHOST_NET) += vhost_net.o
+obj-$(CONFIG_TCM_VHOST) += tcm_vhost.o
 vhost_net-y := vhost.o net.o
drivers/vhost/tcm_vhost.c new file +1592 -0

1,592 lines not on this page · raw message

drivers/vhost/tcm_vhost.h new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#12 lore raw

PATCH 4/6 tcm_vhost: Initial merge for vhost level target fabric driver

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch adds the initial code for tcm_vhost, a Vhost level TCM fabric driver for virtio SCSI initiators into KVM guest.

This code is currently up and running on v3.5-rc2 host+guest along with the virtio-scsi vdev->scan() patch to allow a proper scsi_scan_host() to occur once the tcm_vhost nexus has been established by the paravirtualized virtio-scsi client.

(nab: Merge into single source + header file, and move to drivers/vhost/)

Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Jens Axboe <[email protected]>
---
 drivers/vhost/Kconfig     |    6 +
 drivers/vhost/Makefile    |    1 +
 drivers/vhost/tcm_vhost.c | 1592 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/vhost/tcm_vhost.h |   70 ++
 4 files changed, 1669 insertions(+), 0 deletions(-)
 create mode 100644 drivers/vhost/tcm_vhost.c
 create mode 100644 drivers/vhost/tcm_vhost.h
drivers/vhost/Kconfig +6 -0
index e4e2fd1..a8642e2 100644
@@ -9,3 +9,9 @@ config VHOST_NET
 	  To compile this driver as a module, choose M here: the module will
 	  be called vhost_net.
 
+config TCM_VHOST
+	tristate "TCM_VHOST fabric module (EXPERIMENTAL)"
+	depends on TARGET_CORE && EVENTFD && EXPERINETAL && m
+	default n
+	---help---
+	Say M here to enable the TCM_VHOST fabric module for use with virtio-scsi guests
drivers/vhost/Makefile +1 -0
index 72dd020..b10c7b1 100644
@@ -1,2 +1,3 @@
 obj-$(CONFIG_VHOST_NET) += vhost_net.o
+obj-$(CONFIG_TCM_VHOST) += tcm_vhost.o
 vhost_net-y := vhost.o net.o
drivers/vhost/tcm_vhost.c new file +1592 -0

1,592 lines not on this page · raw message

drivers/vhost/tcm_vhost.h new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#13 lore raw

PATCH 5/6 virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch changes virtio-scsi to use a new virtio_driver->scan() callback so that scsi_scan_host() can be properly invoked once virtio_dev_probe() has set add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK) to signal active virtio-ring operation, instead of from within virtscsi_probe().

This fixes a bug where SCSI LUN scanning for both virtio-scsi-raw and virtio-scsi/tcm_vhost setups was happening before VIRTIO_CONFIG_S_DRIVER_OK had been set, causing VIRTIO_SCSI_S_BAD_TARGET to occur. This fixes a bug with virtio-scsi/tcm_vhost where LUN scan was not detecting LUNs.

Tested with virtio-scsi-raw + virtio-scsi/tcm_vhost w/ IBLOCK on 3.5-rc2 code.

Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/scsi/virtio_scsi.c |   15 ++++++++++++---
 drivers/virtio/virtio.c    |    5 ++++-
 include/linux/virtio.h     |    1 +
 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/virtio_scsi.c +12 -3
index 1b38431..391b30d 100644
@@ -481,9 +481,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	err = scsi_add_host(shost, &vdev->dev);
 	if (err)
 		goto scsi_add_host_failed;
-
-	scsi_scan_host(shost);
-
+	/*
+	 * scsi_scan_host() happens in virtscsi_scan() via virtio_driver->scan()
+	 * after VIRTIO_CONFIG_S_DRIVER_OK has been set..
+	 */
 	return 0;
 
 scsi_add_host_failed:
@@ -493,6 +494,13 @@ virtscsi_init_failed:
 	return err;
 }
 
+static void virtscsi_scan(struct virtio_device *vdev)
+{
+	struct Scsi_Host *shost = (struct Scsi_Host *)vdev->priv;
+
+	scsi_scan_host(shost);
+}
+
 static void virtscsi_remove_vqs(struct virtio_device *vdev)
 {
 	/* Stop all the virtqueues. */
@@ -537,6 +545,7 @@ static struct virtio_driver virtio_scsi_driver = {
 	.driver.owner = THIS_MODULE,
 	.id_table = id_table,
 	.probe = virtscsi_probe,
+	.scan = virtscsi_scan,
 #ifdef CONFIG_PM
 	.freeze = virtscsi_freeze,
 	.restore = virtscsi_restore,
drivers/virtio/virtio.c +4 -1
index f355807..c3b3f7f 100644
@@ -141,8 +141,11 @@ static int virtio_dev_probe(struct device *_d)
 	err = drv->probe(dev);
 	if (err)
 		add_status(dev, VIRTIO_CONFIG_S_FAILED);
-	else
+	else {
 		add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
+		if (drv->scan)
+			drv->scan(dev);
+	}
 
 	return err;
 }
include/linux/virtio.h +1 -0
index 8efd28a..a1ba8bb 100644
@@ -92,6 +92,7 @@ struct virtio_driver {
 	const unsigned int *feature_table;
 	unsigned int feature_table_size;
 	int (*probe)(struct virtio_device *dev);
+	void (*scan)(struct virtio_device *dev);
 	void (*remove)(struct virtio_device *dev);
 	void (*config_changed)(struct virtio_device *dev);
 #ifdef CONFIG_PM
Signature · 1 line
1.7.2.5
#15 lore raw

PATCH 5/6 virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch changes virtio-scsi to use a new virtio_driver->scan() callback so that scsi_scan_host() can be properly invoked once virtio_dev_probe() has set add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK) to signal active virtio-ring operation, instead of from within virtscsi_probe().

This fixes a bug where SCSI LUN scanning for both virtio-scsi-raw and virtio-scsi/tcm_vhost setups was happening before VIRTIO_CONFIG_S_DRIVER_OK had been set, causing VIRTIO_SCSI_S_BAD_TARGET to occur. This fixes a bug with virtio-scsi/tcm_vhost where LUN scan was not detecting LUNs.

Tested with virtio-scsi-raw + virtio-scsi/tcm_vhost w/ IBLOCK on 3.5-rc2 code.

Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/scsi/virtio_scsi.c |   15 ++++++++++++---
 drivers/virtio/virtio.c    |    5 ++++-
 include/linux/virtio.h     |    1 +
 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/virtio_scsi.c +12 -3
index 1b38431..391b30d 100644
@@ -481,9 +481,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	err = scsi_add_host(shost, &vdev->dev);
 	if (err)
 		goto scsi_add_host_failed;
-
-	scsi_scan_host(shost);
-
+	/*
+	 * scsi_scan_host() happens in virtscsi_scan() via virtio_driver->scan()
+	 * after VIRTIO_CONFIG_S_DRIVER_OK has been set..
+	 */
 	return 0;
 
 scsi_add_host_failed:
@@ -493,6 +494,13 @@ virtscsi_init_failed:
 	return err;
 }
 
+static void virtscsi_scan(struct virtio_device *vdev)
+{
+	struct Scsi_Host *shost = (struct Scsi_Host *)vdev->priv;
+
+	scsi_scan_host(shost);
+}
+
 static void virtscsi_remove_vqs(struct virtio_device *vdev)
 {
 	/* Stop all the virtqueues. */
@@ -537,6 +545,7 @@ static struct virtio_driver virtio_scsi_driver = {
 	.driver.owner = THIS_MODULE,
 	.id_table = id_table,
 	.probe = virtscsi_probe,
+	.scan = virtscsi_scan,
 #ifdef CONFIG_PM
 	.freeze = virtscsi_freeze,
 	.restore = virtscsi_restore,
drivers/virtio/virtio.c +4 -1
index f355807..c3b3f7f 100644
@@ -141,8 +141,11 @@ static int virtio_dev_probe(struct device *_d)
 	err = drv->probe(dev);
 	if (err)
 		add_status(dev, VIRTIO_CONFIG_S_FAILED);
-	else
+	else {
 		add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
+		if (drv->scan)
+			drv->scan(dev);
+	}
 
 	return err;
 }
include/linux/virtio.h +1 -0
index 8efd28a..a1ba8bb 100644
@@ -92,6 +92,7 @@ struct virtio_driver {
 	const unsigned int *feature_table;
 	unsigned int feature_table_size;
 	int (*probe)(struct virtio_device *dev);
+	void (*scan)(struct virtio_device *dev);
 	void (*remove)(struct virtio_device *dev);
 	void (*config_changed)(struct virtio_device *dev);
 #ifdef CONFIG_PM
Signature · 1 line
1.7.2.5
#16 lore raw

PATCH 6/6 virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This is currently required for connecting to tcm_vhost in order to prevent the client LUN scan from detecting the same tcm_vhost WWPN on multiple target IDs.

Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/scsi/virtio_scsi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/virtio_scsi.c +4 -1
index 391b30d..8711951 100644
@@ -475,7 +475,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);
 	shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
 	shost->max_lun = virtscsi_config_get(vdev, max_lun) + 1;
-	shost->max_id = virtscsi_config_get(vdev, max_target) + 1;
+	/*
+	 * Currently required for tcm_vhost to function..
+	 */
+	shost->max_id = 1;
 	shost->max_channel = 0;
 	shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE;
 	err = scsi_add_host(shost, &vdev->dev);
Signature · 1 line
1.7.2.5
#20 lore raw

PATCH 6/6 virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This is currently required for connecting to tcm_vhost in order to prevent the client LUN scan from detecting the same tcm_vhost WWPN on multiple target IDs.

Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/scsi/virtio_scsi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/virtio_scsi.c +4 -1
index 391b30d..8711951 100644
@@ -475,7 +475,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);
 	shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
 	shost->max_lun = virtscsi_config_get(vdev, max_lun) + 1;
-	shost->max_id = virtscsi_config_get(vdev, max_target) + 1;
+	/*
+	 * Currently required for tcm_vhost to function..
+	 */
+	shost->max_id = 1;
 	shost->max_channel = 0;
 	shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE;
 	err = scsi_add_host(shost, &vdev->dev);
Signature · 1 line
1.7.2.5
#2 lore raw

Re: [PATCH 1/6] vhost: Separate vhost-net features from vhost features

In reply to Nicholas A. Bellinger
Quoted 11 lines · Nicholas A. Bellinger

From: Stefan Hajnoczi <[email protected]>

In order for other vhost devices to use the VHOST_FEATURES bits the vhost-net specific bits need to be moved to their own VHOST_NET_FEATURES constant.

Cc Zhi Yong Wu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Paolo Bonzini <[email protected]>

I think you need to change drivers/vhost/test.c as well.

drivers/vhost/test.c +2 -2
index 3de00d9..91d6f06 100644
@@ -261,14 +261,14 @@ static long vhost_test_ioctl(struct file *f, unsigned int ioctl,
                        return -EFAULT;
                return vhost_test_run(n, test);
        case VHOST_GET_FEATURES:
-               features = VHOST_FEATURES;
+               features = VHOST_NET_FEATURES;
                if (copy_to_user(featurep, &features, sizeof features))
                        return -EFAULT;
                return 0;
        case VHOST_SET_FEATURES:
                if (copy_from_user(&features, featurep, sizeof features))
                        return -EFAULT;
-               if (features & ~VHOST_FEATURES)
+               if (features & ~VHOST_NET_FEATURES)
                        return -EOPNOTSUPP;
                return vhost_test_set_features(n, features);
        case VHOST_RESET_OWNER:
Quoted 41 lines
---
  drivers/vhost/net.c   |    4 ++--
  drivers/vhost/vhost.h |    3 ++-
  2 files changed, 4 insertions(+), 3 deletions(-)
drivers/vhost/net.c +2 -2
index f82a739..072cbba 100644
@@ -823,14 +823,14 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
  			return -EFAULT;
  		return vhost_net_set_backend(n, backend.index, backend.fd);
  	case VHOST_GET_FEATURES:
-		features = VHOST_FEATURES;
+		features = VHOST_NET_FEATURES;
  		if (copy_to_user(featurep, &features, sizeof features))
  			return -EFAULT;
  		return 0;
  	case VHOST_SET_FEATURES:
  		if (copy_from_user(&features, featurep, sizeof features))
  			return -EFAULT;
-		if (features & ~VHOST_FEATURES)
+		if (features & ~VHOST_NET_FEATURES)
  			return -EOPNOTSUPP;
  		return vhost_net_set_features(n, features);
  	case VHOST_RESET_OWNER:
drivers/vhost/vhost.h +2 -1
index 8de1fd5..07b9763 100644
@@ -201,7 +201,8 @@ enum {
  	VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |
  			 (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
  			 (1ULL << VIRTIO_RING_F_EVENT_IDX) |
-			 (1ULL << VHOST_F_LOG_ALL) |
+			 (1ULL << VHOST_F_LOG_ALL),
+	VHOST_NET_FEATURES = VHOST_FEATURES |
  			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
  			 (1ULL << VIRTIO_NET_F_MRG_RXBUF),
  };
Signature · 1 line
Asias
#21 lore raw
In reply to Nicholas A. Bellinger
Quoted 19 lines · Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

Quoted 6 lines
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

OK so this is an RFC, not for merge yet?

Quoted 35 lines

Please have a look vhost + virtio-scsi folks (mst + paolo CC'ed) and let us know if you have any concerns.

Thanks!

--nab
Nicholas Bellinger (4):
vhost: Add vhost_scsi specific defines
tcm_vhost: Initial merge for vhost level target fabric driver
virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN
scanning
virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

Stefan Hajnoczi (2):
vhost: Separate vhost-net features from vhost features
vhost: make vhost work queue visible

 drivers/scsi/virtio_scsi.c |   20 +-
 drivers/vhost/Kconfig      |    6 +
 drivers/vhost/Makefile     |    1 +
 drivers/vhost/net.c        |    4 +-
 drivers/vhost/tcm_vhost.c  | 1592 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/vhost/tcm_vhost.h  |   70 ++
 drivers/vhost/vhost.c      |    5 +-
 drivers/vhost/vhost.h      |    6 +-
 drivers/virtio/virtio.c    |    5 +-
 include/linux/vhost.h      |    9 +
 include/linux/virtio.h     |    1 +
 11 files changed, 1708 insertions(+), 11 deletions(-)
 create mode 100644 drivers/vhost/tcm_vhost.c
 create mode 100644 drivers/vhost/tcm_vhost.h
Signature · 1 line
1.7.2.5
maintainer Reviewed-by on v1 5/6
#14 lore raw

Re: [PATCH 5/6] virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

In reply to Nicholas A. Bellinger

Il 04/07/2012 06:24, Nicholas A. Bellinger ha scritto:

Quoted 12 lines

From: Nicholas Bellinger <[email protected]>

This patch changes virtio-scsi to use a new virtio_driver->scan() callback so that scsi_scan_host() can be properly invoked once virtio_dev_probe() has set add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK) to signal active virtio-ring operation, instead of from within virtscsi_probe().

This fixes a bug where SCSI LUN scanning for both virtio-scsi-raw and virtio-scsi/tcm_vhost setups was happening before VIRTIO_CONFIG_S_DRIVER_OK had been set, causing VIRTIO_SCSI_S_BAD_TARGET to occur. This fixes a bug with virtio-scsi/tcm_vhost where LUN scan was not detecting LUNs.

Quoted 8 lines

Tested with virtio-scsi-raw + virtio-scsi/tcm_vhost w/ IBLOCK on 3.5-rc2 code.

Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>

Please send this independently. I think we also want it in stable@vger?

Paolo

Quoted 76 lines
---
 drivers/scsi/virtio_scsi.c |   15 ++++++++++++---
 drivers/virtio/virtio.c    |    5 ++++-
 include/linux/virtio.h     |    1 +
 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/virtio_scsi.c +12 -3
index 1b38431..391b30d 100644
@@ -481,9 +481,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	err = scsi_add_host(shost, &vdev->dev);
 	if (err)
 		goto scsi_add_host_failed;
-
-	scsi_scan_host(shost);
-
+	/*
+	 * scsi_scan_host() happens in virtscsi_scan() via virtio_driver->scan()
+	 * after VIRTIO_CONFIG_S_DRIVER_OK has been set..
+	 */
 	return 0;
 
 scsi_add_host_failed:
@@ -493,6 +494,13 @@ virtscsi_init_failed:
 	return err;
 }
 
+static void virtscsi_scan(struct virtio_device *vdev)
+{
+	struct Scsi_Host *shost = (struct Scsi_Host *)vdev->priv;
+
+	scsi_scan_host(shost);
+}
+
 static void virtscsi_remove_vqs(struct virtio_device *vdev)
 {
 	/* Stop all the virtqueues. */
@@ -537,6 +545,7 @@ static struct virtio_driver virtio_scsi_driver = {
 	.driver.owner = THIS_MODULE,
 	.id_table = id_table,
 	.probe = virtscsi_probe,
+	.scan = virtscsi_scan,
 #ifdef CONFIG_PM
 	.freeze = virtscsi_freeze,
 	.restore = virtscsi_restore,
drivers/virtio/virtio.c +4 -1
index f355807..c3b3f7f 100644
@@ -141,8 +141,11 @@ static int virtio_dev_probe(struct device *_d)
 	err = drv->probe(dev);
 	if (err)
 		add_status(dev, VIRTIO_CONFIG_S_FAILED);
-	else
+	else {
 		add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
+		if (drv->scan)
+			drv->scan(dev);
+	}
 
 	return err;
 }
include/linux/virtio.h +1 -0
index 8efd28a..a1ba8bb 100644
@@ -92,6 +92,7 @@ struct virtio_driver {
 	const unsigned int *feature_table;
 	unsigned int feature_table_size;
 	int (*probe)(struct virtio_device *dev);
+	void (*scan)(struct virtio_device *dev);
 	void (*remove)(struct virtio_device *dev);
 	void (*config_changed)(struct virtio_device *dev);
 #ifdef CONFIG_PM
maintainer
#17 lore raw

Re: [PATCH 6/6] virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

In reply to Nicholas A. Bellinger

Il 04/07/2012 06:24, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

From: Nicholas Bellinger <[email protected]>

This is currently required for connecting to tcm_vhost in order to prevent the client LUN scan from detecting the same tcm_vhost WWPN on multiple target IDs.

But that's what the config field is for... why can't tcm_vhost (or QEMU) set max_id to 0?

Paolo

Quoted 27 lines
Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/scsi/virtio_scsi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/virtio_scsi.c +4 -1
index 391b30d..8711951 100644
@@ -475,7 +475,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);
 	shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
 	shost->max_lun = virtscsi_config_get(vdev, max_lun) + 1;
-	shost->max_id = virtscsi_config_get(vdev, max_target) + 1;
+	/*
+	 * Currently required for tcm_vhost to function..
+	 */
+	shost->max_id = 1;
 	shost->max_channel = 0;
 	shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE;
 	err = scsi_add_host(shost, &vdev->dev);
maintainer
#22 lore raw
In reply to Michael S. Tsirkin

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 20 lines · Nicholas A. Bellinger
Quoted 19 lines

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

Quoted 8 lines
Quoted 6 lines
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

OK so this is an RFC, not for merge yet?

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

#23 lore raw
Quoted 28 lines · Paolo Bonzini

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 27 lines · Nicholas A. Bellinger
Quoted 25 lines

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

Quoted 5 lines
Quoted 1 line

OK so this is an RFC, not for merge yet?

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

I was talking about 4/6 first of all.
Anyway, it's best to split, not to mix RFCs and fixes.

Signature · 1 line
MST
#24 lore raw
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Paolo Bonzini

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 27 lines · Nicholas A. Bellinger
Quoted 25 lines

From: Nicholas Bellinger<[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost<-> virtio-scsi connected hosts<-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

    http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
    http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

OK so this is an RFC, not for merge yet?

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

I was talking about 4/6 first of all.
Anyway, it's best to split, not to mix RFCs and fixes.

What is the use-case that we're targeting for this?

I certainly think it's fine to merge this into the kernel... maybe something will use it. But I'm pretty opposed to taking support for this into QEMU. It's going to create more problems than it solves specifically because I have no idea what problem it actually solves.

We cannot avoid doing better SCSI emulation in QEMU. That cannot be a long term strategy on our part and vhost-scsi isn't going to solve that problem for us.

Regards,

Anthony Liguori

#25 lore raw

Hi Anthony & Co,

Quoted 32 lines · Anthony Liguori
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Paolo Bonzini

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 28 lines · Nicholas A. Bellinger
Quoted 19 lines

From: Nicholas Bellinger<[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost<-> virtio-scsi connected hosts<-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

Quoted 6 lines
    http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
    http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

OK so this is an RFC, not for merge yet?

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

I was talking about 4/6 first of all.
Anyway, it's best to split, not to mix RFCs and fixes.

What is the use-case that we're targeting for this?

The first use case is high performance small block random IO access into KVM guest from IBLOCK/FILEIO + pSCSI passthrough backends. (see below)

The second use case is shared storage access across multiple KVM guests using TCM level SPC-3 persistent reservations + ALUA multipath logic.

The third use case is future DIF support within virtio-scsi supported guests that we connect directly to tcm_vhost.

Quoted 5 lines

I certainly think it's fine to merge this into the kernel... maybe something will use it. But I'm pretty opposed to taking support for this into QEMU. It's going to create more problems than it solves specifically because I have no idea what problem it actually solves.

To give an idea of how things are looking on the performance side, here some initial numbers for small block (4k) mixed random IOPs using the following fio test setup:

[randrw]
rw=randrw
rwmixwrite=25
rwmixread=75
size=131072m
ioengine=libaio
direct=1
iodepth=64
blocksize=4k
filename=/dev/sdb

The backend is a single iomemory_vsl (FusionIO) raw flash block_device using IBLOCK w/ emulate_write_cache=1 set. Also note the noop scheduler has been set with virtio-scsi LUNs. Here are the QEMU cli opts for both cases:

./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -smp 2 -m 2048 -serial file:/tmp/vhost-serial.txt -hda debian_squeeze_amd64_standard-old.qcow2 -vhost-scsi id=vhost-scsi0,wwpn=naa.600140579ad21088,tpgt=1 -device virtio-scsi-pci,vhost-scsi=vhost-scsi0,event_idx=off

./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -smp 4 -m 2048 -serial file:/tmp/vhost-serial.txt -hda debian_squeeze_amd64_standard-old.qcow2 -drive file=/dev/fioa,format=raw,if=none,id=sdb,cache=none,aio=native -device virtio-scsi-pci,id=mcbus -device scsi-disk,drive=sdb

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

In the first case, virtio-scsi+tcm_vhost is out performing by 3x compared to virtio-scsi-raw using QEMU SCSI emulation with the same raw flash backend device. For the second case heavier WRITE case, tcm_vhost is nearing full bare-metal utilization (~55K vs. ~60K).

Also converting tcm_vhost to use proper cmwq process context I/O submission will help to get even closer to bare metal speeds for both work-loads.

Quoted 3 lines

We cannot avoid doing better SCSI emulation in QEMU. That cannot be a long term strategy on our part and vhost-scsi isn't going to solve that problem for us.

Yes, QEMU needs a sane level of host OS independent functional SCSI emulation, I don't think that is the interesting point up for debate here.. ;)

I think performance wise it's now pretty clear that vhost is outperforming QEMU block with virtio-scsi for intestive small block randrw workloads. When connected to raw block flash backends where we avoid the SCSI LLD bottleneck for small block random I/O on the KVM host all-together, the difference between the two case is even larger based upon these initial benchmarks.

Thanks for your comments!

--nab

#53 lore raw
In reply to Michael S. Tsirkin
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Paolo Bonzini

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 27 lines · Nicholas A. Bellinger
Quoted 25 lines

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

OK so this is an RFC, not for merge yet?

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

I was talking about 4/6 first of all.

So yeah, this code is still considered RFC at this point for-3.6, but I'd like to get this into target-pending/for-next in next week for more feedback and start collecting signoffs for the necessary pieces that effect existing vhost code.

By that time the cmwq conversion of tcm_vhost should be in place as well..

Quoted 2 lines

Anyway, it's best to split, not to mix RFCs and fixes.

<nod>, I'll send patch #5 separately to linux-scsi -> James and CC stable following Paolo's request.

Thanks!

--nab

#56 lore raw
In reply to Michael S. Tsirkin
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Paolo Bonzini

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 27 lines · Nicholas A. Bellinger
Quoted 25 lines

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

OK so this is an RFC, not for merge yet?

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

I was talking about 4/6 first of all.

So yeah, this code is still considered RFC at this point for-3.6, but I'd like to get this into target-pending/for-next in next week for more feedback and start collecting signoffs for the necessary pieces that effect existing vhost code.

By that time the cmwq conversion of tcm_vhost should be in place as well..

Quoted 2 lines

Anyway, it's best to split, not to mix RFCs and fixes.

<nod>, I'll send patch #5 separately to linux-scsi -> James and CC stable following Paolo's request.

Thanks!

--nab

#18 lore raw

Re: [PATCH 6/6] virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini

Il 04/07/2012 06:24, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

From: Nicholas Bellinger <[email protected]>

This is currently required for connecting to tcm_vhost in order to prevent the client LUN scan from detecting the same tcm_vhost WWPN on multiple target IDs.

But that's what the config field is for... why can't tcm_vhost (or QEMU) set max_id to 0?

So this patch was carried forward from Stefan's original code that I thought was required due to other limitations..

If that's not the case anymore I'm happy to drop it for now and look into a proper fix outside of virtio-scsi.

Quoted 35 lines

Paolo

Quoted 17 lines
Cc Paolo Bonzini <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Zhi Yong Wu <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/scsi/virtio_scsi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/virtio_scsi.c +0 -0
index 391b30d..8711951 100644
@@ -475,7 +475,10 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev)
 	shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);

drivers/scsi/virtio_scsi.c static int __devinit virtscsi_probe(struct virtio_device *vdev) · line 484

Quoted 10 lines
drivers/scsi/virtio_scsi.c +4 -1
 	shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
 	shost->max_lun = virtscsi_config_get(vdev, max_lun) + 1;
-	shost->max_id = virtscsi_config_get(vdev, max_target) + 1;
+	/*
+	 * Currently required for tcm_vhost to function..
+	 */
+	shost->max_id = 1;
 	shost->max_channel = 0;
 	shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE;
 	err = scsi_add_host(shost, &vdev->dev);

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#19 lore raw

Re: [PATCH 6/6] virtio-scsi: Set shost->max_id=1 for tcm_vhost WWPNs

Il 05/07/2012 04:05, Nicholas A. Bellinger ha scritto:

Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

But that's what the config field is for... why can't tcm_vhost (or QEMU) set max_id to 0?

So this patch was carried forward from Stefan's original code that I thought was required due to other limitations..

If that's not the case anymore I'm happy to drop it for now and look into a proper fix outside of virtio-scsi.

I think max_id did not exist in the virtio-scsi configuration at the time Stefan was working on it.

Paolo

#54 lore raw
In reply to Nicholas A. Bellinger
Quoted 38 lines · Nicholas A. Bellinger
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Paolo Bonzini

Il 04/07/2012 16:02, Michael S. Tsirkin ha scritto:

Quoted 27 lines · Nicholas A. Bellinger
Quoted 25 lines

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series contains patches required to update tcm_vhost <-> virtio-scsi connected hosts <-> guests to run on v3.5-rc2 mainline code. This series is available on top of target-pending/auto-next here:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost

This includes the necessary vhost changes from Stefan to to get tcm_vhost functioning, along a virtio-scsi LUN scanning change to address a client bug with tcm_vhost I ran into.. Also, tcm_vhost driver has been merged into a single source + header file that is now living under /drivers/vhost/, along with latest tcm_vhost changes from Zhi's tcm_vhost tree.

Here are a couple of screenshots of the code in action using raw IBLOCK backends provided by FusionIO ioDrive Duo:

   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-3.png
   http://linux-iscsi.org/images/Virtio-scsi-tcm-vhost-3.5-rc2-4.png

So the next steps on my end will be converting tcm_vhost to submit backend I/O from cmwq context, along with fio benchmark numbers between tcm_vhost/virtio-scsi and virtio-scsi-raw using raw IBLOCK iomemory_vsl flash.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

OK so this is an RFC, not for merge yet?

Patch 6 definitely looks RFCish, but patch 5 should go in anyway.

Paolo

I was talking about 4/6 first of all.

Quoted 7 lines

So yeah, this code is still considered RFC at this point for-3.6, but I'd like to get this into target-pending/for-next in next week for more feedback and start collecting signoffs for the necessary pieces that effect existing vhost code.

By that time the cmwq conversion of tcm_vhost should be in place as well..

I'll try to give some feedback but I think we do need
to see the qemu patches - they weren't posted yet, were they? This driver has some userspace interface and once
that is merged it has to be supported.
So I think we need the buy-in from the qemu side at the principal level.

Quoted 9 lines
Quoted 2 lines

Anyway, it's best to split, not to mix RFCs and fixes.

<nod>, I'll send patch #5 separately to linux-scsi -> James and CC stable following Paolo's request.

Thanks!

--nab

maintainer
#26 lore raw
In reply to Nicholas A. Bellinger

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost. In my opinion, vhost-blk/vhost-scsi are mostly worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU and doesn't support -device; it (obviously) presents different inquiry/vpd/mode data than virtio-scsi-qemu, so that it is not possible to migrate one to the other.

I don't think vhost-scsi is particularly useful for virtualization, honestly. However, if it is useful for development, testing or benchmarking of lio itself (does this make any sense? :)) that could be by itself a good reason to include it.

Paolo

#27 lore raw
Quoted 7 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K
Quoted 6 lines

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost. In my opinion, vhost-blk/vhost-scsi are mostly worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

A general rant below:

OTOH if it works, and adds value, we really should consider including code. To me, it does not make sense to reject code just because in theory someone could write even better code. Code walks. Time to marker matters too. Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Quoted 1 line

and doesn't support -device;

This needs to be fixed I think.

Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed? Userspace virtio-scsi is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

Quoted 1 line

so that it is not possible to migrate one to the other.

Migration between different backend types does not seem all that useful. The general rule is you need identical flags on both sides to allow migration, and it is not clear how valuable it is to relax this somewhat.

Quoted 6 lines

I don't think vhost-scsi is particularly useful for virtualization, honestly. However, if it is useful for development, testing or benchmarking of lio itself (does this make any sense? :)) that could be by itself a good reason to include it.

Paolo

Signature · 1 line
MST
#28 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost.

We have demonstrated better results at much higher IOP rates with virtio-blk in userspace so while these results are nice, there's no reason to believe we can't do this in userspace.

Quoted 9 lines
Quoted 5 lines

In my opinion, vhost-blk/vhost-scsi are mostly
worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

A general rant below:

OTOH if it works, and adds value, we really should consider including code.

Users want something that has lots of features and performs really, really well.
They want everything.

Having one device type that is "fast" but has no features and another that is "not fast" but has a lot of features forces the user to make a bad choice. No one wins in the end.

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

Quoted 2 lines

To me, it does not make sense to reject code just because in theory someone could write even better code.

There is no theory. We have proof points with virtio-blk.

Quoted 1 line

Code walks. Time to marker matters too.

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace. We can demonstrate this with virtio-blk. This isn't a theoretical argument.

Quoted 11 lines

Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Asking a user to write a helper script is pretty awful...

Quoted 9 lines
Quoted 2 lines

and doesn't support -device;

This needs to be fixed I think.

Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed?

It's an entirely different emulation path. It's not a simple packet protocol like virtio-net. It's a complex command protocol where the backend maintains a very large amount of state.

Quoted 3 lines

Userspace virtio-scsi
is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

Basically, the issue is that the kernel has more complete SCSI emulation that QEMU does right now.

There are lots of ways to try to solve this--like try to reuse the kernel code in userspace or just improving the userspace code. If we were able to make the two paths identical, then I strongly suspect there'd be no point in having tcm_vhost anyway.

Regards,

Anthony Liguori

Quoted 15 lines
Quoted 2 lines

so that it is not possible to migrate one to the other.

Migration between different backend types does not seem all that useful. The general rule is you need identical flags on both sides to allow migration, and it is not clear how valuable it is to relax this somewhat.

Quoted 6 lines

I don't think vhost-scsi is particularly useful for virtualization, honestly. However, if it is useful for development, testing or benchmarking of lio itself (does this make any sense? :)) that could be by itself a good reason to include it.

Paolo

#43 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost.

We have demonstrated better results at much higher IOP rates with virtio-blk in userspace so while these results are nice, there's no reason to believe we can't do this in userspace.

Quoted 9 lines
Quoted 5 lines

In my opinion, vhost-blk/vhost-scsi are mostly
worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

A general rant below:

OTOH if it works, and adds value, we really should consider including code.

Users want something that has lots of features and performs really, really well.
They want everything.

Having one device type that is "fast" but has no features and another that is "not fast" but has a lot of features forces the user to make a bad choice. No one wins in the end.

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

Quoted 2 lines

To me, it does not make sense to reject code just because in theory someone could write even better code.

There is no theory. We have proof points with virtio-blk.

Quoted 1 line

Code walks. Time to marker matters too.

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace. We can demonstrate this with virtio-blk. This isn't a theoretical argument.

Quoted 11 lines

Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Asking a user to write a helper script is pretty awful...

Quoted 9 lines
Quoted 2 lines

and doesn't support -device;

This needs to be fixed I think.

Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed?

It's an entirely different emulation path. It's not a simple packet protocol like virtio-net. It's a complex command protocol where the backend maintains a very large amount of state.

Quoted 3 lines

Userspace virtio-scsi
is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

Basically, the issue is that the kernel has more complete SCSI emulation that QEMU does right now.

There are lots of ways to try to solve this--like try to reuse the kernel code in userspace or just improving the userspace code. If we were able to make the two paths identical, then I strongly suspect there'd be no point in having tcm_vhost anyway.

Regards,

Anthony Liguori

Quoted 15 lines
Quoted 2 lines

so that it is not possible to migrate one to the other.

Migration between different backend types does not seem all that useful. The general rule is you need identical flags on both sides to allow migration, and it is not clear how valuable it is to relax this somewhat.

Quoted 6 lines

I don't think vhost-scsi is particularly useful for virtualization, honestly. However, if it is useful for development, testing or benchmarking of lio itself (does this make any sense? :)) that could be by itself a good reason to include it.

Paolo

maintainer
#44 lore raw
In reply to Michael S. Tsirkin

Il 05/07/2012 15:53, Michael S. Tsirkin ha scritto:

Quoted 15 lines · Paolo Bonzini
Quoted 7 lines

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K
Quoted 6 lines

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost. In my opinion, vhost-blk/vhost-scsi are mostly worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

Quoted 5 lines

A general rant below:

OTOH if it works, and adds value, we really should consider including code. To me, it does not make sense to reject code just because in theory someone could write even better code.

It's not about writing better code. It's about having two completely separate SCSI/block layers with completely different feature sets.

Quoted 5 lines

Code walks. Time to marker matters too.
Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 7 lines
Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

We could add hooks for vhost-scsi in the SCSI devices and let them configure themselves. I'm not sure it is a good idea.

Quoted 3 lines
Quoted 1 line

and doesn't support -device;

This needs to be fixed I think.

To be clear, it supports -device for the virtio-scsi HBA itself; it doesn't support using -drive/-device to set up the disks hanging off it.

Quoted 6 lines
Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed? Userspace virtio-scsi is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

It cannot support anyway the whole feature set unless you want to port thousands of lines from the kernel to QEMU (well, perhaps we'll get there but it's far. And dually, the in-kernel target of course does not support qcow2 and friends though perhaps you could imagine some hack based on NBD.

Paolo

#29 lore raw
In reply to Anthony Liguori
Quoted 29 lines · Anthony Liguori
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost.

We have demonstrated better results at much higher IOP rates with virtio-blk in userspace so while these results are nice, there's no reason to believe we can't do this in userspace.

Quoted 9 lines
Quoted 5 lines

In my opinion, vhost-blk/vhost-scsi are mostly
worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

A general rant below:

OTOH if it works, and adds value, we really should consider including code.

Users want something that has lots of features and performs really, really well. They want everything.

Quoted 7 lines

Having one device type that is "fast" but has no features and another that is "not fast" but has a lot of features forces the user to make a bad choice. No one wins in the end.

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

Can't same can be said about virtio scsi - it seems to be slower so we force a bad choice between blk and scsi at the user?

Quoted 6 lines
Quoted 3 lines

To me, it does not make sense to reject code just because in theory someone could write even better code.

There is no theory. We have proof points with virtio-blk.

Quoted 8 lines
Quoted 1 line

Code walks. Time to marker matters too.

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace.

But doing what in userspace exactly?

Quoted 11 lines

We can demonstrate this with
virtio-blk. This isn't a theoretical argument.

Quoted 8 lines

Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

Quoted 5 lines
Quoted 3 lines

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Asking a user to write a helper script is pretty awful...

A developer can write a helper. A user should just use management.

Quoted 21 lines
Quoted 9 lines
Quoted 2 lines

and doesn't support -device;

This needs to be fixed I think.

Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed?

It's an entirely different emulation path. It's not a simple packet protocol like virtio-net. It's a complex command protocol where the backend maintains a very large amount of state.

Quoted 3 lines

Userspace virtio-scsi
is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

Basically, the issue is that the kernel has more complete SCSI emulation that QEMU does right now.

Quoted 8 lines

There are lots of ways to try to solve this--like try to reuse the kernel code in userspace or just improving the userspace code. If we were able to make the two paths identical, then I strongly suspect there'd be no point in having tcm_vhost anyway.

Regards,

Anthony Liguori

However, a question we should ask ourselves is whether this will happen in practice, and when.

I have no idea, I am just asking questions.

Signature · 1 line
MST
maintainer
#30 lore raw

Il 05/07/2012 16:40, Michael S. Tsirkin ha scritto:

Quoted 3 lines
Quoted 3 lines

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

Yes.

Quoted 2 lines

Can't same can be said about virtio scsi - it seems to be slower so we force a bad choice between blk and scsi at the user?

virtio-scsi supports multiple devices per PCI slot (or even function), can talk to tapes, has better passthrough support for disks, and does a bunch of other things that virtio-blk by design doesn't do. This applies to both tcm_vhost and virtio-scsi-qemu.

So far, all that virtio-scsi vs. virtio-blk benchmarks say is that more benchmarking is needed. Some people see it faster, some people see it slower. In some sense, it's consistent with the expectation that the two should roughly be the same. :)

Quoted 8 lines
Quoted 6 lines

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace.

But doing what in userspace exactly?

Processing virtqueues in separate threads, switching the block and SCSI layer to fine-grained locking, adding some more fast paths.

Quoted 10 lines
Quoted 7 lines

Basically, the issue is that the kernel has more complete SCSI emulation that QEMU does right now.

There are lots of ways to try to solve this--like try to reuse the kernel code in userspace or just improving the userspace code. If we were able to make the two paths identical, then I strongly suspect there'd be no point in having tcm_vhost anyway.

However, a question we should ask ourselves is whether this will happen in practice, and when.

It's already happening, but it takes a substantial amount of preparatory work before you can actually see results.

Paolo

#31 lore raw
Quoted 15 lines · Paolo Bonzini

Il 05/07/2012 16:40, Michael S. Tsirkin ha scritto:

Quoted 3 lines
Quoted 3 lines

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

Yes.

Quoted 2 lines

Can't same can be said about virtio scsi - it seems to be slower so we force a bad choice between blk and scsi at the user?

virtio-scsi supports multiple devices per PCI slot (or even function), can talk to tapes, has better passthrough support for disks, and does a bunch of other things that virtio-blk by design doesn't do. This applies to both tcm_vhost and virtio-scsi-qemu.

Quoted 4 lines

So far, all that virtio-scsi vs. virtio-blk benchmarks say is that more benchmarking is needed. Some people see it faster, some people see it slower. In some sense, it's consistent with the expectation that the two should roughly be the same. :)

Anyway, all I was saying is new technology often lacks some features of the old one. We are not forcing new inferior one on anyone, so we can let it mature it tree.

Quoted 27 lines
Quoted 8 lines
Quoted 6 lines

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace.

But doing what in userspace exactly?

Processing virtqueues in separate threads, switching the block and SCSI layer to fine-grained locking, adding some more fast paths.

Quoted 10 lines
Quoted 7 lines

Basically, the issue is that the kernel has more complete SCSI emulation that QEMU does right now.

There are lots of ways to try to solve this--like try to reuse the kernel code in userspace or just improving the userspace code. If we were able to make the two paths identical, then I strongly suspect there'd be no point in having tcm_vhost anyway.

However, a question we should ask ourselves is whether this will happen in practice, and when.

It's already happening, but it takes a substantial amount of preparatory work before you can actually see results.

Paolo

#8 lore raw

Re: [PATCH 4/6] tcm_vhost: Initial merge for vhost level target fabric driver

In reply to Nicholas A. Bellinger

drivers/vhost/tcm_vhost.c line 421

Quoted 7 lines · Nicholas A. Bellinger
drivers/vhost/tcm_vhost.c new file +7 -0
+/* Fill in status and signal that we are done processing this command
+ *
+ * This is scheduled in the vhost work queue so we are called with the owner
+ * process mm and can access the vring.
+ */
+static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
+{

As far as I can see vhost_scsi_complete_cmd_work() runs on the context of a work queue kernel thread and hence doesn't have an mm context. Did I misunderstand something ?

Bart.

#11 lore raw

Re: [PATCH 4/6] tcm_vhost: Initial merge for vhost level target fabric driver

In reply to Nicholas A. Bellinger

drivers/vhost/tcm_vhost.c line 421

Quoted 7 lines · Nicholas A. Bellinger
drivers/vhost/tcm_vhost.c new file +7 -0
+/* Fill in status and signal that we are done processing this command
+ *
+ * This is scheduled in the vhost work queue so we are called with the owner
+ * process mm and can access the vring.
+ */
+static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
+{

As far as I can see vhost_scsi_complete_cmd_work() runs on the context of a work queue kernel thread and hence doesn't have an mm context. Did I misunderstand something ?

Bart.

#48 lore raw
In reply to Nicholas A. Bellinger
Quoted 4 lines · Nicholas A. Bellinger

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

These numbers are interesting. To me these numbers mean that there is a huge performance bottleneck in the virtio-scsi-raw storage path. Why is the virtio-scsi-raw bandwidth only one third of the bare-metal raw block bandwidth ?

Bart.

#50 lore raw
In reply to Nicholas A. Bellinger
Quoted 4 lines · Nicholas A. Bellinger

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

These numbers are interesting. To me these numbers mean that there is a huge performance bottleneck in the virtio-scsi-raw storage path. Why is the virtio-scsi-raw bandwidth only one third of the bare-metal raw block bandwidth ?

Bart.

#9 lore raw

Re: [PATCH 4/6] tcm_vhost: Initial merge for vhost level target fabric driver

In reply to Bart Van Assche
Quoted 12 lines · Bart Van Assche

drivers/vhost/tcm_vhost.c line 421

Quoted 7 lines · Nicholas A. Bellinger
drivers/vhost/tcm_vhost.c new file +7 -0
+/* Fill in status and signal that we are done processing this command
+ *
+ * This is scheduled in the vhost work queue so we are called with the owner
+ * process mm and can access the vring.
+ */
+static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
+{

As far as I can see vhost_scsi_complete_cmd_work() runs on the context of a work queue kernel thread and hence doesn't have an mm context. Did I misunderstand something ?

Please ignore the above - I've found the answer in vhost_dev_ioctl() and vhost_dev_set_owner().

Bart.

#10 lore raw

Re: [PATCH 4/6] tcm_vhost: Initial merge for vhost level target fabric driver

In reply to Bart Van Assche
Quoted 12 lines · Bart Van Assche

drivers/vhost/tcm_vhost.c line 421

Quoted 7 lines · Nicholas A. Bellinger
drivers/vhost/tcm_vhost.c new file +7 -0
+/* Fill in status and signal that we are done processing this command
+ *
+ * This is scheduled in the vhost work queue so we are called with the owner
+ * process mm and can access the vring.
+ */
+static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
+{

As far as I can see vhost_scsi_complete_cmd_work() runs on the context of a work queue kernel thread and hence doesn't have an mm context. Did I misunderstand something ?

Please ignore the above - I've found the answer in vhost_dev_ioctl() and vhost_dev_set_owner().

Bart.

#49 lore raw
In reply to Bart Van Assche
Quoted 10 lines · Bart Van Assche
Quoted 4 lines · Nicholas A. Bellinger

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

These numbers are interesting. To me these numbers mean that there is a huge performance bottleneck in the virtio-scsi-raw storage path. Why is the virtio-scsi-raw bandwidth only one third of the bare-metal raw block bandwidth ?

(replying to my own e-mail)

Or maybe the above numbers mean that in the virtio-scsi-raw test I/O was serialized (I/O depth 1) while the other two tests use a large I/O depth
(64) ? It can't be a coincidence that the virtio-scsi-raw results are close to the bare-metal results for I/O depth 1.

Another question: which functionality does tcm_vhost provide that is not yet provided by the SCSI emulation code in qemu + tcm_loop ?

Bart.

#45 lore raw
In reply to Paolo Bonzini
Quoted 16 lines · Paolo Bonzini

Il 05/07/2012 15:53, Michael S. Tsirkin ha scritto:

Quoted 15 lines · Paolo Bonzini
Quoted 13 lines

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost. In my opinion, vhost-blk/vhost-scsi are mostly worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

Quoted 8 lines
Quoted 5 lines

A general rant below:

OTOH if it works, and adds value, we really should consider including code. To me, it does not make sense to reject code just because in theory someone could write even better code.

It's not about writing better code. It's about having two completely separate SCSI/block layers with completely different feature sets.

You mean qemu one versus kernel one? Both exist anyway :)

Quoted 9 lines
Quoted 9 lines

Code walks. Time to marker matters too.
Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

Quoted 6 lines
Quoted 3 lines

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

We could add hooks for vhost-scsi in the SCSI devices and let them configure themselves. I'm not sure it is a good idea.

This is exactly what virtio-net does.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

and doesn't support -device;

This needs to be fixed I think.

To be clear, it supports -device for the virtio-scsi HBA itself; it doesn't support using -drive/-device to set up the disks hanging off it.

Fixable, isn't it?

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed? Userspace virtio-scsi is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

Quoted 7 lines

It cannot support anyway the whole feature set unless you want to port thousands of lines from the kernel to QEMU (well, perhaps we'll get there but it's far. And dually, the in-kernel target of course does not support qcow2 and friends though perhaps you could imagine some hack based on NBD.

Paolo

Exactly. Kernel also gains functionality all the time.

Signature · 1 line
MST
#32 lore raw
In reply to Anthony Liguori
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost.

We have demonstrated better results at much higher IOP rates with virtio-blk in userspace so while these results are nice, there's no reason to believe we can't do this in userspace.

So I'm pretty sure this discrepancy is attributed to the small block random I/O bottleneck currently present for all Linux/SCSI core LLDs regardless of physical or virtual storage fabric.

The SCSI wide host-lock less conversion that happened in .38 code back in 2010, and subsequently having LLDs like virtio-scsi convert to run in host-lock-less mode have helped to some extent.. But it's still not enough..

Another example where we've been able to prove this bottleneck recently is with the following target setup:

*) Intel Romley production machines with 128 GB of DDR-3 memory *) 4x FusionIO ioDrive 2 (1.5 TB @ PCI-e Gen2 x2)
*) Mellanox PCI-exress Gen3 HCA running at 56 gb/sec *) Infiniband SRP Target backported to RHEL 6.2 + latest OFED

In this setup using ib_srpt + IBLOCK w/ emulate_write_cache=1 + iomemory_vsl export we end up avoiding SCSI core bottleneck on the target machine, just as with the tcm_vhost example here for host kernel side processing with vhost.

Using Linux IB SRP initiator + Windows Server 2008 R2 SCSI-miniport SRP (OFED) Initiator connected to four ib_srpt LUNs, we've observed that MSFT SCSI is currently outperforming RHEL 6.2 on the order of ~285K vs. ~215K with heavy random 4k WRITE iometer / fio tests. Note this with an optimized queue_depth ib_srp client w/ noop I/O schedulering, but is still lacking the host_lock-less patches on RHEL 6.2 OFED..

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

http://lists.linux-foundation.org/pipermail/ksummit-2012-discuss/2012-June/000098.html,

Quoted 13 lines
Quoted 9 lines
Quoted 5 lines

In my opinion, vhost-blk/vhost-scsi are mostly
worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

A general rant below:

OTOH if it works, and adds value, we really should consider including code.

Users want something that has lots of features and performs really, really well.
They want everything.

Quoted 8 lines

Having one device type that is "fast" but has no features and another that is "not fast" but has a lot of features forces the user to make a bad choice. No one wins in the end.

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

So based upon the data above, I'm going to make a prediction that MSFT guests connected with SCSI miniport <-> tcm_vhost will out perform Linux guests with virtio-scsi (w/ <= 3.5 host-lock-less) <-> tcm_vhost w/ connected to the same raw block flash iomemory_vsl backends.

Of course that depends upon how fast virtio-scsi drivers get written for MSFT guests vs. us fixing the long-term performance bottleneck in our SCSI subsystem. ;)

(Ksummit-2012 discuss CC'ed for the later)

Quoted 23 lines
Quoted 2 lines

To me, it does not make sense to reject code just because in theory someone could write even better code.

There is no theory. We have proof points with virtio-blk.

Quoted 1 line

Code walks. Time to marker matters too.

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace. We can demonstrate this with virtio-blk. This isn't a theoretical argument.

Quoted 8 lines

Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

Quoted 6 lines
Quoted 3 lines

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Asking a user to write a helper script is pretty awful...

It's easy for anyone with basic python knowledge to use rtslib packages in the downstream distros to connect to tcm_vhost endpoints LUNs right now.

All you need is the following vhost.spec, and tcm_vhost works out of the box for rtslib and targetcli/rtsadmin without any modification to existing userspace packages:

root@tifa:~# cat /var/target/fabric/vhost.spec 
# WARNING: This is a draft specfile supplied for testing only.

# The fabric module feature set
features = nexus

# Use naa WWNs.
wwn_type = naa

# Non-standard module naming scheme
kernel_module = tcm_vhost

# The configfs group
configfs_group = vhost

#42 lore raw
In reply to Anthony Liguori
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost.

We have demonstrated better results at much higher IOP rates with virtio-blk in userspace so while these results are nice, there's no reason to believe we can't do this in userspace.

So I'm pretty sure this discrepancy is attributed to the small block random I/O bottleneck currently present for all Linux/SCSI core LLDs regardless of physical or virtual storage fabric.

The SCSI wide host-lock less conversion that happened in .38 code back in 2010, and subsequently having LLDs like virtio-scsi convert to run in host-lock-less mode have helped to some extent.. But it's still not enough..

Another example where we've been able to prove this bottleneck recently is with the following target setup:

*) Intel Romley production machines with 128 GB of DDR-3 memory *) 4x FusionIO ioDrive 2 (1.5 TB @ PCI-e Gen2 x2)
*) Mellanox PCI-exress Gen3 HCA running at 56 gb/sec *) Infiniband SRP Target backported to RHEL 6.2 + latest OFED

In this setup using ib_srpt + IBLOCK w/ emulate_write_cache=1 + iomemory_vsl export we end up avoiding SCSI core bottleneck on the target machine, just as with the tcm_vhost example here for host kernel side processing with vhost.

Using Linux IB SRP initiator + Windows Server 2008 R2 SCSI-miniport SRP (OFED) Initiator connected to four ib_srpt LUNs, we've observed that MSFT SCSI is currently outperforming RHEL 6.2 on the order of ~285K vs. ~215K with heavy random 4k WRITE iometer / fio tests. Note this with an optimized queue_depth ib_srp client w/ noop I/O schedulering, but is still lacking the host_lock-less patches on RHEL 6.2 OFED..

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

http://lists.linux-foundation.org/pipermail/ksummit-2012-discuss/2012-June/000098.html,

Quoted 13 lines
Quoted 9 lines
Quoted 5 lines

In my opinion, vhost-blk/vhost-scsi are mostly
worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

A general rant below:

OTOH if it works, and adds value, we really should consider including code.

Users want something that has lots of features and performs really, really well.
They want everything.

Quoted 8 lines

Having one device type that is "fast" but has no features and another that is "not fast" but has a lot of features forces the user to make a bad choice. No one wins in the end.

virtio-scsi is brand new. It's not as if we've had any significant time to make virtio-scsi-qemu faster. In fact, tcm_vhost existed before virtio-scsi-qemu did if I understand correctly.

So based upon the data above, I'm going to make a prediction that MSFT guests connected with SCSI miniport <-> tcm_vhost will out perform Linux guests with virtio-scsi (w/ <= 3.5 host-lock-less) <-> tcm_vhost w/ connected to the same raw block flash iomemory_vsl backends.

Of course that depends upon how fast virtio-scsi drivers get written for MSFT guests vs. us fixing the long-term performance bottleneck in our SCSI subsystem. ;)

(Ksummit-2012 discuss CC'ed for the later)

Quoted 23 lines
Quoted 2 lines

To me, it does not make sense to reject code just because in theory someone could write even better code.

There is no theory. We have proof points with virtio-blk.

Quoted 1 line

Code walks. Time to marker matters too.

But guest/user facing decisions cannot be easily unmade and making the wrong technical choices because of premature concerns of "time to market" just result in a long term mess.

There is no technical reason why tcm_vhost is going to be faster than doing it in userspace. We can demonstrate this with virtio-blk. This isn't a theoretical argument.

Quoted 8 lines

Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

Quoted 6 lines
Quoted 3 lines

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Asking a user to write a helper script is pretty awful...

It's easy for anyone with basic python knowledge to use rtslib packages in the downstream distros to connect to tcm_vhost endpoints LUNs right now.

All you need is the following vhost.spec, and tcm_vhost works out of the box for rtslib and targetcli/rtsadmin without any modification to existing userspace packages:

root@tifa:~# cat /var/target/fabric/vhost.spec 
# WARNING: This is a draft specfile supplied for testing only.

# The fabric module feature set
features = nexus

# Use naa WWNs.
wwn_type = naa

# Non-standard module naming scheme
kernel_module = tcm_vhost

# The configfs group
configfs_group = vhost

#55 lore raw
In reply to Michael S. Tsirkin
Quoted 2 lines · Michael S. Tsirkin
Quoted 1 line · Nicholas A. Bellinger

On Wed, 2012-07-04 at 18:05 +0300, Michael S. Tsirkin wrote:

<SNIP>

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

I was talking about 4/6 first of all.

So yeah, this code is still considered RFC at this point for-3.6, but I'd like to get this into target-pending/for-next in next week for more feedback and start collecting signoffs for the necessary pieces that effect existing vhost code.

Quoted 9 lines
Quoted 2 lines

By that time the cmwq conversion of tcm_vhost should be in place as well..

I'll try to give some feedback but I think we do need
to see the qemu patches - they weren't posted yet, were they? This driver has some userspace interface and once
that is merged it has to be supported.
So I think we need the buy-in from the qemu side at the principal level.

<nod>

Stefan posted the QEMU vhost-scsi patches a few items, but I think it's been awhile since the last round of review. For the recent development's with tcm_vhost, I've been using Zhi's QEMU tree here:

https://github.com/wuzhy/qemu/tree/vhost-scsi

Other than a few printf I added to help me understand how it works, no function changes have been made to work with target-pending/tcm_vhost.

Thank you,

--nab

#46 lore raw
In reply to Michael S. Tsirkin
Quoted 15 lines · Michael S. Tsirkin
Quoted 7 lines · Paolo Bonzini

Il 05/07/2012 03:52, Nicholas A. Bellinger ha scritto:

Quoted 5 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K
Quoted 6 lines

This is impressive, but I think it's still not enough to justify the inclusion of tcm_vhost. In my opinion, vhost-blk/vhost-scsi are mostly worthwhile as drivers for improvements to QEMU performance. We want to add more fast paths to QEMU that let us move SCSI and virtio processing to separate threads, we have proof of concepts that this can be done, and we can use vhost-blk/vhost-scsi to find bottlenecks more effectively.

Quoted 9 lines

A general rant below:

OTOH if it works, and adds value, we really should consider including code. To me, it does not make sense to reject code just because in theory someone could write even better code. Code walks. Time to marker matters too. Yes I realize more options increases support. But downstreams can make their own decisions on whether to support some configurations:
add a configure option to disable it and that's enough.

+1 for mst here.

I think that type of sentiment deserves a toast at KS/LC in August. ;)

Quoted 10 lines
Quoted 3 lines

In fact, virtio-scsi-qemu and virtio-scsi-vhost are effectively two completely different devices that happen to speak the same SCSI transport. Not only virtio-scsi-vhost must be configured outside QEMU

configuration outside QEMU is OK I think - real users use management anyway. But maybe we can have helper scripts like we have for tun?

Quoted 1 line

and doesn't support -device;

Quoted 9 lines

This needs to be fixed I think.

Quoted 2 lines

it (obviously) presents different
inquiry/vpd/mode data than virtio-scsi-qemu,

Why is this obvious and can't be fixed? Userspace virtio-scsi is pretty flexible - can't it supply matching inquiry/vpd/mode data so that switching is transparent to the guest?

So I imagine that setting inquiry/vpd/mode via configfs attribs to match whatever the guest wants to see (or expects to see) can be enabled via /sys/kernel/config/target/core/$HBA/$DEV/[wwn,attrib]/ easily to whatever is required.

However, beyond basic SCSI WWN related bits, I would avoid trying to match complex SCSI target state between the in-kernel patch and QEMU SCSI. We've had this topic come up numerous times over the nears for other fabric modules (namely iscsi-target) and usually it end's up with a long email thread re-hashing history of failures until Linus starts yelling at the person who is pushing complex kernel <-> user split.

The part where I start to get nervous is where you get into the cluster
+ multipath features. We have methods in TCM core that rebuild the exact state of this bits based upon external file metadata, based upon the running configfs layout. This is used by physical node failover + re-takeover to ensure the SCSI client sees exactly the same SCSI state.

Trying to propagate up this type of complexity is where I think you go overboard. KISS and let's let fabric independent configfs (leaning on vfs) do the hard work for tracking these types of SCSI relationships.

Quoted 7 lines
Quoted 1 line

so that it is not possible to migrate one to the other.

Migration between different backend types does not seem all that useful. The general rule is you need identical flags on both sides to allow migration, and it is not clear how valuable it is to relax this somewhat.

I really need to learn more about how QEMU Live migration works wrt to storage before saying how this may (or may not) work.

We certainly have no problems doing physical machine failover with target_core_mod for iscsi-target, and ATM I don't see why the QEMU userspace process driving the real-time configfs configuration of the storage fabric would not work..

Quoted 7 lines
Quoted 6 lines

I don't think vhost-scsi is particularly useful for virtualization, honestly. However, if it is useful for development, testing or benchmarking of lio itself (does this make any sense? :)) that could be by itself a good reason to include it.

Paolo

maintainer
#47 lore raw

Il 06/07/2012 05:38, Nicholas A. Bellinger ha scritto:

Quoted 8 lines

So I imagine that setting inquiry/vpd/mode via configfs attribs to match whatever the guest wants to see (or expects to see) can be enabled via /sys/kernel/config/target/core/$HBA/$DEV/[wwn,attrib]/ easily to whatever is required.

However, beyond basic SCSI WWN related bits, I would avoid trying to match complex SCSI target state between the in-kernel patch and QEMU SCSI.

Agreed. It should just be the bare minimum to make stable /dev/disk paths, well, stable between the two backends.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

so that it is not possible to migrate one to the other.

Migration between different backend types does not seem all that useful. The general rule is you need identical flags on both sides to allow migration, and it is not clear how valuable it is to relax this somewhat.

I really need to learn more about how QEMU Live migration works wrt to storage before saying how this may (or may not) work.

vhost-scsi live migration should be easy to fix. You need some ioctl or eventfd mechanism to communicate to userspace that there is no pending I/O, but you need that anyway also for other operations (as simple as stopping the VM: QEMU guarantees that the "stop" monitor command returns only when there is no outstanding I/O).

What worries me most is: 1) the amount of functionality that is lost with vhost-scsi, especially the new live operations that we're adding to QEMU; 2) whether any hook we introduce in the QEMU block layer will cause problems down the road when we set to fix the existing virtio-blk/virtio-scsi-qemu performance problems. This is the reason why I'm reluctant to merge the QEMU bits. The kernel bits are self-contained and are much less problematic.

It may well be that _the same_ (or very similar) hooks will be needed by both tcm_vhost and high-performance userspace virtio backends. This would of course remove the objection.

Paolo

maintainer
#33 lore raw

SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

In reply to Nicholas A. Bellinger
Quoted 29 lines · Nicholas A. Bellinger

So I'm pretty sure this discrepancy is attributed to the small block random I/O bottleneck currently present for all Linux/SCSI core LLDs regardless of physical or virtual storage fabric.

The SCSI wide host-lock less conversion that happened in .38 code back in 2010, and subsequently having LLDs like virtio-scsi convert to run in host-lock-less mode have helped to some extent.. But it's still not enough..

Another example where we've been able to prove this bottleneck recently is with the following target setup:

*) Intel Romley production machines with 128 GB of DDR-3 memory *) 4x FusionIO ioDrive 2 (1.5 TB @ PCI-e Gen2 x2)
*) Mellanox PCI-exress Gen3 HCA running at 56 gb/sec *) Infiniband SRP Target backported to RHEL 6.2 + latest OFED

In this setup using ib_srpt + IBLOCK w/ emulate_write_cache=1 + iomemory_vsl export we end up avoiding SCSI core bottleneck on the target machine, just as with the tcm_vhost example here for host kernel side processing with vhost.

Using Linux IB SRP initiator + Windows Server 2008 R2 SCSI-miniport SRP (OFED) Initiator connected to four ib_srpt LUNs, we've observed that MSFT SCSI is currently outperforming RHEL 6.2 on the order of ~285K vs. ~215K with heavy random 4k WRITE iometer / fio tests. Note this with an optimized queue_depth ib_srp client w/ noop I/O schedulering, but is still lacking the host_lock-less patches on RHEL 6.2 OFED..

Quoted 3 lines

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

Well, no, it hasn't. You randomly drop things like this into unrelated email (I suppose that is a mention in strict English construction) but it's not really enough to get anyone to pay attention since they mostly stopped reading at the top, if they got that far: most people just go by subject when wading through threads initially.

But even if anyone noticed, a statement that RHEL6.2 (on a 2.6.32 kernel, which is now nearly three years old) is 25% slower than W2k8R2 on infiniband isn't really going to get anyone excited either (particularly when you mention OFED, which usually means a stack replacement on Linux anyway).

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

James

#34 lore raw

Re: SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

Quoted 35 lines · James Bottomley
Quoted 29 lines · Nicholas A. Bellinger

So I'm pretty sure this discrepancy is attributed to the small block random I/O bottleneck currently present for all Linux/SCSI core LLDs regardless of physical or virtual storage fabric.

The SCSI wide host-lock less conversion that happened in .38 code back in 2010, and subsequently having LLDs like virtio-scsi convert to run in host-lock-less mode have helped to some extent.. But it's still not enough..

Another example where we've been able to prove this bottleneck recently is with the following target setup:

*) Intel Romley production machines with 128 GB of DDR-3 memory *) 4x FusionIO ioDrive 2 (1.5 TB @ PCI-e Gen2 x2)
*) Mellanox PCI-exress Gen3 HCA running at 56 gb/sec *) Infiniband SRP Target backported to RHEL 6.2 + latest OFED

In this setup using ib_srpt + IBLOCK w/ emulate_write_cache=1 + iomemory_vsl export we end up avoiding SCSI core bottleneck on the target machine, just as with the tcm_vhost example here for host kernel side processing with vhost.

Using Linux IB SRP initiator + Windows Server 2008 R2 SCSI-miniport SRP (OFED) Initiator connected to four ib_srpt LUNs, we've observed that MSFT SCSI is currently outperforming RHEL 6.2 on the order of ~285K vs. ~215K with heavy random 4k WRITE iometer / fio tests. Note this with an optimized queue_depth ib_srp client w/ noop I/O schedulering, but is still lacking the host_lock-less patches on RHEL 6.2 OFED..

Quoted 3 lines

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

Quoted 6 lines

Well, no, it hasn't. You randomly drop things like this into unrelated email (I suppose that is a mention in strict English construction) but it's not really enough to get anyone to pay attention since they mostly stopped reading at the top, if they got that far: most people just go by subject when wading through threads initially.

It most certainly has been made clear to me, numerous times from many people in the Linux/SCSI community that there is a bottleneck for small block random I/O in SCSI core vs. raw Linux/Block, as well as vs. non Linux based SCSI subsystems.

My apologies if mentioning this issue last year at LC 2011 to you privately did not take a tone of a more serious nature, or that proposing a topic for LSF-2012 this year was not a clear enough indication of a problem with SCSI small block random I/O performance.

Quoted 6 lines

But even if anyone noticed, a statement that RHEL6.2 (on a 2.6.32 kernel, which is now nearly three years old) is 25% slower than W2k8R2 on infiniband isn't really going to get anyone excited either (particularly when you mention OFED, which usually means a stack replacement on Linux anyway).

The specific issue was first raised for .38 where we where able to get most of the interesting high performance LLDs converted to using internal locking methods so that host_lock did not have to be obtained during each ->queuecommand() I/O dispatch, right..?

This has helped a good deal for large multi-lun scsi_host configs that are now running in host-lock less mode, but there is still a large discrepancy single LUN vs. raw struct block_device access even with LLD host_lock less mode enabled.

Now I think the virtio-blk client performance is demonstrating this issue pretty vividly, along with this week's tcm_vhost IBLOCK raw block flash benchmarks that is demonstrate some other yet-to-be determined limitations for virtio-scsi-raw vs. tcm_vhost for this particular fio randrw workload.

Quoted 6 lines

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

It's really quite simple for anyone to demonstrate the bottleneck locally on any machine using tcm_loop with raw block flash. Take a struct block_device backend (like a Fusion IO /dev/fio*) and using IBLOCK and export locally accessible SCSI LUNs via tcm_loop..

Using FIO there is a significant drop for randrw 4k performance between tcm_loop <-> IBLOCK vs. raw struct block device backends. And no, it's not some type of target IBLOCK or tcm_loop bottleneck, it's a per SCSI LUN limitation for small block random I/Os on the order of ~75K for each SCSI LUN.

If anyone has gone actually gone faster than this with any single SCSI LUN on any storage fabric, I would be interested in hearing about your setup.

Thanks,

--nab

maintainer
#35 lore raw

Re: SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

Quoted 88 lines · Nicholas A. Bellinger
Quoted 35 lines · James Bottomley
Quoted 29 lines · Nicholas A. Bellinger

So I'm pretty sure this discrepancy is attributed to the small block random I/O bottleneck currently present for all Linux/SCSI core LLDs regardless of physical or virtual storage fabric.

The SCSI wide host-lock less conversion that happened in .38 code back in 2010, and subsequently having LLDs like virtio-scsi convert to run in host-lock-less mode have helped to some extent.. But it's still not enough..

Another example where we've been able to prove this bottleneck recently is with the following target setup:

*) Intel Romley production machines with 128 GB of DDR-3 memory *) 4x FusionIO ioDrive 2 (1.5 TB @ PCI-e Gen2 x2)
*) Mellanox PCI-exress Gen3 HCA running at 56 gb/sec *) Infiniband SRP Target backported to RHEL 6.2 + latest OFED

In this setup using ib_srpt + IBLOCK w/ emulate_write_cache=1 + iomemory_vsl export we end up avoiding SCSI core bottleneck on the target machine, just as with the tcm_vhost example here for host kernel side processing with vhost.

Using Linux IB SRP initiator + Windows Server 2008 R2 SCSI-miniport SRP (OFED) Initiator connected to four ib_srpt LUNs, we've observed that MSFT SCSI is currently outperforming RHEL 6.2 on the order of ~285K vs. ~215K with heavy random 4k WRITE iometer / fio tests. Note this with an optimized queue_depth ib_srp client w/ noop I/O schedulering, but is still lacking the host_lock-less patches on RHEL 6.2 OFED..

Quoted 3 lines

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

Quoted 6 lines

Well, no, it hasn't. You randomly drop things like this into unrelated email (I suppose that is a mention in strict English construction) but it's not really enough to get anyone to pay attention since they mostly stopped reading at the top, if they got that far: most people just go by subject when wading through threads initially.

It most certainly has been made clear to me, numerous times from many people in the Linux/SCSI community that there is a bottleneck for small block random I/O in SCSI core vs. raw Linux/Block, as well as vs. non Linux based SCSI subsystems.

My apologies if mentioning this issue last year at LC 2011 to you privately did not take a tone of a more serious nature, or that proposing a topic for LSF-2012 this year was not a clear enough indication of a problem with SCSI small block random I/O performance.

Quoted 6 lines

But even if anyone noticed, a statement that RHEL6.2 (on a 2.6.32 kernel, which is now nearly three years old) is 25% slower than W2k8R2 on infiniband isn't really going to get anyone excited either (particularly when you mention OFED, which usually means a stack replacement on Linux anyway).

The specific issue was first raised for .38 where we where able to get most of the interesting high performance LLDs converted to using internal locking methods so that host_lock did not have to be obtained during each ->queuecommand() I/O dispatch, right..?

This has helped a good deal for large multi-lun scsi_host configs that are now running in host-lock less mode, but there is still a large discrepancy single LUN vs. raw struct block_device access even with LLD host_lock less mode enabled.

Now I think the virtio-blk client performance is demonstrating this issue pretty vividly, along with this week's tcm_vhost IBLOCK raw block flash benchmarks that is demonstrate some other yet-to-be determined limitations for virtio-scsi-raw vs. tcm_vhost for this particular fio randrw workload.

Quoted 6 lines

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

It's really quite simple for anyone to demonstrate the bottleneck locally on any machine using tcm_loop with raw block flash. Take a struct block_device backend (like a Fusion IO /dev/fio*) and using IBLOCK and export locally accessible SCSI LUNs via tcm_loop..

Quoted 5 lines

Using FIO there is a significant drop for randrw 4k performance between tcm_loop <-> IBLOCK vs. raw struct block device backends. And no, it's not some type of target IBLOCK or tcm_loop bottleneck, it's a per SCSI LUN limitation for small block random I/Os on the order of ~75K for each SCSI LUN.

Here, you're saying here that the end to end SCSI stack tops out at around 75k iops, which is reasonably respectable if you don't employ any mitigation like queue steering and interrupt polling ... what were the mitigation techniques in the test you employed by the way?

But previously, you ascribed a performance drop of around 75% on virtio-scsi (topping out around 15-20k iops) to this same problem ... that doesn't really seem likely.

Here's the rough ranges of concern:

10K iops: standard arrays
100K iops: modern expensive fast flash drives on 6Gb links 1M iops: PCIe NVMexpress like devices

SCSI should do arrays with no problem at all, so I'd be really concerned that it can't make 0-20k iops. If you push the system and fine tune it, SCSI can just about get to 100k iops. 1M iops is still a stretch goal for pure block drivers.

James

#36 lore raw

Re: SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

Quoted 4 lines · James Bottomley
Quoted 3 lines · Nicholas A. Bellinger
Quoted 2 lines · James Bottomley

On Thu, 2012-07-05 at 20:01 -0700, Nicholas A. Bellinger wrote:

<SNIP>

Quoted 62 lines
Quoted 56 lines
Quoted 10 lines
Quoted 3 lines

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

Well, no, it hasn't. You randomly drop things like this into unrelated email (I suppose that is a mention in strict English construction) but it's not really enough to get anyone to pay attention since they mostly stopped reading at the top, if they got that far: most people just go by subject when wading through threads initially.

It most certainly has been made clear to me, numerous times from many people in the Linux/SCSI community that there is a bottleneck for small block random I/O in SCSI core vs. raw Linux/Block, as well as vs. non Linux based SCSI subsystems.

My apologies if mentioning this issue last year at LC 2011 to you privately did not take a tone of a more serious nature, or that proposing a topic for LSF-2012 this year was not a clear enough indication of a problem with SCSI small block random I/O performance.

Quoted 6 lines

But even if anyone noticed, a statement that RHEL6.2 (on a 2.6.32 kernel, which is now nearly three years old) is 25% slower than W2k8R2 on infiniband isn't really going to get anyone excited either (particularly when you mention OFED, which usually means a stack replacement on Linux anyway).

The specific issue was first raised for .38 where we where able to get most of the interesting high performance LLDs converted to using internal locking methods so that host_lock did not have to be obtained during each ->queuecommand() I/O dispatch, right..?

This has helped a good deal for large multi-lun scsi_host configs that are now running in host-lock less mode, but there is still a large discrepancy single LUN vs. raw struct block_device access even with LLD host_lock less mode enabled.

Now I think the virtio-blk client performance is demonstrating this issue pretty vividly, along with this week's tcm_vhost IBLOCK raw block flash benchmarks that is demonstrate some other yet-to-be determined limitations for virtio-scsi-raw vs. tcm_vhost for this particular fio randrw workload.

Quoted 6 lines

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

It's really quite simple for anyone to demonstrate the bottleneck locally on any machine using tcm_loop with raw block flash. Take a struct block_device backend (like a Fusion IO /dev/fio*) and using IBLOCK and export locally accessible SCSI LUNs via tcm_loop..

Quoted 5 lines

Using FIO there is a significant drop for randrw 4k performance between tcm_loop <-> IBLOCK vs. raw struct block device backends. And no, it's not some type of target IBLOCK or tcm_loop bottleneck, it's a per SCSI LUN limitation for small block random I/Os on the order of ~75K for each SCSI LUN.

Quoted 5 lines

Here, you're saying here that the end to end SCSI stack tops out at around 75k iops, which is reasonably respectable if you don't employ any mitigation like queue steering and interrupt polling ... what were the mitigation techniques in the test you employed by the way?

~75K per SCSI LUN in a multi-lun per host setup is being optimistic btw. On the other side of the coin, the same pure block device can easily go ~200K per backend.-

For the simplest case with tcm_loop, a struct scsi_cmnd is queued via cmwq to execute in process context -> submit the backend I/O. Once completed from IBLOCK, the I/O is run though a target completion wq, and completed back to SCSI.

There is no fancy queue steering or interrupt polling going on (at least not in tcm_loop) because it's a simple virtual SCSI LLD similar to scsi_debug.

Quoted 4 lines

But previously, you ascribed a performance drop of around 75% on virtio-scsi (topping out around 15-20k iops) to this same problem ... that doesn't really seem likely.

No. I ascribed the performance difference between virtio-scsi+tcm_vhost vs. bare-metal raw block flash to this bottleneck in Linux/SCSI.

It's obvious that virtio-scsi-raw going through QEMU SCSI / block is having some other shortcomings.

Quoted 11 lines

Here's the rough ranges of concern:

10K iops: standard arrays
100K iops: modern expensive fast flash drives on 6Gb links 1M iops: PCIe NVMexpress like devices

SCSI should do arrays with no problem at all, so I'd be really concerned that it can't make 0-20k iops. If you push the system and fine tune it, SCSI can just about get to 100k iops. 1M iops is still a stretch goal for pure block drivers.

1M iops is not a stretch for pure block drivers anymore on commodity hardwrae. 5 Fusion-IO HBAs + Romley HW can easily go 1M random 4k IOPs using a pure block driver.

The point is that it would currently take at least 2x the amount of SCSI LUNs in order to even get close to 1M IOPs with an single LLD driver. And from the feedback from everyone I've talked to, no one has been able to make Linux/SCSI go 1M IOPs with any kernel.

--nab

#37 lore raw

Re: SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

In reply to James Bottomley
Quoted 4 lines · James Bottomley
Quoted 3 lines · Nicholas A. Bellinger
Quoted 2 lines · James Bottomley

On Thu, 2012-07-05 at 20:01 -0700, Nicholas A. Bellinger wrote:

<SNIP>

Quoted 62 lines
Quoted 56 lines
Quoted 10 lines
Quoted 3 lines

This bottleneck has been mentioned by various people (including myself) on linux-scsi the last 18 months, and I've proposed that that it be discussed at KS-2012 so we can start making some forward progress:

Well, no, it hasn't. You randomly drop things like this into unrelated email (I suppose that is a mention in strict English construction) but it's not really enough to get anyone to pay attention since they mostly stopped reading at the top, if they got that far: most people just go by subject when wading through threads initially.

It most certainly has been made clear to me, numerous times from many people in the Linux/SCSI community that there is a bottleneck for small block random I/O in SCSI core vs. raw Linux/Block, as well as vs. non Linux based SCSI subsystems.

My apologies if mentioning this issue last year at LC 2011 to you privately did not take a tone of a more serious nature, or that proposing a topic for LSF-2012 this year was not a clear enough indication of a problem with SCSI small block random I/O performance.

Quoted 6 lines

But even if anyone noticed, a statement that RHEL6.2 (on a 2.6.32 kernel, which is now nearly three years old) is 25% slower than W2k8R2 on infiniband isn't really going to get anyone excited either (particularly when you mention OFED, which usually means a stack replacement on Linux anyway).

The specific issue was first raised for .38 where we where able to get most of the interesting high performance LLDs converted to using internal locking methods so that host_lock did not have to be obtained during each ->queuecommand() I/O dispatch, right..?

This has helped a good deal for large multi-lun scsi_host configs that are now running in host-lock less mode, but there is still a large discrepancy single LUN vs. raw struct block_device access even with LLD host_lock less mode enabled.

Now I think the virtio-blk client performance is demonstrating this issue pretty vividly, along with this week's tcm_vhost IBLOCK raw block flash benchmarks that is demonstrate some other yet-to-be determined limitations for virtio-scsi-raw vs. tcm_vhost for this particular fio randrw workload.

Quoted 6 lines

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

It's really quite simple for anyone to demonstrate the bottleneck locally on any machine using tcm_loop with raw block flash. Take a struct block_device backend (like a Fusion IO /dev/fio*) and using IBLOCK and export locally accessible SCSI LUNs via tcm_loop..

Quoted 5 lines

Using FIO there is a significant drop for randrw 4k performance between tcm_loop <-> IBLOCK vs. raw struct block device backends. And no, it's not some type of target IBLOCK or tcm_loop bottleneck, it's a per SCSI LUN limitation for small block random I/Os on the order of ~75K for each SCSI LUN.

Quoted 5 lines

Here, you're saying here that the end to end SCSI stack tops out at around 75k iops, which is reasonably respectable if you don't employ any mitigation like queue steering and interrupt polling ... what were the mitigation techniques in the test you employed by the way?

~75K per SCSI LUN in a multi-lun per host setup is being optimistic btw. On the other side of the coin, the same pure block device can easily go ~200K per backend.-

For the simplest case with tcm_loop, a struct scsi_cmnd is queued via cmwq to execute in process context -> submit the backend I/O. Once completed from IBLOCK, the I/O is run though a target completion wq, and completed back to SCSI.

There is no fancy queue steering or interrupt polling going on (at least not in tcm_loop) because it's a simple virtual SCSI LLD similar to scsi_debug.

Quoted 4 lines

But previously, you ascribed a performance drop of around 75% on virtio-scsi (topping out around 15-20k iops) to this same problem ... that doesn't really seem likely.

No. I ascribed the performance difference between virtio-scsi+tcm_vhost vs. bare-metal raw block flash to this bottleneck in Linux/SCSI.

It's obvious that virtio-scsi-raw going through QEMU SCSI / block is having some other shortcomings.

Quoted 11 lines

Here's the rough ranges of concern:

10K iops: standard arrays
100K iops: modern expensive fast flash drives on 6Gb links 1M iops: PCIe NVMexpress like devices

SCSI should do arrays with no problem at all, so I'd be really concerned that it can't make 0-20k iops. If you push the system and fine tune it, SCSI can just about get to 100k iops. 1M iops is still a stretch goal for pure block drivers.

1M iops is not a stretch for pure block drivers anymore on commodity hardwrae. 5 Fusion-IO HBAs + Romley HW can easily go 1M random 4k IOPs using a pure block driver.

The point is that it would currently take at least 2x the amount of SCSI LUNs in order to even get close to 1M IOPs with an single LLD driver. And from the feedback from everyone I've talked to, no one has been able to make Linux/SCSI go 1M IOPs with any kernel.

--nab

#38 lore raw

Re: [Ksummit-2012-discuss] SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

In reply to James Bottomley
Quoted 5 lines · James Bottomley

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

The OFED stuff in the meantime is part of 3.5-rc6. Infiniband has been supported for a long time and its a very important technology given the problematic nature of ethernet at high network speeds.

OFED crap exists for those running RHEL5/6. The new enterprise distros are based on the 3.2 kernel which has pretty good Infiniband support out of the box.

#41 lore raw

Re: [Ksummit-2012-discuss] SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

In reply to James Bottomley
Quoted 5 lines · James Bottomley

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

The OFED stuff in the meantime is part of 3.5-rc6. Infiniband has been supported for a long time and its a very important technology given the problematic nature of ethernet at high network speeds.

OFED crap exists for those running RHEL5/6. The new enterprise distros are based on the 3.2 kernel which has pretty good Infiniband support out of the box.

#39 lore raw

Re: [Ksummit-2012-discuss] SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

In reply to Christoph Lameter
Quoted 8 lines · Christoph Lameter
Quoted 5 lines · James Bottomley

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

Quoted 8 lines

The OFED stuff in the meantime is part of 3.5-rc6. Infiniband has been supported for a long time and its a very important technology given the problematic nature of ethernet at high network speeds.

OFED crap exists for those running RHEL5/6. The new enterprise distros are based on the 3.2 kernel which has pretty good Infiniband support out of the box.

So I don't think the HCAs or Infiniband fabric was the limiting factor for small block random I/O in the RHEL 6.2 w/ OFED vs. Windows Server 2008 R2 w/ OFED setup mentioned earlier.

I've seen both FC and iSCSI fabrics demonstrate the same type of random small block I/O performance anomalies with Linux/SCSI clients too. The v3.x Linux/SCSI clients are certainly better in the multi-lun per host small block random I/O case, but single LUN performance is (still) lacking compared to everything else.

Also RHEL 6.2 does have the scsi-host-lock less bits in place now, but it's been more a matter of converting OFED ib_srp code to run in host-lock less mode to realize extra gains for multi-lun per host.

#40 lore raw

Re: [Ksummit-2012-discuss] SCSI Performance regression [was Re: [PATCH 0/6] tcm_vhost/virtio-scsi WIP code for-3.6]

In reply to Christoph Lameter
Quoted 8 lines · Christoph Lameter
Quoted 5 lines · James Bottomley

What people might pay attention to is evidence that there's a problem in 3.5-rc6 (without any OFED crap). If you're not going to bother investigating, it has to be in an environment they can reproduce (so ordinary hardware, not infiniband) otherwise it gets ignored as an esoteric hardware issue.

Quoted 8 lines

The OFED stuff in the meantime is part of 3.5-rc6. Infiniband has been supported for a long time and its a very important technology given the problematic nature of ethernet at high network speeds.

OFED crap exists for those running RHEL5/6. The new enterprise distros are based on the 3.2 kernel which has pretty good Infiniband support out of the box.

So I don't think the HCAs or Infiniband fabric was the limiting factor for small block random I/O in the RHEL 6.2 w/ OFED vs. Windows Server 2008 R2 w/ OFED setup mentioned earlier.

I've seen both FC and iSCSI fabrics demonstrate the same type of random small block I/O performance anomalies with Linux/SCSI clients too. The v3.x Linux/SCSI clients are certainly better in the multi-lun per host small block random I/O case, but single LUN performance is (still) lacking compared to everything else.

Also RHEL 6.2 does have the scsi-host-lock less bits in place now, but it's been more a matter of converting OFED ib_srp code to run in host-lock less mode to realize extra gains for multi-lun per host.

#51 lore raw
In reply to Nicholas A. Bellinger

Hi folks,

Quoted 4 lines · Nicholas A. Bellinger

To give an idea of how things are looking on the performance side, here some initial numbers for small block (4k) mixed random IOPs using the following fio test setup:

<SNIP>

Quoted 6 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

After checking the original benchmarks here again, I realized that for virtio-scsi+tcm_vhost the results where actually switched..

So this should have been: heavier READ case (25 / 75) == 55K, and heavier WRITE case (75 / 25) == 45K.

Quoted 9 lines

In the first case, virtio-scsi+tcm_vhost is out performing by 3x compared to virtio-scsi-raw using QEMU SCSI emulation with the same raw flash backend device. For the second case heavier WRITE case, tcm_vhost is nearing full bare-metal utilization (~55K vs. ~60K).

Also converting tcm_vhost to use proper cmwq process context I/O submission will help to get even closer to bare metal speeds for both work-loads.

Here are initial follow-up virtio-scsi randrw 4k benchmarks with tcm_vhost recently converted to run backend I/O dispatch via modern cmwq primitives (kworkerd).

fio randrw 4k workload | virtio-scsi+tcm_vhost+cmwq
---------------------------------------------------
25 Write / 75 Read | ~60K
75 Write / 25 Read | ~45K

So aside from the minor performance improvement for the 25 / 75 workload, the other main improvement is lower CPU usage using the iomemory_vsl backends. This is attributed to cmwq providing process context on the same core as the vhost thread pulling items off vq, which ends up being on the order of 1/3 less host CPU usage (for both workloads) primarly from positive cache effects.

This patch is now available in target-pending/tcm_vhost, and I'll be respinning the initial merge series into for-next-merge over the next days + another round of list review.

Please let us know if you have any concerns.

Thanks!

--nab

#52 lore raw
In reply to Nicholas A. Bellinger

Hi folks,

Quoted 4 lines · Nicholas A. Bellinger

To give an idea of how things are looking on the performance side, here some initial numbers for small block (4k) mixed random IOPs using the following fio test setup:

<SNIP>

Quoted 6 lines

fio randrw workload | virtio-scsi-raw | virtio-scsi+tcm_vhost | bare-metal raw block
------------------------------------------------------------------------------------

25 Write / 75 Read  |      ~15K       |         ~45K          |         ~70K
75 Write / 25 Read  |      ~20K       |         ~55K          |         ~60K

After checking the original benchmarks here again, I realized that for virtio-scsi+tcm_vhost the results where actually switched..

So this should have been: heavier READ case (25 / 75) == 55K, and heavier WRITE case (75 / 25) == 45K.

Quoted 9 lines

In the first case, virtio-scsi+tcm_vhost is out performing by 3x compared to virtio-scsi-raw using QEMU SCSI emulation with the same raw flash backend device. For the second case heavier WRITE case, tcm_vhost is nearing full bare-metal utilization (~55K vs. ~60K).

Also converting tcm_vhost to use proper cmwq process context I/O submission will help to get even closer to bare metal speeds for both work-loads.

Here are initial follow-up virtio-scsi randrw 4k benchmarks with tcm_vhost recently converted to run backend I/O dispatch via modern cmwq primitives (kworkerd).

fio randrw 4k workload | virtio-scsi+tcm_vhost+cmwq
---------------------------------------------------
25 Write / 75 Read | ~60K
75 Write / 25 Read | ~45K

So aside from the minor performance improvement for the 25 / 75 workload, the other main improvement is lower CPU usage using the iomemory_vsl backends. This is attributed to cmwq providing process context on the same core as the vhost thread pulling items off vq, which ends up being on the order of 1/3 less host CPU usage (for both workloads) primarly from positive cache effects.

This patch is now available in target-pending/tcm_vhost, and I'll be respinning the initial merge series into for-next-merge over the next days + another round of list review.

Please let us know if you have any concerns.

Thanks!

--nab