From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Christoph Hellwig <hch@infradead.org>,
Jens Axboe <jens.axboe@oracle.com>J
Subject: new scsi sense handling
Date: Mon, 04 Feb 2008 17:08:47 +0200 [thread overview]
Message-ID: <47A72A7F.1050301@panasas.com> (raw)
There are 3 usages of sense handling in drivers
1. sense is available in driver internal structure and is mem-copied to upper level
2. A CHECK_CONDITION status was returned and the driver uses the scsi_eh_prep_cmnd()
for a REQUEST_SENSE invocation to the target. Then returning the sense in
scsi_eh_return_cmnd(). A variation on this is when the driver does nothing the queue
is frozen an the scsi watchdog timer does the above.
3. The underline host adapter does the REQUEST_SENSE and a pre-allocated and DMA mapped
sense buffer receives the sense information from HW.
Now since all IO requests come with a sense set at request->sense the buffer at
scsi_cmnd->sense_buffer can go away, and case 1 above can copy it's bits directly
into it.
Inspection of all users of blk_execute_rq_nowait() shows that all users setup a sense
buffer, but submitted code puts a BUG_ON to make sure new code does not break that.
for cases 2 and 3 above two new members in scsi host template will tell scsi-midlayer
what the driver wants to do.
.sense_buffsize - will instruct a mempool_t to be allocated per host with sense buffers
of ".sense_buffsize" size.
.pre_allocate_sense - If set tells the midlayer to pre-allocate a sense buffer for each
command. When set the code will behave like today. If the sense
allocation fails the command allocation also fails. (With one extra
sense at mempool)
If .pre_allocate_sense is not set, then mempool_t is resized to
accommodate one reserved buffer for each target. So a call to
scsi_eh_prep_cmnd() will not fail to allocate a sense buffer even
in low memory condition.
Case 1 drivers call - scsi_eh_cpy_sense() - to transfer their sense information to upper
layer. The drivers are completely abstracted from any future changes at the scsi and block
sense handling.
Case 3 drivers call the new scsi_make_sense()/scsi_return_sense() API to retrieve
a pointer to an extra DMAable sense buffer/return it to free store. scsi_return_sense()
will call scsi_eh_cpy_sense() to set new sense information into upper layer before
freeing the buffer back to the mempool. If the driver properly set the .pre_allocate_sense
flag & .sense_buffsize at host template then these calls are guaranteed to succeed.
Case 2 drivers continue to call scsi_eh_prep_cmnd()/scsi_eh_restore_cmnd() to reuse the
failing command for REQUEST_SENSE. Inside these functions scsi_error.c will call above
scsi_make_sense()/scsi_return_sense() for the actual sense buffer allocation. In this
case there is a guarantied, one reserved buffer per scsi_device. (.pre_allocate_sense not set).
Drivers need to set proper size at .sense_buffsize in host template, for this to work.
Upper layer and ULDs that need to inspect the sense information can get to it
using the scsi_sense() accessor.
Submitted for Review and comments (RFC) a patcset for that effect.
- first patch will introduce the new API implemented over existing members:
scsi_eh: Define new API for sense handling
- first group of patches are the case 1 drivers:
scsi-drivers: Move to new sense API. The Trevial case
scsi-drivers: more drivers use new scsi_eh_cpy_sense()
firewire & ieee1394: Simple convert to new scsi_eh_cpy_sense.
dpt_i2o: Use new scsi_eh_cpy_sense()
gdth: Use of scsi_eh API and sense accessors
qla2xxx: convert to new scsi_eh_cpy_sense API
isd200, transport: Use scsi_eh_cpy_sense API
ultrastor: Use scsi_eh_cpy_sense() API
usb/microtek: No special handling for REQUEST_SENSE command please
- second group are case 2 drivers:
libata: Use scsi_eh API for REQUEST_SENSE invocation
53c700: Use scsi_eh API for REQUEST_SENSE invocation
aic7xxx_old: Use scsi_eh API for REQUEST_SENSE invocation
dc395x: Use scsi_eh API for REQUEST_SENSE invocation
tmscsim: Use scsi_eh API for REQUEST_SENSE invocation
Add .sense_buffsize to drivers that use scsi_eh_prep_cmnd
- third group are case 3:
BusLogic: Use of scsi_make_sense() API for DMA-able sense buffer
eata: Use of scsi_make_sense() API for DMA-able sense buffer
initio: Use of scsi_make_sense() API for DMA-able sense buffer
u14-34f: Use of scsi_make_sense() API for DMA-able sense buffer
- Then, some patches for the upper layer:
scsi_tgt: use of sense accessors
scsi upper layer use of sense accessors
- And finally, block and scsi-midlayer switch to new handling.
block: Minor changes to sense handling
scsi: New sense handling
These patches are over latest scsi-misc. They are completely *untested* and are for discussion
only. I will debug and update in the near future but only if it is accepted in principle
first.
Lots of maintainers' ACKs are needed and a good deal of testing time in mm so I think this
is only 2.6.26 at the earliest.
Comment away ;)
Volunteers for testing needed!
Boaz
next reply other threads:[~2008-02-04 15:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-04 15:08 Boaz Harrosh [this message]
2008-02-05 2:39 ` new scsi sense handling Luben Tuikov
2008-02-05 13:54 ` FUJITA Tomonori
2008-02-05 19:43 ` Luben Tuikov
2008-02-06 0:55 ` FUJITA Tomonori
2008-02-06 2:14 ` Luben Tuikov
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=47A72A7F.1050301@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hch@infradead.org \
--cc=jens.axboe@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.