From: Olaf Hering Subject: [PATCH 3/4] docs: add pvscsi.txt Date: Mon, 2 Mar 2015 11:16:01 +0100 Message-ID: <1425291362-30228-4-git-send-email-olaf@aepfle.de> References: <1425291362-30228-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1425291362-30228-1-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Olaf Hering , Keir Fraser , Ian Campbell , Tim Deegan , Ian Jackson , Jan Beulich List-Id: xen-devel@lists.xenproject.org Signed-off-by: Olaf Hering Cc: Ian Campbell Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan --- docs/misc/pvscsi.txt | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/docs/misc/pvscsi.txt b/docs/misc/pvscsi.txt new file mode 100644 index 0000000..2af050f --- /dev/null +++ b/docs/misc/pvscsi.txt @@ -0,0 +1,147 @@ +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +PVSCSI + +== Overview == + +PVSCSI allows to assing a "physical" SCSI device from dom0 to a domU. The device +is not limited to be a native SCSI device. Everything visible as SCSI device in +dom0 can be used. Currently PVSCSI is only available in Linux dom0 and domU. + +== TODO === + +How to do live migration? + - pdev will likely be evaluated again on the target host if it came from + domU.cfg. But what about pdev from 'xl scsi-attach pdev vdev'? Its required + to adjust h:c:t:l on the target host. + +Implement checks for duplicate pdev assignments? + - Not sure if SCSI devices can be shared. Will the state be consistent during + concurrent access? Should the host admin assume cooperative access from + multiple domUs? + - The easiest way would be to do nothing and assume the host admin knows what + to do. + +How to handle FIXME in libxl_retrieve_domain_configuration? + - "MERGE(vscsi, vscsis, COMPARE_DEVID, {});", when does this code run? + +Implement libvirt integration. + - Is the API used by xl usable for libvirt? + - How does libvirt assign a raw SCSI device? + Jim said: + > vscsi=[ '/dev/sda,0:1:2:3', '4:3:2:1,1:1:1:1,feature-host' ] + In libvirt-speak, this is SCSI host device assignment + http://libvirt.org/formatdomain.html#elementsHostDev + Here's the SCSI example + + + + +
+ + +
+ + ... + + I suppose 'feature-host' maps to attributes such as 'sgio' and 'rawio'. + The source element describes the SCSI device as seen from the host. + + +== History == + +Support for PVSCSI was added to the classic xenlinux kernel and to xend in +xen-3.3 in 2008. Support for PVSCSI was added to the upstream pvops kernel 3.18 +in 2014. Backends exists just for Linux. A frontend exists for Linux, and maybe +for FreeBSD according to google. + + +== Config Format == + +The domU.cfg syntax is "vscsi=[ 'pdev,vdev[,option]' ]". pdev is the dom0 device +in either /dev/$device or pHOST:CHANNEL:TARGET:LUN notation. vdev is the domU +device in vHOST:CHANNEL:TARGET:LUN notation. 'option' lists additional flags. +Currently only the value "feature-host" is recognized. SCSI command emulation in +backend driver is bypassed when "feature-host" is specified. + + +== Xenstore Format == + +The backend driver uses a single_host:many_devices notation to manage domU +devices. Everything is stored in /local/domain/0/backend/vscsi/. The xenstore +layout looks like this: + + //feature-host = "0" + //frontend = "/local/domain//device/vscsi/0" + //frontend-id = "" + //online = "1" + //state = "4" + //vscsi-devs/dev-0/p-dev = "8:0:2:1" + //vscsi-devs/dev-0/state = "4" + //vscsi-devs/dev-0/v-dev = "0:0:0:0" + //vscsi-devs/dev-1/p-dev = "8:0:2:2" + //vscsi-devs/dev-1/state = "4" + //vscsi-devs/dev-1/v-dev = "0:0:1:0" + +The frontend driver maintains its state in /local/domain//device/vscsi/. + + /backend = "/local/domain/0/backend/vscsi//" + /backend-id = "0" + /event-channel = "20" + /ring-ref = "43" + /state = "4" + /vscsi-devs/dev-0/state = "4" + /vscsi-devs/dev-1/state = "4" + +In addition to the entries for backend and frontend these flags are stored for +the toolstack: + + //vscsi-devs/dev-1/p-devname = "/dev/$device" + + +== Backend - Frontend Protocol == + +To create a vhost along with a device: + //feature-host = "0" + //frontend = "/local/domain//device/vscsi/0" + //frontend-id = "" + //online = "1" + //state = "1" + //vscsi-devs/dev-0/p-dev = "8:0:2:1" + //vscsi-devs/dev-0/state = "1" + //vscsi-devs/dev-0/v-dev = "0:0:0:0" +Wait for //state + //vscsi-devs/dev-0/state become 4 + +To add another device to a vhost: + //state = "7" + //vscsi-devs/dev-1/p-dev = "8:0:2:2" + //vscsi-devs/dev-1/state = "1" + //vscsi-devs/dev-1/v-dev = "0:0:1:0" +Wait for //state + //vscsi-devs/dev-1/state become 4 + +To remove a device from a vhost: + //state = "7" + //vscsi-devs/dev-1/state = "5" +Wait for //state to become 4 +Wait for //vscsi-devs/dev-1/state become 6 +Remove //vscsi-devs/dev-1/{state,p-dev,v-dev,p-devname} +Remove //vscsi-devs/dev-1/ + + +== Interface in xl == + +xl scsi-attach domid [,