Staging: hv: storvsc: Move the storage driver out of the staging area
Subsystems (3)
PATCH 1/1 Staging: hv: storvsc: Move the storage driver out of the staging area
The storage driver (storvsc_drv.c) handles all block storage devices assigned to Linux guests hosted on Hyper-V. This driver has been in the staging tree for a while and this patch moves it out of the staging area. As per Greg's recommendation, this patch makes no changes to the staging/hv directory. Once the driver moves out of staging, we will cleanup the staging/hv directory.
This patch includes all the patches that I have sent against the staging/hv tree to address the comments I have gotten to date on this storage driver.
--- drivers/scsi/Kconfig | 8 + drivers/scsi/Makefile | 3 + drivers/scsi/storvsc_drv.c | 1567 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1578 insertions(+), 0 deletions(-) create mode 100644 drivers/scsi/storvsc_drv.c
drivers/scsi/Kconfig +8 -0
@@ -676,6 +676,14 @@ config VMWARE_PVSCSI To compile this driver as a module, choose M here: the module will be called vmw_pvscsi. +config HYPERV_STORAGE + tristate "Microsoft Hyper-V virtual storage driver" + depends on SCSI && HYPERV + default HYPERV + help + Select this option to enable the Hyper-V virtual storage driver. + + config LIBFC tristate "LibFC module" select SCSI_FC_ATTRS
drivers/scsi/Makefile +3 -0
@@ -142,6 +142,7 @@ obj-$(CONFIG_SCSI_BNX2_ISCSI) += libiscsi.o bnx2i/ obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/ obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o obj-$(CONFIG_VMWARE_PVSCSI) += vmw_pvscsi.o +obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o obj-$(CONFIG_ARM) += arm/
@@ -170,6 +171,8 @@ scsi_mod-$(CONFIG_SCSI_PROC_FS) += scsi_proc.o scsi_mod-y += scsi_trace.o scsi_mod-$(CONFIG_PM) += scsi_pm.o +hv_storvsc-y := storvsc_drv.o + scsi_tgt-y += scsi_tgt_lib.o scsi_tgt_if.o sd_mod-objs := sd.o
drivers/scsi/storvsc_drv.c new file +1567 -0
1,567 lines not on this page · raw message
Signature · 1 line
1.7.4.1
James Bottomley
maintainerQuoted 9 lines · K. Y. Srinivasan
The storage driver (
storvsc_drv.c) handles all block storage devices assigned to Linux guests hosted on Hyper-V. This driver has been in the staging tree for a while and this patch moves it out of the staging area. As per Greg's recommendation, this patch makes no changes to the staging/hv directory. Once the driver moves out of staging, we will cleanup the staging/hv directory.This patch includes all the patches that I have sent against the staging/hv tree to address the comments I have gotten to date on this storage driver.
First comment is that it would have been easier to see the individual patches for comment before you committed them.
The way you did mempool isn't entirely right: the problem is that to prevent a memory to I/O deadlock we need to ensure forward progress on the drain device. Just having 64 commands available to the host doesn't necessarily achieve this because LUN1 could consume them all and starve LUN0 which is the drain device leading to the deadlock, so the mempool really needs to be per device using slave_alloc.
+static int storvsc_device_alloc(struct scsi_device *sdevice) +{
+ /*
+ * This enables luns to be located sparsely. Otherwise, we may not
+ * discovered them.
+ */
+ sdevice->sdev_bflags |= BLIST_SPARSELUN | BLIST_LARGELUN;
+ return 0;
+}
Looks bogus ... this should happen automatically for SCSI-3 devices ... unless your hypervisor has some strange (and wrong) identification? I really think you want to use SCSI-3 because it will do report LUN scanning, which consumes far fewer resources.
I still think you need to disable clustering and junk the bvec merge function. Your object seems to be to accumulate in page size multiples (and not aggregate over this) ... that's what clustering is designed to do.
James
Quoted 20 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Thursday, November 17, 2011 1:27 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Staging: hv: storvsc: Move the storage driver out of the staging areaQuoted 7 lines · K. Y. Srinivasan
The storage driver (
storvsc_drv.c) handles all block storage devices assigned to Linux guests hosted on Hyper-V. This driver has been in the staging tree for a while and this patch moves it out of the staging area. As per Greg's recommendation, this patch makes no changes to the staging/hv directory. Once the driver moves out of staging, we will cleanup the staging/hv directory.
Quoted 5 lines
Quoted 2 lines
This patch includes all the patches that I have sent against the staging/hv tree to address the comments I have gotten to date on this storage driver.
First comment is that it would have been easier to see the individual patches for comment before you committed them.
I am not sure if the patches have been committed yet. All patches were sent to various mailing lists and you were copied as well. In the future, I will include the scsi mailing list in the set of lists I include for the staging patches.
Quoted 7 lines
The way you did mempool isn't entirely right: the problem is that to prevent a memory to I/O deadlock we need to ensure forward progress on the drain device. Just having 64 commands available to the host doesn't necessarily achieve this because LUN1 could consume them all and starve LUN0 which is the drain device leading to the deadlock, so the mempool really needs to be per device using
slave_alloc.
I will do this per LUN.
Quoted 11 lines
drivers/scsi/storvsc_drv.c new file +9
-0+static int storvsc_device_alloc (struct scsi_device *sdevice) +{ +/* +* This enables luns to be located sparsely. Otherwise, we may not +* discovered them. +*/ + sdevice->sdev_bflags |=BLIST_SPARSELUN |BLIST_LARGELUN ; +return 0 ; +}
Quoted 4 lines
Looks bogus ... this should happen automatically for SCSI-3 devices ... unless your hypervisor has some strange (and wrong) identification? I really think you want to use SCSI-3 because it will do report LUN scanning, which consumes far fewer resources.
I will see if I can clean this up.
Quoted 5 lines
I still think you need to disable clustering and junk the bvec merge function. Your object seems to be to accumulate in page size multiples (and not aggregate over this) ... that's what clustering is designed to do.
As part of addressing your first round of comments, I experimented with your suggestions and I could not get rid of the code that does the bounce buffer handling. I could generate I/O patterns that would require bounce buffer handling with your suggestions in place.
Regards,
K. Y
James Bottomley
maintainerQuoted 9 lines · KY Srinivasan
Quoted 4 lines
I still think you need to disable clustering and junk the bvec merge function. Your object seems to be to accumulate in page size multiples (and not aggregate over this) ... that's what clustering is designed to do.
As part of addressing your first round of comments, I experimented with your suggestions and I could not get rid of the code that does the bounce buffer handling. I could generate I/O patterns that would require bounce buffer handling with your suggestions in place.
There are two separate things here. One is the scatter gather list bounce buffer processing, which is a bit nasty, but if you want to use < 4kb block size filesystems, I suppose I have to accept that you need it (although since it's a global fault of the hypervisor, perhaps it should sit in the hypervisor interface layer, so that every SG based transport can use it). The other is the biovec merge function addition. The purpose of this function seems to be to ensure you get one SG entry for every page (if I read it right)? In that case, you don't need any of this special casing. The flag DISABLE_CLUSTERING achieves the same thing.
James
Quoted 25 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Friday, November 18, 2011 12:01 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 1/1] Staging: hv: storvsc: Move the storage driver out of the staging areaQuoted 7 lines · KY Srinivasan
Quoted 4 lines
I still think you need to disable clustering and junk the bvec merge function. Your object seems to be to accumulate in page size multiples (and not aggregate over this) ... that's what clustering is designed to do.
As part of addressing your first round of comments, I experimented with your suggestions and I could not get rid of the code that does the bounce buffer
handling.
Quoted 1 line
I could generate I/O patterns that would require bounce buffer handling with
your
Quoted 1 line
suggestions in place.
Quoted 10 lines
There are two separate things here. One is the scatter gather list bounce buffer processing, which is a bit nasty, but if you want to use < 4kb block size filesystems, I suppose I have to accept that you need it (although since it's a global fault of the hypervisor, perhaps it should sit in the hypervisor interface layer, so that every SG based transport can use it). The other is the biovec merge function addition. The purpose of this function seems to be to ensure you get one SG entry for every page (if I read it right)? In that case, you don't need any of this special casing. The flag
DISABLE_CLUSTERINGachieves the same thing.
Thanks James. I will keep you posted on my progress on this issue.
Regards,
K. Y
Quoted 37 lines
-----Original Message-----
From: KY Srinivasan
Sent: Thursday, November 17, 2011 11:53 PM
To: 'James Bottomley'
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 1/1] Staging: hv: storvsc: Move the storage driver out of the staging areaQuoted 8 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Thursday, November 17, 2011 1:27 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Staging: hv: storvsc: Move the storage driver out ofthe
Quoted 7 lines
staging area
Quoted 4 lines · K. Y. Srinivasan
The storage driver (
storvsc_drv.c) handles all block storage devices assigned to Linux guests hosted on Hyper-V. This driver has been in the staging tree for a while and this patch moves it out of the staging area. As per Greg's recommendation, this patch makes no changes to thestaging/hv
Quoted 6 lines
Quoted 5 lines
directory. Once the driver moves out of staging, we will cleanup the staging/hv directory.
This patch includes all the patches that I have sent against the staging/hv tree to address the comments I have gotten to date on this storage driver.
Quoted 6 lines
Quoted 2 lines
First comment is that it would have been easier to see the individual patches for comment before you committed them.
I am not sure if the patches have been committed yet. All patches were sent to various mailing lists and you were copied as well. In the future, I will include the scsi mailing list in the set of lists I include for the staging patches.
Greg has checked in these patches now.
Quoted 9 lines
Quoted 8 lines
The way you did mempool isn't entirely right: the problem is that to prevent a memory to I/O deadlock we need to ensure forward progress on the drain device. Just having 64 commands available to the host doesn't necessarily achieve this because LUN1 could consume them all and starve LUN0 which is the drain device leading to the deadlock, so the mempool really needs to be per device using
slave_alloc.
Presently, Linux on Hyper-V can only boot from IDE devices. While IDE devices are handled via this stor driver, the way we handle them is a little different compared to block devices configured as scsi devices:
For IDE devices; we have a HBA per LUN. Given that for a long time the drain device will be an IDE device, my current implementation does address the concern that you had raised with regards to deadlock avoidance.
Quoted 12 lines
Quoted 12 lines
drivers/scsi/storvsc_drv.c new file +9
-0+static int storvsc_device_alloc (struct scsi_device *sdevice) +{ +/* +* This enables luns to be located sparsely. Otherwise, we may not +* discovered them. +*/ + sdevice->sdev_bflags |=BLIST_SPARSELUN |BLIST_LARGELUN ; +return 0 ; +}
Quoted 5 lines
Quoted 4 lines
Looks bogus ... this should happen automatically for SCSI-3 devices ... unless your hypervisor has some strange (and wrong) identification? I really think you want to use SCSI-3 because it will do report LUN scanning, which consumes far fewer resources.
Done.
Quoted 6 lines
Quoted 6 lines
I still think you need to disable clustering and junk the bvec merge function. Your object seems to be to accumulate in page size multiples (and not aggregate over this) ... that's what clustering is designed to do.
Done. James, I am going to send you (and the scsi mailing list) the patches addressing your comments. I will also send out a consolidated patch for getting the driver out of staging as well. I would like to thank you for your help in cleaning up this driver.
Regards,
K. Y