linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 0/2] Change type-2 dif to use rq embedded 32 byte cdb
@ 2012-12-19 10:34 Scott Guthridge
  2012-12-19 16:55 ` Martin K. Petersen
  2012-12-30  0:52 ` Douglas Gilbert
  0 siblings, 2 replies; 9+ messages in thread
From: Scott Guthridge @ 2012-12-19 10:34 UTC (permalink / raw)
  To: linux-scsi

The patch we suggested where we simply changed BLK_MAX_CDB and MAX_COMMAND_SIZE from 16 to 32 was meant to be a "stick in the sand".  It's the simplest description of the functionality we're looking for.  Other approaches that accomplish the same thing would be fine.

I don't know if the reason that "sd" went with the mempool for 32-byte commands was binary compatibility with modules, concerns about memory usage on small/embedded systems, or both.  But given that "sd" uses the mempool, it's reasonable to assume that greater than 16 byte pass-through requests might also take this approach.  A potential advantage of using a mempool or other dynamic allocation for the pass-through CDB is that it could be implemented to allow arbitrary CDB sizes, which would be more general than just increasing the fixed limit from 16 to 32.

>> We did the mempool because we did not want to penalize everybody else by
>> always allocating 32-byte CDBs. Type 2 is a really rare corner case.

All of the SCSI drives we're seeing now come from the vendor formatted with PI type 2.  Linux automatically detects the format and uses PI, so it's no longer a corner case -- it's now the normal case.

If you accept that dynamically allocated CDB's have become the rule rather than the exception, then it makes sense that the fixed size __cmd buffer in struct request should eventually be phased out.

Two places in the kernel accept SG_IO (pass-through) requests.  One is the "sg" driver; the other (and the one we actually care about more) is scsi_cmd_ioctl in block/scsi_ioctl.c, which handles pass-through requests sent directly to an "sd" device.

What we are looking for is simply to be able to send 32-byte pass-through commands.  These commands do not have the  prot_op and prot_type fields of struct scsi_cmnd set, so from the perspective of the Linux SCSI subsystem and the adapter firmware, they are -not- PI I/O's.  But if a pass-through command sent to the device happened to be a 32-byte read with RDPROTECT=3, for example, then the drive will return the PI interleaved with the data -- it's this raw pass-through functionality that we need.  Conveniently, increasing the CDB size doesn't break binary compatibility with the existing sg_io_hdr_t.

One could develop a more general pass-through command that gave the user access to the prot_op and prot_type fields and that provided a DIX style side-buffer to hold de-interleaved PI data.  That would be a nice extension, but it's not something we currently need.

Scott Guthridge
IBM Almaden Research Center


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/2] Change type-2 dif to use rq embedded 32 byte cdb
@ 2012-11-21 20:07 Rob Evers
  2012-11-26 16:25 ` Rob Evers
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Rob Evers @ 2012-11-21 20:07 UTC (permalink / raw)
  To: linux-scsi
  Cc: chad.dupuis, giridhar.malavali, scameron, mike.miller,
	dan.j.williams, fushun

These patches replace the original t10 type 2 dif mempool implementation
by increasing the block and scsi cdb maximum sizes from 16 to 32 bytes.
The cdb embedded in the request structure can then be used for type 2
dif commands, or other 32 byte cdbs as required.

Motivation for this is that type-2 dif commands should be treated as
any other read/writes generally, without any performance penalty.

This patch set conflicts with a patch previously posted which addresses
a race in UA induced retries with type 2 dif commands.  These patches also
address that problem:

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

Testing:

Readily reproduced the race condition panic by simultaneously
inducing UAs while load testing 8 scsi_debug devices.  With patch
applied, same testing ran for 15 hours without a panic.

Sanity tested performance using scsi_debug, with and without
type 2 dif enabled.  Order 80% performance increase noticed
with patches when scsi_debug was running in dif type 2 mode.
Running scsi_debug without type 2 dif, performance was approximately
equal.

Used 3.7.0-rc5 for testing and patch generation.

root (2):
  Change the cdb size limits in block and scsi to 32 bytes
  Change dif type 2 commands to use embedded 32 byte cdb

 drivers/scsi/sd.c        | 45 +--------------------------------------------
 drivers/scsi/sd.h        |  5 -----
 include/linux/blkdev.h   |  2 +-
 include/scsi/scsi_cmnd.h | 13 ++-----------
 4 files changed, 4 insertions(+), 61 deletions(-)

-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-12-30  0:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19 10:34 [PATCH 0/2] Change type-2 dif to use rq embedded 32 byte cdb Scott Guthridge
2012-12-19 16:55 ` Martin K. Petersen
2012-12-19 17:28   ` Elliott, Robert (Server Storage)
2012-12-30  0:52 ` Douglas Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2012-11-21 20:07 Rob Evers
2012-11-26 16:25 ` Rob Evers
2012-11-26 23:58 ` Martin K. Petersen
2012-11-27 16:12   ` Rob Evers
2012-12-19 14:12 ` Rob Evers

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).