Skip to contentSkip to conversation

pvSCSI (SCSI pass through) driver

PATCH In review Jun Kamada 6 participants 33 messages Oct 19, 2007 – Nov 12, 2007

Subsystems (2)
lore
Share & tools
lore

Jun Kamada

author
#0 lore raw

cover pvSCSI (SCSI pass through) driver

Hi all,

I will send total five patches on following e-mails.

These patches provide functionality that guest domain can issue complete SCSI command to FC-SCSI HBA(Fibre Channel SCSI Host Bus Adapter) assigned to the guest domain.
Using this functionality, guest domain can control such as tape device for backup and so on.

We hope these patches will be merged into Xen 3.2.0.

Thanks,

-----
Jun Kamada

#1 lore raw

This seems to have been hanging around for ages. If there's no argument otherwise I'll give it a read through and stick it in for 3.2.0.

-- Keir

Quoted 23 lines · Jun Kamada

Hi all,

I will send total five patches on following e-mails.

These patches provide functionality that guest domain can issue complete SCSI command to FC-SCSI HBA(Fibre Channel SCSI Host Bus Adapter) assigned to the guest domain.
Using this functionality, guest domain can control such as tape device for backup and so on.

We hope these patches will be merged into Xen 3.2.0.

Thanks,

-----
Jun Kamada

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 1 line

This seems to have been hanging around for ages. If there's no

argument

Quoted 1 line

otherwise I'll give it a read through and stick it in for 3.2.0.

Yep, its certainly a candidate for 3.2, but I'd class the API as "experimental" at this stage and not commit to supporting it going forward as-is just yet.

Things I'd like to see:
* performance results (hopefully at the summit!)
* variable sized comms rings (fixed at connect time) so we can queue
more descriptors if req'd.
* support for pass through of individual scsi logical units to the
dom0's linux scsi-generic layer rather than whole HBAs -- I think most users will want to hide all that FC nastiness and just present a LUN.

Best,
Ian

Quoted 27 lines
Quoted 4 lines

These patches provide functionality that guest domain can issue complete SCSI command to FC-SCSI HBA(Fibre Channel SCSI Host Bus Adapter) assigned to the guest domain.
Using this functionality, guest domain can control such as tape

device

Quoted 11 lines

for backup and so on.

We hope these patches will be merged into Xen 3.2.0.

Thanks,

-----
Jun Kamada

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#3 lore raw

Hi Keir-san, Ian-san,

Thank you so much for your positive response.

Quoted 7 lines · On Fri, 19 Oct 2007 11:20:28 +0100 "Ian Pratt" <[email protected]> wrote:
Quoted 1 line

This seems to have been hanging around for ages. If there's no

argument

Quoted 1 line

otherwise I'll give it a read through and stick it in for 3.2.0.

Yep, its certainly a candidate for 3.2, but I'd class the API as "experimental" at this stage and not commit to supporting it going forward as-is just yet.

Do you mean that the API is "xm" command interface such as "xm scsihost-attach" or Xen-API?
If the former, we also consider the expansion of the interface is needed. The interface should conform to VM migration that the VM can continue to use same ID before and after the migration. On FC-SCSI, the ID may be WWPN (World Wide Port Name).

Quoted 2 lines

Things I'd like to see:
* performance results (hopefully at the summit!)

We are planning to report performance data on next Xen Summit.

Quoted 5 lines

* variable sized comms rings (fixed at connect time) so we can queue
more descriptors if req'd.
* support for pass through of individual scsi logical units to the
dom0's linux scsi-generic layer rather than whole HBAs -- I think most users will want to hide all that FC nastiness and just present a LUN.

We also recognize the usefulness of above feature. However, I heard that the method for specifying LUN is vender dependent. Implementation may be difficult by non-technical reason.

-----
Jun Kamada
[email protected]

#4 lore raw
In reply to Jun Kamada
Quoted 4 lines

Hi all,

I will send total five patches on following e-mails.

Quoted 8 lines

These patches provide functionality that guest domain can issue complete SCSI command to FC-SCSI HBA(Fibre Channel SCSI Host Bus Adapter) assigned to the guest domain.
Using this functionality, guest domain can control such as tape device for backup and so on.

We hope these patches will be merged into Xen 3.2.0.

I am very interested in this functionality, but mainly from a Windows point of view (doing test restores of backups for customers). What would be involved in getting this working under a HVM domain in the absence of PV drivers?

Failing that, I'll see if I can incorporate it into the Windows PV drivers I'm working on...

Thanks

James

author
#5 lore raw

Hi James-san,

Thank you for your interests in our pvSCSI driver.

Quoted 7 lines · On Mon, 22 Oct 2007 10:07:40 +1000 "James Harper"…

I am very interested in this functionality, but mainly from a Windows point of view (doing test restores of backups for customers). What would be involved in getting this working under a HVM domain in the absence of PV drivers?

Failing that, I'll see if I can incorporate it into the Windows PV drivers I'm working on...

I appreciate your proposal because I don't have skill for developing Windows driver. I suppose that the pvSCSI functionality is useful for Windows too.

Thanks,

-----
Jun Kamada

#6 lore raw
In reply to Jun Kamada

