linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Jeff Garzik <jeff@garzik.org>
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 12:19:09 +0200	[thread overview]
Message-ID: <4728569D.9080502@panasas.com> (raw)
In-Reply-To: <20071031084920.GA25202@havoc.gtf.org>

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.

Please note that the code already has a 4 bytes alignment
assumption about the start of the transfer, other wise
the first SG can also have a none aligned length, which
is not checked for.

Boaz

  reply	other threads:[~2007-10-31 10:19 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 [this message]
2007-10-31 10:29   ` Jeff Garzik
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=4728569D.9080502@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=jeff@garzik.org \
    --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).