Add XEN pvSCSI support
Subsystems (3)
[email protected]
maintainerThis series adds XEN pvSCSI support. With pvSCSI it is possible to use physical SCSI devices from a XEN domain.
The support consists of a backend in the privileged Domain-0 doing the real I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.
The code is taken (and adapted) from the original pvSCSI implementation done for Linux 2.6 in 2008 by Fujitsu.
[PATCH V2 1/4] Add XEN pvSCSI protocol description [PATCH V2 2/4] Introduce xen-scsifront module [PATCH V2 3/4] Introduce XEN scsiback module [PATCH V2 4/4] add xen pvscsi maintainer
Changes in V4:
- Re-add define for VSCSIIF_ACT_SCSI_SG_PRESET to vscsiif.h to indicate this action value should not be used in future enhancements
Changes in V3:
- added some comments to the protocol header file
- removed the CDB emulation from xen-scsiback, handled by core target infrastructure
- several changes in xen-scsifront after comments from Christoph Hellwig
Changes in V2:
- use core target infrastructure by backend instead of pure SCSI passthrough
- add support for larger SG lists by putting them in grant page(s)
- add command abort capability
[email protected]
maintainerPATCH v4 1/4 Introduce xen-scsifront module
From: Juergen Gross <[email protected]>
Introduces the XEN pvSCSI frontend. With pvSCSI it is possible for a XEN domU to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands are passed to the pvSCSI backend in a driver domain (usually Dom0) which is owner of the physical device. This allows e.g. to use SCSI tape drives in a XEN domU.
The code is taken from the pvSCSI implementation in XEN done by Fujitsu based on Linux kernel 2.6.18.
Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- move module to appropriate location in kernel tree
- adapt to Linux style guide
- some minor code simplifications
- replace constants with defines
- remove not used defines
- add support for larger SG lists by putting them in a granted page
Xen related parts
--- drivers/scsi/Kconfig | 9 + drivers/scsi/Makefile | 1 + drivers/scsi/xen-scsifront.c | 1011 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1021 insertions(+) create mode 100644 drivers/scsi/xen-scsifront.c
drivers/scsi/Kconfig +9 -0
@@ -611,6 +611,15 @@ config VMWARE_PVSCSI To compile this driver as a module, choose M here: the module will be called vmw_pvscsi. +config XEN_SCSI_FRONTEND + tristate "XEN SCSI frontend driver" + depends on SCSI && XEN + help + The XEN SCSI frontend driver allows the kernel to access SCSI Devices + within another guest OS (usually Dom0). + Only needed if the kernel is running in a XEN guest and generic + SCSI access to a device is needed. + config HYPERV_STORAGE tristate "Microsoft Hyper-V virtual storage driver" depends on SCSI && HYPERV
drivers/scsi/Makefile +1 -0
@@ -144,6 +144,7 @@ obj-$(CONFIG_SCSI_ESAS2R) += esas2r/ obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o obj-$(CONFIG_SCSI_VIRTIO) += virtio_scsi.o obj-$(CONFIG_VMWARE_PVSCSI) += vmw_pvscsi.o +obj-$(CONFIG_XEN_SCSI_FRONTEND) += xen-scsifront.o obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o obj-$(CONFIG_ARM) += arm/
drivers/scsi/xen-scsifront.c new file +1011 -0
1,011 lines not on this page · raw message
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 1/4 Introduce xen-scsifront module
In reply to [email protected]From: Juergen Gross <[email protected]>
Introduces the XEN pvSCSI frontend. With pvSCSI it is possible for a XEN domU to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands are passed to the pvSCSI backend in a driver domain (usually Dom0) which is owner of the physical device. This allows e.g. to use SCSI tape drives in a XEN domU.
The code is taken from the pvSCSI implementation in XEN done by Fujitsu based on Linux kernel 2.6.18.
Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- move module to appropriate location in kernel tree
- adapt to Linux style guide
- some minor code simplifications
- replace constants with defines
- remove not used defines
- add support for larger SG lists by putting them in a granted page
Xen related parts
--- drivers/scsi/Kconfig | 9 + drivers/scsi/Makefile | 1 + drivers/scsi/xen-scsifront.c | 1011 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1021 insertions(+) create mode 100644 drivers/scsi/xen-scsifront.c
drivers/scsi/Kconfig +9 -0
@@ -611,6 +611,15 @@ config VMWARE_PVSCSI To compile this driver as a module, choose M here: the module will be called vmw_pvscsi. +config XEN_SCSI_FRONTEND + tristate "XEN SCSI frontend driver" + depends on SCSI && XEN + help + The XEN SCSI frontend driver allows the kernel to access SCSI Devices + within another guest OS (usually Dom0). + Only needed if the kernel is running in a XEN guest and generic + SCSI access to a device is needed. + config HYPERV_STORAGE tristate "Microsoft Hyper-V virtual storage driver" depends on SCSI && HYPERV
drivers/scsi/Makefile +1 -0
@@ -144,6 +144,7 @@ obj-$(CONFIG_SCSI_ESAS2R) += esas2r/ obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o obj-$(CONFIG_SCSI_VIRTIO) += virtio_scsi.o obj-$(CONFIG_VMWARE_PVSCSI) += vmw_pvscsi.o +obj-$(CONFIG_XEN_SCSI_FRONTEND) += xen-scsifront.o obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o obj-$(CONFIG_ARM) += arm/
drivers/scsi/xen-scsifront.c new file +1011 -0
1,011 lines not on this page · raw message
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 2/4 Introduce XEN scsiback module
In reply to [email protected]From: Juergen Gross <[email protected]>
Introduces the XEN pvSCSI backend. With pvSCSI it is possible for a XEN domU to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands are passed to the pvSCSI backend in a driver domain (usually Dom0) which is owner of the physical device. This allows e.g. to use SCSI tape drives in a XEN domU.
The code is taken from the pvSCSI implementation in XEN done by Fujitsu based on Linux kernel 2.6.18.
Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- adapt to Linux style guide
- use target core infrastructure instead doing pure pass-through
- enable module unloading
- support SG-list in grant page(s)
- support task abort
- remove redundant struct backend
- allocate resources dynamically
- correct minor error in scsiback_fast_flush_area
- free allocated resources in case of error during I/O preparation
- remove CDB emulation, now handled by target core infrastructure
Xen related parts
--- drivers/xen/Kconfig | 9 + drivers/xen/Makefile | 1 + drivers/xen/xen-scsiback.c | 2282 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2292 insertions(+) create mode 100644 drivers/xen/xen-scsiback.c
drivers/xen/Kconfig +9 -0
@@ -172,6 +172,15 @@ config XEN_PCIDEV_BACKEND If in doubt, say m. +config XEN_SCSI_BACKEND + tristate "XEN SCSI backend driver" + depends on XEN && XEN_BACKEND && TARGET_CORE + help + The SCSI backend driver allows the kernel to export its SCSI Devices + to other guests via a high-performance shared-memory interface. + Only needed for systems running as XEN driver domains (e.g. Dom0) and + if guests need generic access to SCSI devices. + config XEN_PRIVCMD tristate depends on XEN
drivers/xen/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_XEN_STUB) += xen-stub.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY) += xen-acpi-memhotplug.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU) += xen-acpi-cpuhotplug.o obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o +obj-$(CONFIG_XEN_SCSI_BACKEND) += xen-scsiback.o xen-evtchn-y := evtchn.o xen-gntdev-y := gntdev.o xen-gntalloc-y := gntalloc.o
drivers/xen/xen-scsiback.c new file +2282 -0
2,282 lines not on this page · raw message
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 2/4 Introduce XEN scsiback module
In reply to [email protected]From: Juergen Gross <[email protected]>
Introduces the XEN pvSCSI backend. With pvSCSI it is possible for a XEN domU to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands are passed to the pvSCSI backend in a driver domain (usually Dom0) which is owner of the physical device. This allows e.g. to use SCSI tape drives in a XEN domU.
The code is taken from the pvSCSI implementation in XEN done by Fujitsu based on Linux kernel 2.6.18.
Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- adapt to Linux style guide
- use target core infrastructure instead doing pure pass-through
- enable module unloading
- support SG-list in grant page(s)
- support task abort
- remove redundant struct backend
- allocate resources dynamically
- correct minor error in scsiback_fast_flush_area
- free allocated resources in case of error during I/O preparation
- remove CDB emulation, now handled by target core infrastructure
Xen related parts
--- drivers/xen/Kconfig | 9 + drivers/xen/Makefile | 1 + drivers/xen/xen-scsiback.c | 2282 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2292 insertions(+) create mode 100644 drivers/xen/xen-scsiback.c
drivers/xen/Kconfig +9 -0
@@ -172,6 +172,15 @@ config XEN_PCIDEV_BACKEND If in doubt, say m. +config XEN_SCSI_BACKEND + tristate "XEN SCSI backend driver" + depends on XEN && XEN_BACKEND && TARGET_CORE + help + The SCSI backend driver allows the kernel to export its SCSI Devices + to other guests via a high-performance shared-memory interface. + Only needed for systems running as XEN driver domains (e.g. Dom0) and + if guests need generic access to SCSI devices. + config XEN_PRIVCMD tristate depends on XEN
drivers/xen/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_XEN_STUB) += xen-stub.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY) += xen-acpi-memhotplug.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU) += xen-acpi-cpuhotplug.o obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o +obj-$(CONFIG_XEN_SCSI_BACKEND) += xen-scsiback.o xen-evtchn-y := evtchn.o xen-gntdev-y := gntdev.o xen-gntalloc-y := gntalloc.o
drivers/xen/xen-scsiback.c new file +2282 -0
2,282 lines not on this page · raw message
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 3/4 add xen pvscsi maintainer
In reply to [email protected]From: Juergen Gross <[email protected]>
Add myself as maintainer for the Xen pvSCSI stuff.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -10046,6 +10046,14 @@ S: Supported F: arch/x86/pci/*xen* F: drivers/pci/*xen* +XEN PVSCSI DRIVERS +M: Juergen Gross <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Supported +F: drivers/scsi/xen-scsifront.c +F: drivers/xen/xen-scsiback.c +F: include/xen/interface/io/vscsiif.h + XEN SWIOTLB SUBSYSTEM M: Konrad Rzeszutek Wilk <[email protected]> L: [email protected] (moderated for non-subscribers)
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 3/4 add xen pvscsi maintainer
In reply to [email protected]From: Juergen Gross <[email protected]>
Add myself as maintainer for the Xen pvSCSI stuff.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -10046,6 +10046,14 @@ S: Supported F: arch/x86/pci/*xen* F: drivers/pci/*xen* +XEN PVSCSI DRIVERS +M: Juergen Gross <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Supported +F: drivers/scsi/xen-scsifront.c +F: drivers/xen/xen-scsiback.c +F: include/xen/interface/io/vscsiif.h + XEN SWIOTLB SUBSYSTEM M: Konrad Rzeszutek Wilk <[email protected]> L: [email protected] (moderated for non-subscribers)
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 4/4 Save command pool address of Scsi_Host
In reply to [email protected]From: Juergen Gross <[email protected]>
If a scsi host driver specifies .cmd_len in it's scsi_host_template, a driver's private command pool is needed. scsi_find_host_cmd_pool() will locate it, but scsi_alloc_host_cmd_pool() isn't saving the pool address in the host template.
This will result in an access error when the host is removed.
Avoid the problem by saving the address of a new allocated command pool where it is expected.
--- drivers/scsi/scsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/scsi.c +10 -2
@@ -380,6 +380,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) pool->slab_flags |=SLAB_CACHE_DMA ; pool->gfp_mask = __GFP_DMA; } + +if (hostt->cmd_size) + hostt->cmd_pool = pool; +return pool; }
@@ -424,8 +428,10 @@ out: out_free_slab:kmem_cache_destroy (pool->cmd_slab); out_free_pool: -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } goto out; }
@@ -447,8 +453,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost)if (!--pool->users) {kmem_cache_destroy (pool->cmd_slab);kmem_cache_destroy (pool->sense_slab); -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } }mutex_unlock (&host_cmd_pool_mutex); }
Signature · 1 line
1.8.4.5
[email protected]
maintainerPATCH v4 4/4 Save command pool address of Scsi_Host
In reply to [email protected]From: Juergen Gross <[email protected]>
If a scsi host driver specifies .cmd_len in it's scsi_host_template, a driver's private command pool is needed. scsi_find_host_cmd_pool() will locate it, but scsi_alloc_host_cmd_pool() isn't saving the pool address in the host template.
This will result in an access error when the host is removed.
Avoid the problem by saving the address of a new allocated command pool where it is expected.
--- drivers/scsi/scsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/scsi.c +10 -2
@@ -380,6 +380,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) pool->slab_flags |=SLAB_CACHE_DMA ; pool->gfp_mask = __GFP_DMA; } + +if (hostt->cmd_size) + hostt->cmd_pool = pool; +return pool; }
@@ -424,8 +428,10 @@ out: out_free_slab:kmem_cache_destroy (pool->cmd_slab); out_free_pool: -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } goto out; }
@@ -447,8 +453,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost)if (!--pool->users) {kmem_cache_destroy (pool->cmd_slab);kmem_cache_destroy (pool->sense_slab); -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } }mutex_unlock (&host_cmd_pool_mutex); }
Signature · 1 line
1.8.4.5
Jürgen Groß
maintainerSorry, please ignore.
One wrong patch slipped in, while one is missing.
Will resend with correct patches.
Juergen
Quoted 35 lines · On 08/08/2014 09:43 AM, [email protected] wrote:
This series adds XEN pvSCSI support. With pvSCSI it is possible to use physical SCSI devices from a XEN domain.
The support consists of a backend in the privileged Domain-0 doing the real I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.
The code is taken (and adapted) from the original pvSCSI implementation done for Linux 2.6 in 2008 by Fujitsu.
[PATCH V2 1/4] Add XEN pvSCSI protocol description [PATCH V2 2/4] Introduce xen-scsifront module [PATCH V2 3/4] Introduce XEN scsiback module [PATCH V2 4/4] add xen pvscsi maintainer
Changes in V4:
- Re-add define forVSCSIIF_ACT_SCSI_SG_PRESETtovscsiif.hto indicate this action value should not be used in future enhancementsChanges in V3:
- added some comments to the protocol header file
- removed the CDB emulation from xen-scsiback, handled by core target infrastructure
- several changes in xen-scsifront after comments from Christoph HellwigChanges in V2:
- use core target infrastructure by backend instead of pure SCSI passthrough
- add support for larger SG lists by putting them in grant page(s)
- add command abort capability_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Jürgen Groß
maintainerSorry, please ignore.
One wrong patch slipped in, while one is missing.
Will resend with correct patches.
Juergen
Quoted 35 lines · On 08/08/2014 09:43 AM, [email protected] wrote:
This series adds XEN pvSCSI support. With pvSCSI it is possible to use physical SCSI devices from a XEN domain.
The support consists of a backend in the privileged Domain-0 doing the real I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.
The code is taken (and adapted) from the original pvSCSI implementation done for Linux 2.6 in 2008 by Fujitsu.
[PATCH V2 1/4] Add XEN pvSCSI protocol description [PATCH V2 2/4] Introduce xen-scsifront module [PATCH V2 3/4] Introduce XEN scsiback module [PATCH V2 4/4] add xen pvscsi maintainer
Changes in V4:
- Re-add define forVSCSIIF_ACT_SCSI_SG_PRESETtovscsiif.hto indicate this action value should not be used in future enhancementsChanges in V3:
- added some comments to the protocol header file
- removed the CDB emulation from xen-scsiback, handled by core target infrastructure
- several changes in xen-scsifront after comments from Christoph HellwigChanges in V2:
- use core target infrastructure by backend instead of pure SCSI passthrough
- add support for larger SG lists by putting them in grant page(s)
- add command abort capability_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH V4 4/4] Save command pool address of Scsi_Host
In reply to [email protected]Any chance to get a review for this once so I can queued it up for 3.17?
Quoted 62 lines · On Fri, Aug 08, 2014 at 09:44:00AM +0200, [email protected] wrote:
From: Juergen Gross <[email protected]>
If a scsi host driver specifies .cmd_len in it's
scsi_host_template, a driver's private command pool is needed.scsi_find_host_cmd_pool()will locate it, butscsi_alloc_host_cmd_pool()isn't saving the pool address in the host template.This will result in an access error when the host is removed.
Avoid the problem by saving the address of a new allocated command pool where it is expected.
Signed-off-by Juergen Gross <[email protected]>--- drivers/scsi/scsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/scsi/scsi.c +10
-2@@ -380,6 +380,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) pool->slab_flags |=SLAB_CACHE_DMA ; pool->gfp_mask = __GFP_DMA; } + +if (hostt->cmd_size) + hostt->cmd_pool = pool; +return pool; }@@ -424,8 +428,10 @@ out: out_free_slab:kmem_cache_destroy (pool->cmd_slab); out_free_pool: -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } goto out; }@@ -447,8 +453,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost)if (!--pool->users) {kmem_cache_destroy (pool->cmd_slab);kmem_cache_destroy (pool->sense_slab); -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } }mutex_unlock (&host_cmd_pool_mutex); }Signature · 6 lines
1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
Re: [PATCH V4 4/4] Save command pool address of Scsi_Host
In reply to [email protected]Any chance to get a review for this once so I can queued it up for 3.17?
Quoted 62 lines · On Fri, Aug 08, 2014 at 09:44:00AM +0200, [email protected] wrote:
From: Juergen Gross <[email protected]>
If a scsi host driver specifies .cmd_len in it's
scsi_host_template, a driver's private command pool is needed.scsi_find_host_cmd_pool()will locate it, butscsi_alloc_host_cmd_pool()isn't saving the pool address in the host template.This will result in an access error when the host is removed.
Avoid the problem by saving the address of a new allocated command pool where it is expected.
Signed-off-by Juergen Gross <[email protected]>--- drivers/scsi/scsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/scsi/scsi.c +10
-2@@ -380,6 +380,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) pool->slab_flags |=SLAB_CACHE_DMA ; pool->gfp_mask = __GFP_DMA; } + +if (hostt->cmd_size) + hostt->cmd_pool = pool; +return pool; }@@ -424,8 +428,10 @@ out: out_free_slab:kmem_cache_destroy (pool->cmd_slab); out_free_pool: -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } goto out; }@@ -447,8 +453,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost)if (!--pool->users) {kmem_cache_destroy (pool->cmd_slab);kmem_cache_destroy (pool->sense_slab); -if (hostt->cmd_size) +if (hostt->cmd_size) {scsi_free_host_cmd_pool (pool); + hostt->cmd_pool =NULL ; + } }mutex_unlock (&host_cmd_pool_mutex); }Signature · 6 lines
1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---