What's the CONFIG_XEN_FC stuff all about? It doesn't appear to be configurable (so it's always off), it's ifdef'ed all over the place, and there are dead files (e.g., fcfront.c) that presumably would depend on that option.

Either it needs to be plumbed in properly, or the XEN_FC stuff needs to be stripped out entirely from this patchset.

-- Keir

Quoted 23 lines · Jun Kamada

Hi all,

I will send total five patches on following e-mails.

These patches provide functionality that guest domain can issue complete SCSI command to FC-SCSI HBA(Fibre Channel SCSI Host Bus Adapter) assigned to the guest domain.
Using this functionality, guest domain can control such as tape device for backup and so on.

We hope these patches will be merged into Xen 3.2.0.

Thanks,

-----
Jun Kamada

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#7 lore raw

Dear Keir-san,

Quoted 7 lines · On Mon, 22 Oct 2007 09:58:17 +0100 Keir Fraser <[email protected]> wrote:

What's the CONFIG_XEN_FC stuff all about? It doesn't appear to be configurable (so it's always off), it's ifdef'ed all over the place, and there are dead files (e.g., fcfront.c) that presumably would depend on that option.

Either it needs to be plumbed in properly, or the XEN_FC stuff needs to be stripped out entirely from this patchset.

The CONFIG_XEN_FC stuff is used for activating FC(Fibre Channel) transport layer functionality. I will attach additional patch for the stuff.

Please note:

The FC transport functionality for PV driver on HVM domain is not activated even if this stuff is set. It is only available for 2.6.18 kernel for PV domain.
This is why definition of "struct fc_function_template" used for the FC transport functionality are differrent for each kernel version. Therefore "#ifdef" switch is needed for each kernel version. We didn't implement the switch on current implementation.

Best regards,

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1193114725 -32400
# Node ID 9ca42e496ee3555e0576fcabd75942dca8b3825f # Parent b8a4ef7c01aa345d820169266a6aa88c448f7aa5 [LINUX] modify Makefile for CONFIG_XEN_FC

drivers/xen/Kconfig +15 -0
diff -r b8a4ef7c01aa -r 9ca42e496ee3 drivers/xen/Kconfig
@@ -61,6 +61,21 @@ config XEN_SCSI_BACKEND
 	help
 	  The SCSI backend driver allows the kernel to export its SCSI HBAs
 	  to other guests via a high-performance shared-memory interface.
+
+choice
+	prompt "SCSI Backend Mode"
+	depends on XEN_SCSI_BACKEND
+	default XEN_SCSI_BACKEND_SCSI
+
+config XEN_SCSI_BACKEND_SCSI
+	bool "Not FC"
+
+config XEN_FC
+	bool "FC driver support"
+	---help---
+           The function of scsi_transport_fc is add.
+
+endchoice
 
 config XEN_BLKDEV_TAP
 	tristate "Block-device tap backend driver"
drivers/xen/scsiback/Makefile +8 -2
diff -r b8a4ef7c01aa -r 9ca42e496ee3 drivers/xen/scsiback/Makefile
@@ -1,2 +1,8 @@ obj-$(CONFIG_XEN_SCSI_BACKEND)	+= xen-sc
-obj-$(CONFIG_XEN_SCSI_BACKEND)	+= xen-scsibk.o
-xen-scsibk-y			+= interface.o scsiback.o xenbus.o comback.o traceback.o
+ifeq ($(CONFIG_XEN_FC),y)
+  EXTRA_CFLAGS += -DCONFIG_XEN_FC
+  obj-$(CONFIG_XEN_SCSI_BACKEND)	+= xen-fcscsibk.o
+  xen-fcscsibk-y			+= interface.o scsiback.o xenbus.o fcback.o comback.o traceback.o
+else
+  obj-$(CONFIG_XEN_SCSI_BACKEND)	+= xen-scsibk.o
+  xen-scsibk-y				+= interface.o scsiback.o xenbus.o comback.o traceback.o
+endif
drivers/xen/scsifront/Makefile +6 -0
diff -r b8a4ef7c01aa -r 9ca42e496ee3 drivers/xen/scsifront/Makefile
@@ -1,2 +1,8 @@
+ifeq ($(CONFIG_XEN_FC),y)
+  EXTRA_CFLAGS += -DCONFIG_XEN_FC
+  obj-$(CONFIG_XEN_SCSI_FRONTEND)	:= xenfcscsi.o
+  xenfcscsi-objs := scsifront.o fcfront.o comfront.o tracefront.o
+else
   obj-$(CONFIG_XEN_SCSI_FRONTEND)	:= xenscsi.o
   xenscsi-objs := scsifront.o comfront.o tracefront.o
+endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw
Quoted 3 lines

The CONFIG_XEN_FC stuff is used for activating FC(Fibre Channel) transport layer functionality. I will attach additional patch for the stuff.

Okay, thanks.

Another question about the original patches: did you test that a 64-bit backend can communicate with 32-bit frontend (and vice versa)? Either you need to make sure that all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, or you need to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion. I think it's obvious which is less hassle. ;-)

Handling this is really a prerequisite for putting these patches into a stable Xen release.

-- Keir

author
#9 lore raw

Keir-san,

Quoted 6 lines · On Tue, 23 Oct 2007 09:50:38 +0100 Keir Fraser <[email protected]> wrote:

Another question about the original patches: did you test that a 64-bit backend can communicate with 32-bit frontend (and vice versa)? Either you need to make sure that all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, or you need to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion. I think it's obvious which is less hassle. ;-)

I suppose that the VBD uses the later method. (Is it right?) However, the later method requires 'optimize level of frontend on compile time' in addition to the 'bitness'. If the frontend is optimized for space, members in structure are packed. On the other hand, if the frontend is optimized for speed, each members are aligned on word boundary. (padding will be inserted.)
How do you think about this?

Quoted 2 lines

Handling this is really a prerequisite for putting these patches into a stable Xen release.

I would like to modify and post an additional patch ASAP.

-----
Jun Kamada

#10 lore raw
Quoted 7 lines · Jun Kamada
Quoted 6 lines

Another question about the original patches: did you test that a 64-bit backend can communicate with 32-bit frontend (and vice versa)? Either you need to make sure that all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, or you need to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion. I think it's obvious which is less hassle. ;-)

Quoted 7 lines

I suppose that the VBD uses the later method. (Is it right?) However, the later method requires 'optimize level of frontend on compile time' in addition to the 'bitness'. If the frontend is optimized for space, members in structure are packed. On the other hand, if the frontend is optimized for speed, each members are aligned on word boundary. (padding will be inserted.)
How do you think about this?

The layout of structures is part of the C ABI on the target system:
optimising compilation for space cannot change that (without explicit pragmas or attributes being added to the code).

Anyway, the right answer is to ensure that your structures compile the same whether compiled with 32-bit or 64-bit gcc. Check the structure sizes, fields sizes and field offsets.

-- Keir

author
#11 lore raw

Dear Keir-san,

Can I ask one question for my correct understanding?

Quoted 3 lines · On Tue, 23 Oct 2007 13:39:24 +0100 Keir Fraser <[email protected]> wrote:

Anyway, the right answer is to ensure that your structures compile the same whether compiled with 32-bit or 64-bit gcc. Check the structure sizes, fields sizes and field offsets.

You showed me two options in previous email; i.) all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, ii.) to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion.

I consider that current VBD implementation takes option ii.), however you recommended me to take option i.) for pvSCSI driver. Is my understanding right?

Best regards,

-----
Jun Kamada
Linux Technology Development Div.
Server Systems Unit
Fujitsu Ltd.
[email protected]

#12 lore raw
Quoted 4 lines · Jun Kamada
Quoted 3 lines

Anyway, the right answer is to ensure that your structures compile the same whether compiled with 32-bit or 64-bit gcc. Check the structure sizes, fields sizes and field offsets.

Quoted 8 lines

You showed me two options in previous email; i.) all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, ii.) to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion.

I consider that current VBD implementation takes option ii.), however you recommended me to take option i.) for pvSCSI driver. Is my understanding right?

Yes. It was an accident we ended up with structures compiling differently on 32- vs 64-bit. By the time we discovered it was an issue, we couldn't break backward compatibility.

-- Keir

