From: Jeff Garzik <jeff@garzik.org>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
linux-ide@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] "killing" sg_last(), and discussion
Date: Wed, 31 Oct 2007 06:29:53 -0400 [thread overview]
Message-ID: <47285921.9070105@garzik.org> (raw)
In-Reply-To: <4728569D.9080502@panasas.com>
Boaz Harrosh wrote:
> On Wed, Oct 31 2007 at 10:49 +0200, Jeff Garzik <jeff@garzik.org> wrote:
>> I looked into killing sg_last(), but really, this is the best its gonna
>> get (moving sg_last to libata-core.c).
>>
>> You could maybe kill one use with caching, but in the other sg_last()
>> callsites there isn't another s/g loop we can stick a "last_sg = sg;"
>> into.
>>
>> libata is stuck because we undertake the highly unusual operation of
>> fiddling with the final S/G element, to enforce 32-bit alignment.
>>
>> Of course we could eliminate all that nasty fiddling/padding
>> completely, including sg_last(), if other areas of the kernel would
>> guarantee ahead of time that buffer lengths are always a multiple
>> of 4........
>>
>> Jeff
>>
> OK Now I'm confused. I thought that ULD's can give you SG's
> that are actually longer than bufflen and that, at the end, the
> bufflen should govern the transfer length.
>
> Now FS_PC commands are sector aligned so you do not have
> problems with that.
>
> The BLOCK_PC commands have 2 main sources that I know of
> one is sg && bsg from user mode that can easily enforce
> 4 bytes alignment. The second is kernel services which 80%
> of these are done by scsi_execute(). All These can be found
> and fixed. Starting with scsi_execute(). Another place can be
> blk_rq_map_sg(), since all IO's are bio based. It can enforce
> alignment too.
>
> I would start by sticking a WARN_ON(qc->pad_len) and
> see if it triggers, what are the sources of that.
The whole qc->pad_len etc. machinery was added because it solved
problems in the field with ATAPI devices. So sr or some userland
application is sending lengths that are not padded to 32-bit boundary,
probably because plenty of trivial commands can send or return odd
amounts of data.
This used to be irrelevant, but now with SATA, even PIO data xfer
(normally what is used for non-READ/WRITE CDBs) must be 32-bit aligned
because both SATA DMA and SATA PIO are converted into dword-based SATA
FIS's on the wire.
Jeff
next prev parent reply other threads:[~2007-10-31 10:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 8:49 [PATCH] "killing" sg_last(), and discussion Jeff Garzik
2007-10-31 10:19 ` Boaz Harrosh
2007-10-31 10:29 ` Jeff Garzik [this message]
2007-10-31 11:13 ` Boaz Harrosh
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=47285921.9070105@garzik.org \
--to=jeff@garzik.org \
--cc=bharrosh@panasas.com \
--cc=jens.axboe@oracle.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@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).