qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] scsi-generic and max request size


From: Benjamin Herrenschmidt
Subject: Re: [Qemu-devel] scsi-generic and max request size
Date: Tue, 21 Dec 2010 14:52:21 +1100

On Tue, 2010-12-21 at 14:38 +1100, ronnie sahlberg wrote:
> Ben,
> 
> Since it is a scsi device you can try the Inquiry command with
> pagecode 0xb0  :  Block Limit VPD Page.
> That pages show optimal and maximum request sizes.
> 
> This is for SBC, in the Vital Product Data chapter.
> 
> Unfortunately this page is not mandatory so some devices might not
> understand it. :-(
> 
> sg_inq --page=0x00 /dev/sg?
> will show you what inq pages your device supports.

Well, that won't help much figuring what the limit is since in most case
the limit seems to come from the host linux HBA (ie, usb-storage for
example artificially clamps the max request size to deal with bogus
USB-ATA bridges).

As for using this to try to "inform" the guest OS as to what the limit
is, this could be done by "patching" the result of that command on the
fly in qemu, but that is nasty, and would only work if the guest OS
actually uses the said command in the first place. AFAIK, neither sr.c
nor sd.c do in Linux.

So back to square 1 ... my vscsi (and virtio-blk too btw) can
technically pass a max size to the guest, but we don't have a way to
interrogate scsi-generic (and the underlying block driver) which is the
main issue (that plus the fact that the ioctl seems to be broken in
"compat" mode for /dev/sg specifically)...

Cheers,
Ben.


> 
> regards
> ronnie sahlberg
> 
> 
> On Tue, Dec 21, 2010 at 2:25 PM, Benjamin Herrenschmidt
> <address@hidden> wrote:
> > Hi folks !
> >
> > There's an odd problem I've encountered with my scsi host (basically an
> > powerpc "vscsi" compatible with IBM PAPR).
> >
> > When using /dev/sg (ie, scsi-generic), there seem to be no way I can
> > find to retrieve the underlying driver's max request transfer size.
> >
> > This can normally be obtained with the BLKSECTGET ioctl under Linux (I'm
> > not familiar with other OSes here). However, this is a bit buggy as
> > well, ie, afaik, this doesn't work with 32-bit binaries on 64-bit
> > kernels (the compat ioctl doesn't seem to work on /dev/sg).
> >
> > For now, qemu doesn't pass that from its bdev layer, which means that
> > scsi-generic doesn't pass it to its own "upper" layer neither.
> >
> > What that means is two fold I suppose:
> >
> >  - For real SCSI HBAs, how do you limit the transfer size anyways ? You
> > can't start breaking up user requests without taking risks with tags
> > etc...
> >
> >  - For vscsi, I can expose the limit I want via the SRP interface, but
> > scsi-generic doesn't tell me what it is :-)
> >
> > This is a real problem in practice. IE. the USB CD-ROM on this POWER7
> > blade limits transfers to 0x1e000 bytes for example and the Linux "sr"
> > driver on the guest is going to try to give me bigger requests than that
> > if I don't start limiting them, which will cause all sort of errors.
> >
> > Cheers,
> > Ben.
> >
> >
> >
> >
> >





reply via email to

[Prev in Thread] Current Thread [Next in Thread]