author
#13 lore raw

Keir-san,

Quoted 11 lines · On Wed, 24 Oct 2007 08:42:38 +0100 Keir Fraser <[email protected]> wrote:
Quoted 9 lines · Jun Kamada
Quoted 3 lines

Anyway, the right answer is to ensure that your structures compile the same whether compiled with 32-bit or 64-bit gcc. Check the structure sizes, fields sizes and field offsets.

You showed me two options in previous email; i.) all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, ii.) to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion.

Quoted 7 lines
Quoted 3 lines

I consider that current VBD implementation takes option ii.), however you recommended me to take option i.) for pvSCSI driver. Is my understanding right?

Yes. It was an accident we ended up with structures compiling differently on 32- vs 64-bit. By the time we discovered it was an issue, we couldn't break backward compatibility.

I understood. I'll try to modify the pvSCSI driver by option i.).

Best regards,

-----
Jun Kamada

author
#14 lore raw

cover pvSCSI (SCSI pass through) driver

Keir-san,

I have finished the modification of the driver by option i.). The pvSCSI driver can work on heterogeneous (x86_32 and x86_64) environment.

I will attach total six patches on following mail.

Best regards,

Quoted 32 lines · On Thu, 25 Oct 2007 10:59:31 +0900 Jun Kamada <[email protected]> wrote:

Keir-san,

Quoted 11 lines · On Wed, 24 Oct 2007 08:42:38 +0100 Keir Fraser <[email protected]> wrote:
Quoted 9 lines · Jun Kamada
Quoted 3 lines

Anyway, the right answer is to ensure that your structures compile the same whether compiled with 32-bit or 64-bit gcc. Check the structure sizes, fields sizes and field offsets.

You showed me two options in previous email; i.) all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, ii.) to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion.

Quoted 7 lines
Quoted 3 lines

I consider that current VBD implementation takes option ii.), however you recommended me to take option i.) for pvSCSI driver. Is my understanding right?

Yes. It was an accident we ended up with structures compiling differently on 32- vs 64-bit. By the time we discovered it was an issue, we couldn't break backward compatibility.

I understood. I'll try to modify the pvSCSI driver by option i.).

Best regards,

-----
Jun Kamada

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

-----
Jun Kamada

#15 lore raw

Vscsiif.h still needs clean up:
1. You cannot have Linux-specific stuff in that header file. It's supposed
to be generic. Get rid of references to CONFIG_XEN_FC.
2. You cannot pollute the global namespace with unqualified names. All your
names, macros, etc should have a vscsiif_ or VSCSIIF_ prefix. Names like DEFAULT_CAN_QUEUE and SG_TABLESIZE pollute the namespace and it's not immediately obvious which header they come from (which it would be if they were prefixed).
3. Do you really mean for vscsiif_btf_response to be empty? And neither
response structure has an identifier to match the request it responds to. Can requests not be handled out of order by your drivers? That would seem very odd.

Also CONFIG_XEN_FC is ifdef'ed all over scsifront and scsiback. You'll have to find some way to clean that up, perhaps by providing null stub implementations of fc functions in a header file if !CONFIG_XEN_FC.

FIXME comments in the connection setup code, accompanied by hard-coded constants, don't bode well. Is the connection setup protocol fully baked yet?

All this, coupled with the fact that you can only export whole HBAs, which doesn't seem likely to be a very popular usage scenario, makes me think this driver should wait until after 3.2.0.

--Keir

Quoted 56 lines · Jun Kamada

Keir-san,

I have finished the modification of the driver by option i.). The pvSCSI driver can work on heterogeneous (x86_32 and x86_64) environment.

I will attach total six patches on following mail.

Best regards,

Quoted 33 lines · On Thu, 25 Oct 2007 10:59:31 +0900 Jun Kamada <[email protected]> wrote:

Keir-san,

Quoted 12 lines · On Wed, 24 Oct 2007 08:42:38 +0100 Keir Fraser <[email protected]> wrote:
Quoted 10 lines · Jun Kamada
Quoted 4 lines

Anyway, the right answer is to ensure that your structures compile the same
whether compiled with 32-bit or 64-bit gcc. Check the structure sizes, fields sizes and field offsets.

You showed me two options in previous email; i.) all the shared-memory structures defined in vscsiif.h compile identically for 32-bit and 64-bit mode, ii.) to detect the frontend's 'bitness' in scsiback and optionally do 32-to-64 or 64-to-32 conversion.

Quoted 7 lines
Quoted 3 lines

I consider that current VBD implementation takes option ii.), however you recommended me to take option i.) for pvSCSI driver. Is my understanding right?

Yes. It was an accident we ended up with structures compiling differently on 32- vs 64-bit. By the time we discovered it was an issue, we couldn't break backward compatibility.

I understood. I'll try to modify the pvSCSI driver by option i.).

Best regards,

-----
Jun Kamada

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

-----
Jun Kamada

author
#16 lore raw

Hi Keir-san,

Thank you for your comments.

Quoted 3 lines · On Tue, 30 Oct 2007 10:56:57 +0000 Keir Fraser <[email protected]> wrote:

Vscsiif.h still needs clean up:
1. You cannot have Linux-specific stuff in that header file. It's supposed
to be generic.

I understood. I would like to remove Linux-specific definitions, such like below.

    #include <scsi/scsi_transport.h>
    enum fc_port_state
Quoted 5 lines

2. You cannot pollute the global namespace with unqualified names. All your
names, macros, etc should have a vscsiif_ or VSCSIIF_ prefix. Names like DEFAULT_CAN_QUEUE and SG_TABLESIZE pollute the namespace and it's not immediately obvious which header they come from (which it would be if they were prefixed).

I would like to add the prefix to all the definitions.

Quoted 4 lines

3. Do you really mean for vscsiif_btf_response to be empty? And neither
response structure has an identifier to match the request it responds to. Can requests not be handled out of order by your drivers? That would seem very odd.

The pvSCSI driver uses two rings for frontend-to-backend (ftb) and backend-to-frontend (btf) communication. The reason why the architecture is taken is as follows.

- The ftb_request packet was relatively big, so we could not allocate enough entries on the ring. It caused a performance problem.
- By dividing into the two rings ("ftb" ring and "btf" ring), and using original queueing mechanism on both frontend and backend, the entries on the ring is immediately freed after queued. It contributes a good performance.

Therefore, the ftb_response and btf_response carries no information. It is only used as a trigger of freeing the entry on the ring.

We also would like to discuss about design of the ring architecture described above. Any comment is welcome.

Quoted 3 lines

Also CONFIG_XEN_FC is ifdef'ed all over scsifront and scsiback. You'll have to find some way to clean that up, perhaps by providing null stub implementations of fc functions in a header file if !CONFIG_XEN_FC.

