Skip to contentSkip to conversation

[Qemu-devel] [PATCH 0/5]

PATCH In review Nicholas A. Bellinger 4 participants 5 messages Nov 24, 2010 – Nov 25, 2010

lore
Share & tools
lore
#0 lore raw

cover [Qemu-devel] [PATCH 0/5]

From: Nicholas Bellinger <[email protected]>

Greetings QEMU SCSI / BLOCK folks,

This series adds rebased support for the hw/scsi-bsg.c backstore for scsi-bus compatible HBA emulation in QEMU-KVM on Linux hosts supporting the BSG driver against current mainline qemu-kvm.git/master code.

This patch is available from the scsi-bsg branch in the megasas/scsi friendly QEMU-KVM tree at:

http://git.kernel.org/?p=virt/kvm/nab/qemu-kvm.git;a=shortlog;h=refs/heads/megasas-upstream-v1

which includes Hannes's recent patch series posted recently against mainline v0.13.0 here:

Re: [Qemu-devel] [PATCH] Megasas HBA emulation and SCSI update v.2
http://lists.gnu.org/archive/html/qemu-devel/2010-11/msg02018.html

Note that in order for BSG I/O to function using vectored AIO a kernel patch to linux/block/bsg.c:bsg_map_hdr() is currently required running on a bit paired user/kernel enviroment. The kernel patch in question is here:

http://marc.info/?l=linux-scsi&m=127649585524598&w=2

The first three patches involve updating block code to support the BSG backstore for scsi-bsg.

The forth patch adds the minor changes to hw/scsi-bus.c and hw/scsi-disk.c in order to function with scsi-bsg.

And the fifth patch adds the main hw/scsi-bsg.c logic necessary to run the new struct SCSIDeviceInfo and for BSG AIO using struct iovec and paio_submit_len() to function. The scsi-bsg.c code has been refactored to follow the modern SCSIDeviceInfo->alloc_req_iov() and incoming struct iovec * memory for underlying SCSIRequest SGLs

So far this has been tested with v2 8708EM2 HBA Emulation on 0.13.0 on a .37-rc2 KVM host with TCM_Loop FILEIO backstores into a Debian Lenny v2.6.26 x86_64 KVM guest with XFS filesystem mounts.

Nicholas Bellinger (5):
block: Add top level BSG support
block: Add BSG qemu_open() in block/raw.c:raw_open()
block: Add paio_submit_len() non sector sized AIO
scsi: Add BSG checks into scsi-bus and scsi-disk
scsi-bsg: Add initial support for BSG based SCSIDeviceInfo

 Makefile.objs         |    2 +-
 block.c               |    7 +-
 block.h               |    1 +
 block/raw-posix-aio.h |    3 +
 block/raw-posix.c     |   65 +++++-
 block/raw.c           |   21 ++
 block_int.h           |    6 +
 hw/scsi-bsg.c         |  720 +++++++++++++++++++++++++++++++++++++++++++++++++
 hw/scsi-bus.c         |    3 +-
 hw/scsi-disk.c        |    5 +
 posix-aio-compat.c    |   29 ++
 11 files changed, 855 insertions(+), 7 deletions(-)
 create mode 100644 hw/scsi-bsg.c
#1 lore raw
Quoted 7 lines · Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

Greetings QEMU SCSI / BLOCK folks,

This series adds rebased support for the hw/scsi-bsg.c backstore for scsi-bus compatible HBA emulation in QEMU-KVM on Linux hosts supporting the BSG driver against current mainline qemu-kvm.git/master code.

I don't know the Linux SCSI stack, so some basic questions for you :).

With scsi-generic I can send SCSI commands to a device. How is bsg different? The bsg code looks cleaner than sg but they both boil down to issuing SCSI requests using the Linux block layer AFAICT.

Can you explain what advantages this patch series brings over scsi-generic?

Thanks,
Stefan

#2 lore raw
Quoted 5 lines · Stefan Hajnoczi

I don't know the Linux SCSI stack, so some basic questions for you :).

With scsi-generic I can send SCSI commands to a device. How is bsg different? The bsg code looks cleaner than sg but they both boil down to issuing SCSI requests using the Linux block layer AFAICT.

It's basically a new version of the sg driver with additional features, and also dropping some old legacy features.

#3 lore raw
In reply to Stefan Hajnoczi
Quoted 11 lines · On Wed, 24 Nov 2010 13:38:59 +0000 Stefan Hajnoczi <[email protected]> wrote:
Quoted 3 lines

This series adds rebased support for the hw/scsi-bsg.c backstore for scsi-bus compatible HBA emulation in QEMU-KVM on Linux hosts supporting the BSG driver against current mainline qemu-kvm.git/master code.

I don't know the Linux SCSI stack, so some basic questions for you :).

With scsi-generic I can send SCSI commands to a device. How is bsg different? The bsg code looks cleaner than sg but they both boil down to issuing SCSI requests using the Linux block layer AFAICT.

Can you explain what advantages this patch series brings over scsi-generic?

The main reason why we invented bsg is that we need the common interface to send non SCSI commands. For example, we already use bsg for FC stuff:

http://lwn.net/Articles/326338/

We can use the common interface rather than each HW specific interface.

Quoted 1 line

From the perspective of SCSI, the major advantage of bsg is supporting

bidi commands. I'm not sure qemu will ever need bidi pass through support though.

#4 lore raw
Quoted 19 lines · FUJITA Tomonori
Quoted 11 lines · On Wed, 24 Nov 2010 13:38:59 +0000 Stefan Hajnoczi <[email protected]> wrote:
Quoted 3 lines

This series adds rebased support for the hw/scsi-bsg.c backstore for scsi-bus compatible HBA emulation in QEMU-KVM on Linux hosts supporting the BSG driver against current mainline qemu-kvm.git/master code.

I don't know the Linux SCSI stack, so some basic questions for you :).

With scsi-generic I can send SCSI commands to a device.  How is bsg different?  The bsg code looks cleaner than sg but they both boil down to issuing SCSI requests using the Linux block layer AFAICT.

Can you explain what advantages this patch series brings over scsi-generic?

The main reason why we invented bsg is that we need the common interface to send non SCSI commands. For example, we already use bsg for FC stuff:

Quoted 7 lines

http://lwn.net/Articles/326338/

We can use the common interface rather than each HW specific interface.

From the perspective of SCSI, the major advantage of bsg is supporting bidi commands. I'm not sure qemu will ever need bidi pass through support though.

Thanks for the explanations Christoph and Tomonori.

Stefan