[stgt] RFC [patch] README.passthrough v1 (2nd send)

Nicholas A. Bellinger nab at linux-iscsi.org
Thu Aug 19 03:01:37 CEST 2010


On Thu, 2010-08-19 at 10:28 +1000, Mark Harvey wrote:
> On Thu, Aug 19, 2010 at 9:47 AM, Nicholas A. Bellinger
> <nab at linux-iscsi.org> wrote:
> >
> > Hmmm strange..  Checking on Fedora 11 (v2.6.30), RHEL6 B1 (v2.6.32),
> > OpenSuse 11.2 (v2.6.31), SLES 11 (v2.6.27), and Debian Lenny VMs
> > (v2.6.35 from lio-core-2.6.git/lio-4.0), and I do see the
> > proper /dev/bsg/H:C:T:L device nodes matching the available struct
> > scsi_device.
> >
> > However, I do recall one seing the BSG H:C:T:L device nodes appear
> > in /dev/ instead of /dev/bsg/ before.  I don't recall on which
> > environment this was, but I think it may have been some version of
> > Ubuntu..?
> >
> > Just to double check on your system, a 'cat /proc/kallsyms | grep bsg'
> > produces symbols for the kernel built-in BSG kernel code, yes..?
> >
> > Best,
> >
> > --nab
> 
> Many thanks for the pointers..
> 
> Found an SLES-11 VM with bsg.. I'll update the doc now I've got
> something to test.
> Also allow me to put in 'how to identify if your OS has bsg configured' :)
> 

:-)

> Next Q. if I may.
> Do you / can anybody on this list offer a short (one liner?) summary
> of advantages of bsg over sg ?
> I'll now hit google with the Q too..
> 

So the main difference from the perspective of a userspace space app is
going from using include/scsi/sg.h:struct sg_io_hdr to using
include/linux/bsg.h:struct sg_io_v4.  On modern kernel code, under the
hood in the kernel both drivers/scsi/sg.c and block/bsg.c use struct
request based I/O via blk_get_request() to obtain a struct request, and
blk_execute_rq_nowait() to asychronously queue the I/O to the underlying
backstore.

BSG exposes more raw functionality (but certaily not all) of the modern
Linux Block layer code.  This includes the ability to do BIDI commands
and support for legacy SG_IO ioctls in block/bsg.c:bsg_ioctl().

Note that not all of the the structure members in struct sg_io_v4 can
safely be used with current mainline code.  For example, having a 32-bit
userspace passing up 32-bit pointers currently need a patch to require
proper conversion to 64-bit struct scatterlist memory.  The first half
of this patch is here:

http://groups.google.com/group/linux-iscsi-target-dev/browse_thread/thread/6b9f8a08f78067dc/6330a5897203854a?lnk=gst&q=BSG#6330a5897203854a

This issue came up again between Tomo-san and myself last week, and we
agreed that the patch to make 32-bit user + 64-bit kernel work with BSG
scatterlists would not be pretty, but that it does need to be fixed in
order to properly support the QEMU-KVM SCSI-BSG MegaSAS SGL passthrough.
This is the code that has been being going in parallel with the recent
multi-fabric TCM_Loop Virtual SCSI LLD develpments for STGT, which can
be found here to give more of an idea how BSG functions.

http://git.kernel.org/?p=virt/kvm/nab/qemu-kvm.git;a=blob;f=hw/scsi-bsg.c;hb=refs/heads/scsi-bsg

Best,

--nab

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list