I think that one of the way to reduce CONFIG_XEN_FC is to ifdef'ing intialization of FC transport functionality. (However, object modules still include FC modules.) How do you think about this modification? Could you tell me more detail about your advice?

Please note why the CONFIG_XEN_FC is needed are,

- Old Linux kernel has different definition of
"struct fc_function_template".
- In order to support the old Linux kernel on HVM guest domain, simple way is disabling FC functionality.

Quoted 3 lines

FIXME comments in the connection setup code, accompanied by hard-coded constants, don't bode well. Is the connection setup protocol fully baked yet?

FIXME comment indicates tunable point of the parameter for performance and so on. I understood the word "FIXME' was not appropriate. I will remove the word.

Quoted 3 lines

All this, coupled with the fact that you can only export whole HBAs, which doesn't seem likely to be a very popular usage scenario, makes me think this driver should wait until after 3.2.0.

We consider that SCSI support on guest domain is mandatory for bussiness use. Using a NPIV technology on host domain, each guest domain can have own virtual HBA. We have already evaluated on our environment the conbination of NPIV and pvSCSI work well.
On the other hand, we undestand the usefullness of LUN assignment to guest domain. We would like to develop it on next step in our current plan.

Best regards,

-----
Jun Kamada

#17 lore raw
Quoted 11 lines · Jun Kamada
Quoted 3 lines

All this, coupled with the fact that you can only export whole HBAs, which doesn't seem likely to be a very popular usage scenario, makes me think this driver should wait until after 3.2.0.

We consider that SCSI support on guest domain is mandatory for bussiness use. Using a NPIV technology on host domain, each guest domain can have own virtual HBA. We have already evaluated on our environment the conbination of NPIV and pvSCSI work well.
On the other hand, we undestand the usefullness of LUN assignment to guest domain. We would like to develop it on next step in our current plan.

Okay, well re-spin the patches and I'll take another look.

-- Keir

author
#18 lore raw

Keir-san,

Quoted 14 lines · On Wed, 31 Oct 2007 09:10:34 +0000 Keir Fraser <[email protected]> wrote:
Quoted 11 lines · Jun Kamada
Quoted 3 lines

All this, coupled with the fact that you can only export whole HBAs, which doesn't seem likely to be a very popular usage scenario, makes me think this driver should wait until after 3.2.0.

We consider that SCSI support on guest domain is mandatory for bussiness use. Using a NPIV technology on host domain, each guest domain can have own virtual HBA. We have already evaluated on our environment the conbination of NPIV and pvSCSI work well.
On the other hand, we undestand the usefullness of LUN assignment to guest domain. We would like to develop it on next step in our current plan.

Quoted 1 line

Okay, well re-spin the patches and I'll take another look.

Can I ask one question in order to avoid my misunderstanding?

Do you mean that the pvSCSI driver is never commited until it supports LUN assignment to geust domain, or anything else?

Best regards,

-----
Jun Kamada

#19 lore raw
Quoted 6 lines · Jun Kamada
Quoted 1 line

Okay, well re-spin the patches and I'll take another look.

Can I ask one question in order to avoid my misunderstanding?

Do you mean that the pvSCSI driver is never commited until it supports LUN assignment to geust domain, or anything else?

The virtual HBA usage scenario sounds useful.

-- Keir

#20 lore raw
In reply to Jun Kamada

Hi,

On Tue, 2007-10-30 at 19:39 +0900, Jun Kamada wrote:

Is this using the same syntax for HBA reservation that we used to have, ie. simply enumerated using the scsi host number on the dom0?

If so, that is rather fragile. The scsi host number can change from kernel to kernel depending on HBA driver probe order and PCI bus enumeration order. It changes when hardware is rearranged. And how do we deal with migrate, when we'll need to select a completely different HBA on a different host?

Selecting the HBA by scsi host number is good enough for a demonstration that the code works, but I don't think it's going to be robust enough for production deployment.

Also, has there been any progress towards exposing individual LUNs to the guest rather than a whole HBA?

Cheers,
Stephen

#21 lore raw
Quoted 5 lines

Hi,

On Tue, 2007-10-30 at 19:39 +0900, Jun Kamada wrote:

Is this using the same syntax for HBA reservation that we used to

have,

Quoted 5 lines

ie. simply enumerated using the scsi host number on the dom0?

If so, that is rather fragile. The scsi host number can change from kernel to kernel depending on HBA driver probe order and PCI bus enumeration order. It changes when hardware is rearranged. And how

do

Quoted 4 lines

we deal with migrate, when we'll need to select a completely different HBA on a different host?

Selecting the HBA by scsi host number is good enough for a

demonstration

Quoted 5 lines

that the code works, but I don't think it's going to be robust enough for production deployment.

Also, has there been any progress towards exposing individual LUNs to the guest rather than a whole HBA?

People keep saying individual LUN... do they actually mean SCSI Target devices? Splitting up devices on the same HBA should be reasonably simple, but due to the way the scsi protocol works (AFAIK), splitting up LUN's on a single SCSI device could be a bit trickier...

Or maybe LUN doesn't mean what I think it means in this case... my understanding is:

HBA = Host Bus Adapter (eg a PCI SCSI adapter)
SCSI Target Device = one of the physical devices that sits on the SCSI bus (eg a tape drive or a disk drive)
LUN (Logical Unit Number) = a sub unit of the SCSI Target Device, eg a single disk drive in a RAID array, a tape device in an multi tape drive autoloader, a CD ROM in a CDROM tower.

...

James

author
#22 lore raw

Hi James-san,

Quoted 20 lines · On Fri, 2 Nov 2007 11:23:50 +1100 "James Harper"…
Quoted 5 lines

Hi,

On Tue, 2007-10-30 at 19:39 +0900, Jun Kamada wrote:

Is this using the same syntax for HBA reservation that we used to

have,

Quoted 5 lines

ie. simply enumerated using the scsi host number on the dom0?

If so, that is rather fragile. The scsi host number can change from kernel to kernel depending on HBA driver probe order and PCI bus enumeration order. It changes when hardware is rearranged. And how

do

Quoted 4 lines

we deal with migrate, when we'll need to select a completely different HBA on a different host?

Selecting the HBA by scsi host number is good enough for a

demonstration

Quoted 3 lines

that the code works, but I don't think it's going to be robust enough for production deployment.

Quoted 7 lines
Quoted 2 lines

Also, has there been any progress towards exposing individual LUNs to the guest rather than a whole HBA?

People keep saying individual LUN... do they actually mean SCSI Target devices? Splitting up devices on the same HBA should be reasonably simple, but due to the way the scsi protocol works (AFAIK), splitting up LUN's on a single SCSI device could be a bit trickier...

