linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jeff Garzik <jeff@garzik.org>, Tejun Heo <htejun@gmail.com>,
	Mark Lord <liml@rtr.ca>, Linux IDE <linux-ide@vger.kernel.org>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] RESEND: SCSI, libata: add support for ATA_16 commands to libata ATAPI devices
Date: Thu, 01 Feb 2007 15:21:25 -0500	[thread overview]
Message-ID: <45C24BC5.6060305@torque.net> (raw)
In-Reply-To: <1170342565.3388.4.camel@mulgrave.il.steeleye.com>

James Bottomley wrote:
> On Thu, 2007-02-01 at 04:54 -0500, Jeff Garzik wrote:
>> Agreed... but that doesn't make it the /right/ thing to do ;-)
>>
>> The logic behind the current code, which limits to the maximum size 
>> allowed by an attached device on the port, is mainly to leverage the 
>> SCSI layer as a filter for bad CDB lengths.
>>
>> IOW, it's called "being lazy" ;-)
> 
> But you're requesting code changes in the SCSI layer because of this
> incorrect usage.  max_cdb is supposed to be the *host* limit.  The mid
> layer finds out and respects device limits separately from this.

To be more pedantic:
  actual_max_cdb = min(MAX_COMMAND_SIZE, host_limit)

Since the host is a bridge, that could be a limit on
near side (i.e. PCI (unlikely)) or the outer side (i.e.
transport initiator (port)). In modern HBAs the
host_limit is likely to be greater than 16, to allow
for advanced SBC and OSD commands. However currently
MAX_COMMAND_SIZE (defined in scsi/scsi_cmnd.h) is 16.

It is the ATAPI _transport_ that has the 12 byte cdb
limit *** (at least according to MMC-5 rev Annex A;
is S-ATAPI any better?).
Other MMC transports referred to in MMC-5 are
SPI, SBP(IEEE 1394) and USB mass storage; and no mention
is made of cdb length limits for them. Since ATAPI is
the dominant transport for cd/dvd drives, MMC doesn't
define any commands over 12 bytes in length, but both
SPC (which MMC should honour) and SSC-3 (think tape
drives, ATAPI connected) do.

My point is that the linux block layer and scsi mid
level should get out of the business of putting hard
limits place. Why?
Since kernel limits are at best necessary but not
sufficient, the upper layers still need to be able to
cope with errors associated with that limit.
So why have the limit?
Does the kernel do analysis to find out whether a USB
connected DVD drive has a USB to ATAPI bridge externally?
I don't think so. There is a role to fetch information
that may act as a guide when a ULD has a choice of commands
to build (e.g. sd deciding between READ(10) and READ(16)).
Let the cdb size bottleneck (or whatever) report an error
and upper layers that are impacted, including user space
programs, can act accordingly.

If the kernel really wants to offload complexity to the
user space, the kernel needs to get out of the business
of trying to foresee errors. It needs to get better at
coping with errors and if possible adapting its behaviour.


*** not the host nor the device

Doug Gilbert

  parent reply	other threads:[~2007-02-01 20:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-03  0:35 [PATCH] SCSI, libata: add support for ATA_16 commands to libata ATAPI devices Mark Lord
2007-01-03  1:40 ` James Bottomley
2007-01-03  5:42   ` Mark Lord
2007-01-03 15:31     ` James Bottomley
2007-01-03 15:45       ` Jeff Garzik
2007-01-03 15:57         ` James Bottomley
2007-01-03 17:58           ` Mark Lord
2007-01-03 19:39       ` Douglas Gilbert
2007-01-03 21:41         ` James Bottomley
2007-01-03 23:57           ` Mark Lord
2007-01-04 15:09           ` Jens Axboe
2007-01-04 15:29             ` Mark Lord
2007-01-04 15:51               ` Jens Axboe
2007-01-08  5:00         ` Luben Tuikov
     [not found] ` <200701311346.26644.liml@rtr.ca>
2007-02-01  0:33   ` [PATCH] RESEND: " Tejun Heo
2007-02-01  0:42     ` Mark Lord
2007-02-01  0:48       ` James Bottomley
2007-02-01  0:53         ` Mark Lord
2007-02-01  0:48       ` Tejun Heo
2007-02-01  1:01         ` Mark Lord
2007-02-01  8:30           ` Jeff Garzik
2007-02-01  8:28         ` Jeff Garzik
2007-02-01  8:43           ` Tejun Heo
2007-02-01  9:54             ` Jeff Garzik
2007-02-01 15:09               ` James Bottomley
2007-02-01 15:15                 ` Jeff Garzik
2007-02-01 20:21                 ` Douglas Gilbert [this message]
2007-02-01 20:30                   ` Jeff Garzik
2007-02-02  9:11                   ` Christoph Hellwig
2007-02-01  8:26       ` Jeff Garzik
2007-02-01  8:35         ` Tejun Heo
2007-02-01  9:52           ` Jeff Garzik
2007-02-01  0:44     ` James Bottomley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C24BC5.6060305@torque.net \
    --to=dougg@torque.net \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=liml@rtr.ca \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).