public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: stern@rowland.harvard.edu, andi@firstfloor.org,
	linux-kernel@vger.kernel.org, antonio.lin@alcormicro.com,
	david.vrabel@csr.com
Subject: Re: Scatter-gather list constraints
Date: Thu, 26 Jun 2008 14:39:36 +0200	[thread overview]
Message-ID: <20080626123936.GV20851@kernel.dk> (raw)
In-Reply-To: <20080626155834I.fujita.tomonori@lab.ntt.co.jp>

On Thu, Jun 26 2008, FUJITA Tomonori wrote:
> On Thu, 26 Jun 2008 08:35:59 +0200
> Jens Axboe <jens.axboe@oracle.com> wrote:
> 
> > On Thu, Jun 26 2008, FUJITA Tomonori wrote:
> > > On Thu, 26 Jun 2008 11:06:03 +0900
> > > FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> > > 
> > > > On Wed, 25 Jun 2008 10:23:00 -0400 (EDT)
> > > > Alan Stern <stern@rowland.harvard.edu> wrote:
> > > > 
> > > > > On Wed, 25 Jun 2008, FUJITA Tomonori wrote:
> > > > > 
> > > > > > > For example, suppose an I/O request starts out with two S-G elements
> > > > > > > of 1536 bytes and 2048 bytes respectively, and the DMA requirement is
> > > > > > > that all elements except the last must have length divisible by 1024.  
> > > > > > > Then the request could be broken up into three requests of 1024, 512,
> > > > > > > and 2048 bytes.
> > > > > > 
> > > > > > I can't say that it's easy to implement a clean mechanism to break up
> > > > > > a request into multiple requests until I see a patch.
> > > > > 
> > > > > And I can't write a patch without learning a lot more about how the
> > > > > block core works.
> > > > > 
> > > > > > What I said is that you think that this is about extending something
> > > > > > in the block layer but it's about adding a new concept to the block
> > > > > > layer.
> > > > > 
> > > > > Is it?  What does the block layer do when it receives an I/O request
> > > > > that don't satisfy the other constraints (max_sectors or
> > > > > dma_alignment_mask, for example)?
> > > > 
> > > > As I explained, you need something new.
> > > > 
> > > > I don't think that max_sectors works as you expect.
> > > 
> > > The block layer looks at max_sectors when merging two things (or add
> > > one to another). So the test fails, it doesn't merge them.
> > > 
> > > 
> > > > dma_alignment_mask is not used in the FS path. And I think that
> > > > dma_alignment_mask doens't solve your problems.
> > > 
> > > If dma_alignment_mask test fails, the block layer allocates temporary
> > > buffers and does memory copies.
> > 
> > I don't think adding anything in the general IO path makes a lot of
> > sense, this is a really screwy case. I don't mind adding work-arounds to
> > the block layer to cater for hardware weirdness, but this is getting a
> > little silly. We could provide a helper function for 'bouncing' this
> > request and thus reuse the block bounce buffer for this, but I'm not
> > even sure how to simply express this generically. As it is likely of no
> > use outside of this specific case, putting it in the driver (or usb
> > layer, if you expect more of these similar cases) is the best option.
> 
> Yeah, agreed, as I wrote in the first mail:
> 
> http://marc.info/?l=linux-kernel&m=121430416329618&w=2
> 
> I guess that a generic mechanism reserving some buffers in the block
> layer might work for them. I also need such a mechnism to convert sg
> and st to use the block layer (yeah, it's overdue but still on my todo
> list).

On the fs side, just setting a hw block size of 1k should fix the
problem, since that'd be your minimum transfer size AND alignment there
even for O_DIRECT IO.

So that leaves SG_IO (and similar) issued IO, which are typically really
small (and thus not an issue, since it'll be a single sg element). For
the bigger ones, sg elements should be tightly packed (eg page size)
except the last one.

Alan, in what specific cases have you observed IO requests that violate
the rules you gave? The example of:

"For example, suppose an I/O request starts out with two S-G elements of
1536 bytes and 2048 bytes respectively, and the DMA requirement is"

really sounds concocted, have you ever seen something like that?

-- 
Jens Axboe


  reply	other threads:[~2008-06-26 12:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 20:30 Scatter-gather list constraints Alan Stern
2008-06-20 20:50 ` David Miller
2008-06-21 13:59 ` Andi Kleen
2008-06-21 14:54   ` Alan Stern
2008-06-21 15:21     ` Andi Kleen
2008-06-21 21:50       ` Alan Stern
2008-06-21 23:00         ` Andi Kleen
2008-06-22 14:35           ` Alan Stern
2008-06-24 10:41         ` FUJITA Tomonori
2008-06-24 14:57           ` Alan Stern
2008-06-25  0:18             ` FUJITA Tomonori
2008-06-25 14:23               ` Alan Stern
2008-06-26  2:06                 ` FUJITA Tomonori
2008-06-26  5:39                   ` FUJITA Tomonori
2008-06-26  6:35                     ` Jens Axboe
2008-06-26  6:58                       ` FUJITA Tomonori
2008-06-26 12:39                         ` Jens Axboe [this message]
2008-06-26 12:54                           ` Andi Kleen
2008-06-26 13:00                             ` Jens Axboe
2008-06-26 15:12                           ` Alan Stern
2008-06-26 17:41                             ` Jens Axboe
2008-08-27 21:32                               ` Alan Stern
2008-06-26 15:16                           ` Boaz Harrosh
2008-06-26 17:39                             ` Jens Axboe
2008-06-26 14:18                       ` Alan Stern
2008-06-23 14:46 ` David Vrabel
2008-06-23 15:12   ` Alan Stern
2008-06-23 19:06     ` David Vrabel
2008-06-23 19:45       ` Alan Stern
2008-06-23 21:53         ` Stefan Richter
2008-06-25  4:02       ` Perez-Gonzalez, Inaky
2008-06-25 14:24         ` Alan Stern
2008-06-26 16:43           ` Perez-Gonzalez, Inaky
2008-06-26 19:34             ` Alan Stern
2008-06-26 22:39               ` Inaky Perez-Gonzalez

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=20080626123936.GV20851@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=andi@firstfloor.org \
    --cc=antonio.lin@alcormicro.com \
    --cc=david.vrabel@csr.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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