The reason why we have to support SCSI on guest domain is that we would like to use commercial appilications.
My understanding is as follows.

1.) There is a vender specific area in SCSI command frame. 2.) There is a case that some data in the area depends on SCSI-ID, and
some storage management software uses tha data. And sometimes the software requires one-to-one bindings to HBA. (This fuct is not good for standardization point of view.)

Possible solution may be

a.) Assign a physical HBA for the guest domain the software, described
in 2.), is running. And also multiple guest domains can share one physical HBA by using NPIV technology in this case.
b.) Assign LUNs for the other guests.

Quoted 9 lines

Or maybe LUN doesn't mean what I think it means in this case... my understanding is:

HBA = Host Bus Adapter (eg a PCI SCSI adapter)
SCSI Target Device = one of the physical devices that sits on the SCSI bus (eg a tape drive or a disk drive)
LUN (Logical Unit Number) = a sub unit of the SCSI Target Device, eg a single disk drive in a RAID array, a tape device in an multi tape drive autoloader, a CD ROM in a CDROM tower.

My understanding is same as yours.

Best regards,

-----
Jun Kamada

author
#23 lore raw
In reply to Stephen C. Tweedie

Hi Stephen-san,

Quoted 4 lines · On Thu, 01 Nov 2007 12:14:41 +0000 "Stephen C. Tweedie" <[email protected]> wrote:

On Tue, 2007-10-30 at 19:39 +0900, Jun Kamada wrote:

Is this using the same syntax for HBA reservation that we used to have, ie. simply enumerated using the scsi host number on the dom0?

Yes.

Quoted 9 lines

If so, that is rather fragile. The scsi host number can change from kernel to kernel depending on HBA driver probe order and PCI bus enumeration order. It changes when hardware is rearranged. And how do we deal with migrate, when we'll need to select a completely different HBA on a different host?

Selecting the HBA by scsi host number is good enough for a demonstration that the code works, but I don't think it's going to be robust enough for production deployment.

We also recognize that more sophisticated interface is needed. WWPN can be used for FC-SCSI, however pure SCSI does not have any unique ID. Do you have any idea?

Quoted 6 lines

Also, has there been any progress towards exposing individual LUNs to the guest rather than a whole HBA?

Cheers,
Stephen

Jun Kamada
Linux Technology Development Div.
Server Systems Unit
Fujitsu Ltd.
[email protected]

#24 lore raw

Hi,

Quoted 3 lines · Jun Kamada

We also recognize that more sophisticated interface is needed. WWPN can be used for FC-SCSI, however pure SCSI does not have any unique ID. Do you have any idea?

Well... Linux does try to use address-by-content to some extent, but that's going to be fragile here, as well. It's complicated even more by the difficulty of having potential multipath in the mix.

libblkid has some helpful functions for certain cases, but that doesn't help at all for the bootstrap cases when you're dealing with completely unformatted disks.

The libvirt folks have been wrestling with some of the same questions recently, libvirt-devel may have some useful discussion.

--Stephen

author
#25 lore raw

Hi Stephen-san,

Thank you for your helpful information. I will access the information.

Thanks,

Quoted 12 lines · On Thu, 08 Nov 2007 21:33:50 +0000 "Stephen C. Tweedie" <[email protected]> wrote:

Hi,

Quoted 3 lines · Jun Kamada

We also recognize that more sophisticated interface is needed. WWPN can be used for FC-SCSI, however pure SCSI does not have any unique ID. Do you have any idea?

Well... Linux does try to use address-by-content to some extent, but that's going to be fragile here, as well. It's complicated even more by the difficulty of having potential multipath in the mix.

Quoted 10 lines

libblkid has some helpful functions for certain cases, but that doesn't help at all for the bootstrap cases when you're dealing with completely unformatted disks.

The libvirt folks have been wrestling with some of the same questions recently, libvirt-devel may have some useful discussion.

--Stephen

Jun Kamada
Linux Technology Development Div.
Server Systems Unit
Fujitsu Ltd.
[email protected]

#26 lore raw
In reply to Stephen C. Tweedie
Quoted 13 lines · Stephen C. Tweedie

Hi,

On Tue, 2007-10-30 at 19:39 +0900, Jun Kamada wrote:

Is this using the same syntax for HBA reservation that we used to have, ie. simply enumerated using the scsi host number on the dom0?

If so, that is rather fragile. The scsi host number can change from kernel to kernel depending on HBA driver probe order and PCI bus enumeration order. It changes when hardware is rearranged. And how do we deal with migrate, when we'll need to select a completely different HBA on a different host?

Quoted 7 lines

Selecting the HBA by scsi host number is good enough for a demonstration that the code works, but I don't think it's going to be robust enough for production deployment.

Also, has there been any progress towards exposing individual LUNs to the guest rather than a whole HBA?

NPIV can help here for FibreChannel devices. You can create a virtual NPIV adapter, and export exactly the LUNs/devices you want to that adapter.

It's a different approach then exporting LUNs, but similar result.

Quoted 10 lines

Cheers,
Stephen

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#27 lore raw

PATCH 1/6 pvSCSI (SCSI pass through) driver

In reply to Jun Kamada

This patch is for frontend driver.

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1193730096 -32400
# Node ID 24e0cb9fe9df6f4a6df226823562bec3089072e6 # Parent 709db80c03c3d7606744a71f48f5186358a5e659 [LINUX][scsifront] add scsi frontend driver

drivers/xen/scsifront/Makefile new file +8 -0
diff -r 709db80c03c3 -r 24e0cb9fe9df drivers/xen/scsifront/Makefile
@@ -0,0 +1,8 @@
+ifeq ($(CONFIG_XEN_FC),y)
+  EXTRA_CFLAGS += -DCONFIG_XEN_FC
+  obj-$(CONFIG_XEN_SCSI_FRONTEND)	:= xenfcscsi.o
+  xenfcscsi-objs := scsifront.o fcfront.o comfront.o tracefront.o
+else
+  obj-$(CONFIG_XEN_SCSI_FRONTEND)	:= xenscsi.o
+  xenscsi-objs := scsifront.o comfront.o tracefront.o
+endif
drivers/xen/scsifront/comfront.c new file +265 -0

265 lines not on this page · raw message

drivers/xen/scsifront/comfront.h new file +130 -0

130 lines not on this page · raw message

drivers/xen/scsifront/fcfront.c new file +777 -0

777 lines not on this page · raw message

drivers/xen/scsifront/fcfront.h new file +179 -0

179 lines not on this page · raw message

drivers/xen/scsifront/scsifront.c new file +739 -0

739 lines not on this page · raw message

drivers/xen/scsifront/tracefront.c new file +107 -0

107 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#28 lore raw

PATCH 2/6 pvSCSI (SCSI pass through) driver

In reply to Jun Kamada

This patch is for backend driver.

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1193730190 -32400
# Node ID 374aa5b731056b2182ff60d2efa9f3524232d8d8 # Parent 24e0cb9fe9df6f4a6df226823562bec3089072e6 [LINUX][scsiback] add scsi backend driver

drivers/xen/scsiback/Makefile new file +8 -0
diff -r 24e0cb9fe9df -r 374aa5b73105 drivers/xen/scsiback/Makefile
@@ -0,0 +1,8 @@
+ifeq ($(CONFIG_XEN_FC),y)
+  EXTRA_CFLAGS += -DCONFIG_XEN_FC
+  obj-$(CONFIG_XEN_SCSI_BACKEND)	+= xen-fcscsibk.o
+  xen-fcscsibk-y			+= interface.o scsiback.o xenbus.o fcback.o comback.o traceback.o
+else
+  obj-$(CONFIG_XEN_SCSI_BACKEND)	+= xen-scsibk.o
+  xen-scsibk-y				+= interface.o scsiback.o xenbus.o comback.o traceback.o
+endif
drivers/xen/scsiback/comback.c new file +272 -0

272 lines not on this page · raw message

drivers/xen/scsiback/comback.h new file +148 -0

148 lines not on this page · raw message

drivers/xen/scsiback/fcback.c new file +610 -0

610 lines not on this page · raw message

drivers/xen/scsiback/fcback.h new file +191 -0

191 lines not on this page · raw message

drivers/xen/scsiback/interface.c new file +215 -0

215 lines not on this page · raw message

drivers/xen/scsiback/scsiback.c new file +556 -0

556 lines not on this page · raw message

drivers/xen/scsiback/traceback.c new file +109 -0

109 lines not on this page · raw message

drivers/xen/scsiback/xenbus.c new file +300 -0

300 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#29 lore raw

PATCH 3/6 pvSCSI (SCSI pass through) driver

In reply to Jun Kamada

This patch is for vscsiif.h.

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1193730258 -32400
# Node ID 7a834d087b6e75d02b85d8b65efc2022b5bb2cb2 # Parent 374aa5b731056b2182ff60d2efa9f3524232d8d8 [LINUX] add vscsiif.h

include/xen/interface/io/vscsiif.h new file +238 -0
diff -r 374aa5b73105 -r 7a834d087b6e include/xen/interface/io/vscsiif.h
@@ -0,0 +1,238 @@
+/******************************************************************************
+ * scsiif.h
+ * 
+ * Based on the blkif.h code.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright(c) FUJITSU Limited 2007.
+ */
+
+#ifndef __XEN__PUBLIC_IO_SCSI_H__
+#define __XEN__PUBLIC_IO_SCSI_H__
+
+#include "ring.h"
+#include "../grant_table.h"
+
+#ifdef CONFIG_XEN_FC
+#include <scsi/scsi_transport.h>
+#include <scsi/scsi_transport_fc.h>
+#endif
+
+#define CMND_SCSI			1	/* scsi */
+#define CMND_SCSI_RESET			2	/* scsi */
+
+#ifdef CONFIG_XEN_FC
+#define CMND_GET_HOST_PORT_ID		101	/* ghpi */
+#define CMND_GET_HOST_PORT_TYPE		102	/* ghpt */
+#define CMND_GET_HOST_PORT_STATE	103	/* ghps */
+#define CMND_GET_HOST_ACTIVE_FC4S	104	/* ghaf */
+#define CMND_GET_HOST_SPEED		105	/* ghsp */
+#define CMND_GET_HOST_FABRIC_NAME	106	/* ghfn */
+#define CMND_GET_HOST_STATS		107	/* ghst */
+#define CMND_RESET_HOST_STATS		108	/* rhst */
+#define CMND_ISSUE_HOST_LIP		109	/* ihli */
+#define CMND_GET_STARGET_PORT_ID	121	/* gtpi */
+#define CMND_GET_STARGET_NODE_NAME	122	/* gtnn */
+#define CMND_GET_STARGET_PORT_NAME	123	/* gtpn */
+#define CMND_GET_RPORT_LOSS_TMO		141	/* gplt */
+#define CMND_SET_RPORT_LOSS_TMO		142	/* splt */
+#define CMND_GET_INITIAL_SHOST_ATTRIB	161	/* giha */
+#define CMND_GET_INITIAL_STARGET_ATTRIB	162	/* gita */
+#define CMND_GET_INITIAL_RPORT_ATTRIB	163	/* gipa */
+#define CMND_GET_FUNCTION_TEMPLATE	181	/* gftp */
+#endif
+
+/* ----------------------------------------------------------------------
+	Definition of Ring Structures
+   ---------------------------------------------------------------------- */
+
+#define DEFAULT_CAN_QUEUE	256
+#define VSCSI_MAX_COMMAND_SIZE	16
+#define SG_TABLESIZE		32
+
+#define SCSIIF_REQ_OKAY		0
+#define SCSIIF_BTFRING_BUSY	1
+
+/* Definition of
+ *	union  vscsiif_ftb_sring_entry,
+ *	struct vscsiif_ftb_sring,
+ *	struct vscsiif_ftb_front_ring,
+ *	struct vscsiif_ftb_back_ring,
+ *	vscsiif_ftb_sring_t,
+ *	vscsiif_ftb_front_ring_t,
+ *	vscsiif_ftb_back_ring_t
+*/
+struct vscsiif_ftb_request {
+	uint32_t rqid;
+	uint32_t cmnd;
+	union {
+		/* SCSI */
+		struct scsiif_ftb_request {
+			uint8_t cmnd[VSCSI_MAX_COMMAND_SIZE];
+			uint8_t cmd_len;
+			uint32_t id, lun, channel;
+			uint16_t sc_data_direction;
+			uint16_t use_sg;
+			uint16_t request_bufflen;
+			int32_t timeout_per_command;
+			struct scsiif_request_segment {
+				grant_ref_t gref;
+				uint32_t offset;
+				uint32_t length;
+			} seg[SG_TABLESIZE];
+			uint32_t padding;
+		} scsi;
+#ifdef CONFIG_XEN_FC
+		/* Get_sTarget_Port_Id */
+		/* Get_sTarget_Node_Name */
+		/* Get_sTarget_Port_Name */
+		struct {
+			u32 channel;
+			u32 id;
+		} gtpi, gtnn, gtpn;
+
+		/* Get_rPort_Loss_Tmo */
+		struct {
+			u64 node_name;
+			u64 port_name;
+			u32 port_id;
+			u32 roles;
+		} gplt;
+
+		/* Set_rPort_Loss_Tmo */
+		struct {
+			u64 node_name;
+			u64 port_name;
+			u32 port_id;
+			u32 roles;
+			u32 timeout;
+			u32 padding;
+		} splt;
+#endif
+	} u;
+};
+
+struct vscsiif_ftb_response {
+	uint16_t status;
+	union {
+		struct scsiif_ftb_response {
+		} scsi;
+	} u;
+};
+
+DEFINE_RING_TYPES(vscsiif_ftb, struct vscsiif_ftb_request, struct vscsiif_ftb_response);
+
+
+#define SCSI_SENSE_BUFFERSIZE 	96
+
+/* Definition of
+ *		union  vscsiif_btf_sring_entry,
+ *		struct vscsiif_btf_sring,
+ *		struct vscsiif_btf_front_ring,
+ *		struct vscsiif_btf_back_ring,
+ *		vscsiif_btf_sring_t,
+ *		vscsiif_btf_front_ring_t,
+ *		vscsiif_btf_back_ring_t
+*/
+struct vscsiif_btf_request {
+	uint32_t rqid;
+	int32_t  rslt;
+	union {
+		/* SCSI */
+		struct scsiif_response {
+			uint32_t sense_len;
+			uint8_t sense_buffer[SCSI_SENSE_BUFFERSIZE];
+		} scsi;
+
+#ifdef CONFIG_XEN_FC
+		/* Get_Host_Port_Id */
+		struct {
+			u32 port_id;
+		} ghpi;
+
+		/* Get_Host_Port_Type */
+		struct {
+			enum fc_port_type port_type;
+		} ghpt;
+
+		/* Get_Host_Port_State */
+		struct {
+			enum fc_port_state port_state;
+		} ghps;
+
+		/* Get_Host_Active_Fc4s */
+		struct {
+			u8 active_fc4s[FC_FC4_LIST_SIZE];
+		} ghaf;
+
+		/* Get_Host_SPeed */
+		struct {
+			u32 speed;
+		} ghsp;
+
+		/* Get_Host_Fabric_Name */
+		struct {
+			u64 fabric_name;
+		} ghfn;
+
+		/* Get_Host_STats */
+		struct {
+			struct fc_host_statistics stats;
+		} ghst;
+
+		/* Get_sTarget_Port_Id */
+		struct {
+			u32 port_id;
+		} gtpi;
+
+		/* Get_sTarget_Node_Name */
+		struct {
+			u64 node_name;
+		} gtnn;
+
+		/* Get_sTarget_Port_Name */
+		struct {
+			u64 port_name;
+		} gtpn;
+
+		/* Get_rPort_Loss_Tmo */
+		struct {
+			u32 timeout;
+		} gplt;
+
+		/* Set_rPort_Loss_Tmo */
+		struct {
+			u32 timeout;
+		} splt;
+#endif
+	} u;
+};
+
+struct vscsiif_btf_response {
+	union {
+		struct scsiif_btf_response {
+
+		} scsi;
+	} u;
+};
+
+DEFINE_RING_TYPES(vscsiif_btf, struct vscsiif_btf_request, struct vscsiif_btf_response);
+
+#endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#30 lore raw

PATCH 4/6 pvSCSI (SCSI pass through) driver

In reply to Jun Kamada

This patch is for Makefile and Kconfig file for scsifront and scsiback driver.

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1193730337 -32400
# Node ID 65a726ce042cb6a39551f0bf9ff220de5e5ddcbc # Parent 7a834d087b6e75d02b85d8b65efc2022b5bb2cb2 [LINUX]add Makefile xen-scsi driver

drivers/xen/Kconfig +31 -0
diff -r 7a834d087b6e -r 65a726ce042c drivers/xen/Kconfig
@@ -53,6 +53,29 @@ config XEN_BLKDEV_BACKEND
 	  The block-device backend driver allows the kernel to export its
 	  block devices to other guests via a high-performance shared-memory
 	  interface.
+
+config XEN_SCSI_BACKEND
+	tristate "SCSI backend driver"
+	depends on XEN_BACKEND
+	default n
+	help
+	  The SCSI backend driver allows the kernel to export its SCSI HBAs
+	  to other guests via a high-performance shared-memory interface.
+
+choice
+	prompt "SCSI Backend Mode"
+	depends on XEN_SCSI_BACKEND
+	default XEN_SCSI_BACKEND_SCSI
+
+config XEN_SCSI_BACKEND_SCSI
+	bool "Not FC"
+
+config XEN_FC
+	bool "FC driver support"
+	---help---
+           The function of scsi_transport_fc is add.
+
+endchoice
 
 config XEN_BLKDEV_TAP
 	tristate "Block-device tap backend driver"
@@ -178,6 +201,14 @@ config XEN_BLKDEV_FRONTEND
 	  dedicated device-driver domain, or your master control domain
 	  (domain 0), then you almost certainly want to say Y here.
 
+config XEN_SCSI_FRONTEND
+	tristate "SCSI frontend driver"
+	depends on XEN && SCSI
+	default n
+	help
+	  The SCSI frontend driver allows the kernel to access SCSI HBAs
+	  within another guest OS.
+
 config XEN_NETDEV_FRONTEND
 	tristate "Network-device frontend driver"
 	depends on XEN && NET
drivers/xen/Makefile +2 -0
diff -r 7a834d087b6e -r 65a726ce042c drivers/xen/Makefile
@@ -8,10 +8,12 @@ obj-y	+= util.o
 obj-y	+= util.o
 obj-$(CONFIG_XEN_BALLOON)		+= balloon/
 obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
+obj-$(CONFIG_XEN_SCSI_BACKEND)		+= scsiback/
 obj-$(CONFIG_XEN_BLKDEV_TAP)		+= blktap/
 obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
 obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmback/
 obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
+obj-$(CONFIG_XEN_SCSI_FRONTEND)		+= scsifront/
 obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
 obj-$(CONFIG_XEN_PCIDEV_BACKEND)	+= pciback/
 obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront/

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#31 lore raw

PATCH 5/6 pvSCSI (SCSI pass through) driver

In reply to Jun Kamada

This patch is for installing scsifront driver into pv-driver.

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1192703287 -32400
# Node ID 6d463e46778a4a8ad442edef337592dde20ede51 # Parent 18c98c82e60e483bd65f3904a96d2305839a350e [XEN][PV-ON-HVM] add scsifront driver in PV-on-HVM

unmodified_drivers/linux-2.6/Makefile +1 -0
diff -r 18c98c82e60e -r 6d463e46778a unmodified_drivers/linux-2.6/Makefile
@@ -4,3 +4,4 @@ obj-m += balloon/
 obj-m += balloon/
 obj-m += blkfront/
 obj-m += netfront/
+obj-m += scsifront/
unmodified_drivers/linux-2.6/scsifront/Kbuild new file +5 -0
diff -r 18c98c82e60e -r 6d463e46778a unmodified_drivers/linux-2.6/scsifront/Kbuild
@@ -0,0 +1,5 @@
+include $(M)/overrides.mk
+
+obj-m += xen-scsi.o
+xen-scsi-objs := scsifront.o comfront.o tracefront.o
+
unmodified_drivers/linux-2.6/scsifront/Makefile new file +4 -0
diff -r 18c98c82e60e -r 6d463e46778a unmodified_drivers/linux-2.6/scsifront/Makefile
@@ -0,0 +1,4 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
+

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#32 lore raw

PATCH 6/6 pvSCSI (SCSI pass through) driver

In reply to Jun Kamada

This patch is for modifying xend in order to use pvscsi driver. (attach/detach HBA, etc.)

-----
Jun Kamada

# HG changeset patch
# User [email protected]
# Date 1193736851 -32400
# Node ID 980e5be7bcf419d9b7c91b61a8f7798bb10a6692 # Parent b28ae5f00553ea053bd4e4576634d8ea49e77bc3 [XEND] add scsihost interface

tools/examples/Makefile +1 -0
diff -r b28ae5f00553 -r 980e5be7bcf4 tools/examples/Makefile
@@ -25,6 +25,7 @@ XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += block
+XEN_SCRIPTS += scsihost
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
 XEN_SCRIPTS += vtpm vtpm-delete
tools/examples/scsihost new file +26 -0
diff -r b28ae5f00553 -r 980e5be7bcf4 tools/examples/scsihost
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+dir=$(dirname "$0")
+. "$dir/block-common.sh"
+
+log debug "udev event."
+
+case "$command" in
+    add)
+        done=$(xenstore_read_default "$XENBUS_PATH/scsihost" 'MISSING')
+       if [ "$done" != 'MISSING' ]
+           then
+           exit 0
+       fi
+
+       # TODO
+       #xenstore_write "$XENBUS_PATH/scsi" "info"
+       success
+       ;;
+    remove)
+       # TODO
+       ;;
+esac
+
+exit 0
+
tools/examples/xen-backend.agent +3 -0
diff -r b28ae5f00553 -r 980e5be7bcf4 tools/examples/xen-backend.agent
@@ -12,6 +12,9 @@ case "$XENBUS_TYPE" in
     ;;
   vbd)
     /etc/xen/scripts/block "$ACTION"
+    ;;
+  scsihost)
+    /etc/xen/scripts/scsihost "$ACTION"
     ;;
   vtpm)
     /etc/xen/scripts/vtpm "$ACTION"
tools/examples/xen-backend.rules +1 -0
diff -r b28ae5f00553 -r 980e5be7bcf4 tools/examples/xen-backend.rules
@@ -1,5 +1,6 @@ SUBSYSTEM=="xen-backend", KERNEL=="tap*"
 SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="/etc/xen/scripts/blktap $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="scsihost*", RUN+="/etc/xen/scripts/scsihost $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online"
 SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline"
tools/python/xen/xend/XendDevices.py +2 -1
diff -r b28ae5f00553 -r 980e5be7bcf4 tools/python/xen/xend/XendDevices.py
@@ -19,7 +19,7 @@
 # A collection of DevControllers 
 #
 
-from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, usbif, vfbif
+from xen.xend.server import blkif, scsihostif, netif, tpmif, pciif, iopif, irqif, usbif, vfbif
 from xen.xend.server.BlktapController import BlktapController
 from xen.xend.server.ConsoleController import ConsoleController
 
@@ -36,6 +36,7 @@ class XendDevices:
 
     controllers = {
         'vbd': blkif.BlkifController,
+        'scsihost': scsihostif.SCSIHostController,
         'vif': netif.NetifController,
         'vtpm': tpmif.TPMifController,
         'pci': pciif.PciController,
tools/python/xen/xend/server/scsihostif.py new file +75 -0

75 lines not on this page · raw message

tools/python/xen/xm/create.py +30 -0
diff -r b28ae5f00553 -r 980e5be7bcf4 tools/python/xen/xm/create.py
@@ -286,6 +286,12 @@ gopts.var('disk', val='phy:DEV,VDEV,MODE
           backend driver domain to use for the disk.
           The option may be repeated to add more than one disk.""")
 
+gopts.var('scsihost', val='TYPE,SCSIHOSTNO',
+          fn=append_value, default=[],
+          use="""Add a SCSI-HBA device to a domain. TYPE is fc or scsi.
+          SCSIHOSTNO is scsi host number that can be seen from /proc/scsi/scsi  
+          .""")
+
 gopts.var('pci', val='BUS:DEV.FUNC',
           fn=append_value, default=[],
           use="""Add a PCI device to a domain, using given params (in hex).
@@ -581,6 +587,15 @@ def configure_disks(config_devs, vals):
         if backend:
             config_vbd.append(['backend', backend])
         config_devs.append(['device', config_vbd])
+
+def configure_scsihost(config_devs, vals):
+    """Create the config for a SCSI HBA.
+    """
+    for (type, no) in vals.scsihost:
+        config_scsihost = ['scsihost',
+                           ['type', type ],
+                           ['hostno', no ] ]
+        config_devs.append(['device', config_scsihost])
 
 def configure_pci(config_devs, vals):
     """Create the config for pci devices.
@@ -789,6 +804,7 @@ def make_config(vals):
 
     config_devs = []
     configure_disks(config_devs, vals)
+    configure_scsihost(config_devs, vals)
     configure_pci(config_devs, vals)
     configure_ioports(config_devs, vals)
     configure_irq(config_devs, vals)
@@ -815,6 +831,19 @@ def preprocess_disk(vals):
             err('Invalid disk specifier: ' + v)
         disk.append(d)
     vals.disk = disk
+
+def preprocess_scsihost(vals):
+    if not vals.scsihost: return
+    scsihost = []
+    for v in vals.scsihost:
+        d = v.split(',')
+        n = len(d)
+        if n == 2:
+            pass
+        else:
+            err('Invalid scsi specifier: ' + v)
+        scsihost.append(d)
+    vals.scsihost = scsihost
 
 def preprocess_pci(vals):
     if not vals.pci: return
@@ -1013,6 +1042,7 @@ def preprocess_vnc(vals):
     
 def preprocess(vals):
     preprocess_disk(vals)
+    preprocess_scsihost(vals)
     preprocess_pci(vals)
     preprocess_ioports(vals)
     preprocess_ip(vals)
tools/python/xen/xm/main.py +57 -0

93 lines not on this page · raw message

xen/include/public/io/vscsiif.h new file +238 -0

238 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel