Re: [PATCH 09/10] Change table chaining layout

2007-10-26 Thread Jens Axboe
On Fri, Oct 26 2007, Linus Torvalds wrote: > > > On Fri, 26 Oct 2007, Paul Mackerras wrote: > > > > Linus Torvalds writes: > > > > > Nobody should *ever* walk the list to find the length. Does anybody > > > really > > > do that? Yes, we pass the thing down, but do people *need* it? > > > > Ye

Re: [PATCH 09/10] Change table chaining layout

2007-10-26 Thread Linus Torvalds
On Fri, 26 Oct 2007, Paul Mackerras wrote: > > Linus Torvalds writes: > > > Nobody should *ever* walk the list to find the length. Does anybody really > > do that? Yes, we pass the thing down, but do people *need* it? > > Yes, I need it for devices that use the macintosh DBDMA > (descriptor-ba

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Paul Mackerras
Linus Torvalds writes: > Nobody should *ever* walk the list to find the length. Does anybody really > do that? Yes, we pass the thing down, but do people *need* it? Yes, I need it for devices that use the macintosh DBDMA (descriptor-based DMA) hardware. The DBDMA hardware reads an array of desc

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Rusty Russell
On Thursday 25 October 2007 21:54:44 Rusty Russell wrote: > On Thursday 25 October 2007 19:11:40 Jens Axboe wrote: > > On Thu, Oct 25 2007, Rusty Russell wrote: > > > What irritates me more is that scatterlists aren't quite generically > > > useful. The virtio code wants to join a scatterlist creat

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Benny Halevy
On Oct. 25, 2007, 17:40 +0200, Linus Torvalds <[EMAIL PROTECTED]> wrote: > > On Thu, 25 Oct 2007, Rusty Russell wrote: >> On Wednesday 24 October 2007 01:22:55 Linus Torvalds wrote: >>> Well, I'd personally actually prefer to *not* have the count be passed >>> down explicitly, because it's just to

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Linus Torvalds
On Thu, 25 Oct 2007, Rusty Russell wrote: > On Wednesday 24 October 2007 01:22:55 Linus Torvalds wrote: > > > > Well, I'd personally actually prefer to *not* have the count be passed > > down explicitly, because it's just too error prone. > > Well, the duplication is bad, but walking lists to fi

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Rusty Russell
On Thursday 25 October 2007 19:11:40 Jens Axboe wrote: > On Thu, Oct 25 2007, Rusty Russell wrote: > > What irritates me more is that scatterlists aren't quite generically > > useful. The virtio code wants to join a scatterlist created by > > blk_rq_map_sg() with two others, yet it won't work becau

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Jens Axboe
On Thu, Oct 25 2007, Rusty Russell wrote: > On Wednesday 24 October 2007 01:22:55 Linus Torvalds wrote: > > On Tue, 23 Oct 2007, Boaz Harrosh wrote: > > > But since we do not do that, and every single API in the kernel that > > > receives a scatterlist pointer also receives an sg_count parameter, >

Re: [PATCH 09/10] Change table chaining layout

2007-10-25 Thread Rusty Russell
On Wednesday 24 October 2007 01:22:55 Linus Torvalds wrote: > On Tue, 23 Oct 2007, Boaz Harrosh wrote: > > But since we do not do that, and every single API in the kernel that > > receives a scatterlist pointer also receives an sg_count parameter, > > than I do not see what is so hacky about giving

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Linus Torvalds
On Wed, 24 Oct 2007, Jens Axboe wrote: > > > > As it no longer sets the page only, perhaps it's a good idea to rename > > sg_set_page() to sg_set()? > > sg_set_buf() also sets length and offset, sg_set_page() is just a mirror > of that. So I'd prefer to keep the naming. I agree. And it's not l

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Olivier Galibert
On Wed, Oct 24, 2007 at 03:38:04PM +0200, Jens Axboe wrote: > (please don't drop cc lists) Sorry. Reactions of people to Cc vary... > That doesn't make any sense. Both sg_set_buf() and sg_set_page() set the > same thing in the sg entry, the input is just different. It has nothing > to do with s

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Jens Axboe
On Wed, Oct 24 2007, Olivier Galibert wrote: > On Wed, Oct 24, 2007 at 11:12:42AM +0200, Jens Axboe wrote: > > sg_set_buf() also sets length and offset, sg_set_page() is just a mirror > > of that. So I'd prefer to keep the naming. > > Hmmm, sg_set_phys/sg_set_virt to be more symmetrical to > sg_ph

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Olivier Galibert
On Wed, Oct 24, 2007 at 11:12:42AM +0200, Jens Axboe wrote: > sg_set_buf() also sets length and offset, sg_set_page() is just a mirror > of that. So I'd prefer to keep the naming. Hmmm, sg_set_phys/sg_set_virt to be more symmetrical to sg_phys/sg_virt? OG. - To unsubscribe from this list: send

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Jens Axboe
On Wed, Oct 24 2007, Geert Uytterhoeven wrote: > On Wed, 24 Oct 2007, Jens Axboe wrote: > > On Tue, Oct 23 2007, Linus Torvalds wrote: > > > My biggest complaint right now is that a lot of users of the sg *filling* > > > functions were mindlessly converted, so we have code like > > > > > > cryp

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Geert Uytterhoeven
On Wed, 24 Oct 2007, Jens Axboe wrote: > On Tue, Oct 23 2007, Linus Torvalds wrote: > > My biggest complaint right now is that a lot of users of the sg *filling* > > functions were mindlessly converted, so we have code like > > > > cryptoloop.c: sg_set_page(&sg_in, in_page); > >

Re: [PATCH 09/10] Change table chaining layout

2007-10-24 Thread Jens Axboe
On Tue, Oct 23 2007, Linus Torvalds wrote: > My biggest complaint right now is that a lot of users of the sg *filling* > functions were mindlessly converted, so we have code like > > cryptoloop.c: sg_set_page(&sg_in, in_page); > cryptoloop.c: sg_in.offset = in_

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Geert Uytterhoeven wrote: > On Tue, 23 Oct 2007, Ingo Molnar wrote: > > * Jens Axboe <[EMAIL PROTECTED]> wrote: > > > > > > Linus' latest tree, which has your SG-list enhancements included, > > > > certainly works fine here and does not have the problems of the > > > > first

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Geert Uytterhoeven wrote: > On Tue, 23 Oct 2007, Ingo Molnar wrote: > > * Jens Axboe <[EMAIL PROTECTED]> wrote: > > > > > > Linus' latest tree, which has your SG-list enhancements included, > > > > certainly works fine here and does not have the problems of the > > > > first

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Andi Kleen wrote: > On Tue, Oct 23, 2007 at 10:20:17PM +0200, Jens Axboe wrote: > > On Tue, Oct 23 2007, Andi Kleen wrote: > > > Jens Axboe <[EMAIL PROTECTED]> writes: > > > > > > >> You might want to put a BUG_ON(page & 0x3); Make sure > > > >> you're not loosing information.

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Andi Kleen
On Tue, Oct 23, 2007 at 10:20:17PM +0200, Jens Axboe wrote: > On Tue, Oct 23 2007, Andi Kleen wrote: > > Jens Axboe <[EMAIL PROTECTED]> writes: > > > > >> You might want to put a BUG_ON(page & 0x3); Make sure > > >> you're not loosing information. (The m68k problem) > > > > > > That's a really goo

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Andi Kleen wrote: > Jens Axboe <[EMAIL PROTECTED]> writes: > > >> You might want to put a BUG_ON(page & 0x3); Make sure > >> you're not loosing information. (The m68k problem) > > > > That's a really good idea, thanks Boaz! I'll add that. > > It would be even better if you re

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Andi Kleen
Jens Axboe <[EMAIL PROTECTED]> writes: >> You might want to put a BUG_ON(page & 0x3); Make sure >> you're not loosing information. (The m68k problem) > > That's a really good idea, thanks Boaz! I'll add that. It would be even better if you replaced all the magic numbers with defines or better acc

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Geert Uytterhoeven
On Tue, 23 Oct 2007, Ingo Molnar wrote: > * Jens Axboe <[EMAIL PROTECTED]> wrote: > > > > Linus' latest tree, which has your SG-list enhancements included, > > > certainly works fine here and does not have the problems of the > > > first iteration. > > > > That's good to hear :-) > > > > I hav

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Boaz Harrosh wrote: > On Mon, Oct 22 2007 at 20:11 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > > Change the page member of the scatterlist structure to be an unsigned > > long, and encode more stuff in the lower bits: > > > > - Bits 0 and 1 zero: this is a normal sg entry.

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Boaz Harrosh
On Mon, Oct 22 2007 at 20:11 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > Change the page member of the scatterlist structure to be an unsigned > long, and encode more stuff in the lower bits: > > - Bits 0 and 1 zero: this is a normal sg entry. Next sg entry is located > at sg + 1. > - Bit 0 s

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Linus Torvalds
On Tue, 23 Oct 2007, Boaz Harrosh wrote: > > A nice design is to have an struct like BIO. That holds a pointer to the > array of scatterlists, size, ..., and a next and prev pointers to the next > chunks. Than have all kernel code that now accepts scatterlist* and size > accept a pointer to such

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Ingo Molnar
* Jens Axboe <[EMAIL PROTECTED]> wrote: > > Linus' latest tree, which has your SG-list enhancements included, > > certainly works fine here and does not have the problems of the > > first iteration. > > That's good to hear :-) > > I have a series of pending patches where I've collected fallou

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Ingo Molnar wrote: > > * Jens Axboe <[EMAIL PROTECTED]> wrote: > > > It's all about the end goal - having maintainable and resilient code. > > And I think the sg code will be better once we get past the next day > > or so, and it'll be more robust. That is what matters to m

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Ingo Molnar
* Jens Axboe <[EMAIL PROTECTED]> wrote: > It's all about the end goal - having maintainable and resilient code. > And I think the sg code will be better once we get past the next day > or so, and it'll be more robust. That is what matters to me, not the > simplicity of the patch itself. Linus

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Boaz Harrosh wrote: > On Tue, Oct 23 2007 at 11:55 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > > On Tue, Oct 23 2007, Boaz Harrosh wrote: > >> On Tue, Oct 23 2007 at 11:41 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > >>> On Tue, Oct 23 2007, Boaz Harrosh wrote: > On M

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Boaz Harrosh
On Tue, Oct 23 2007 at 11:55 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > On Tue, Oct 23 2007, Boaz Harrosh wrote: >> On Tue, Oct 23 2007 at 11:41 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: >>> On Tue, Oct 23 2007, Boaz Harrosh wrote: On Mon, Oct 22 2007 at 23:47 +0200, Linus Torvalds <[EM

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Boaz Harrosh wrote: > On Tue, Oct 23 2007 at 11:41 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > > On Tue, Oct 23 2007, Boaz Harrosh wrote: > >> On Mon, Oct 22 2007 at 23:47 +0200, Linus Torvalds <[EMAIL PROTECTED]> > >> wrote: > >>> On Mon, 22 Oct 2007, Alan Cox wrote: > >>>

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Boaz Harrosh
On Tue, Oct 23 2007 at 11:41 +0200, Jens Axboe <[EMAIL PROTECTED]> wrote: > On Tue, Oct 23 2007, Boaz Harrosh wrote: >> On Mon, Oct 22 2007 at 23:47 +0200, Linus Torvalds <[EMAIL PROTECTED]> wrote: >>> On Mon, 22 Oct 2007, Alan Cox wrote: >>> For structures, not array elements or stack objects

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Jens Axboe
On Tue, Oct 23 2007, Boaz Harrosh wrote: > On Mon, Oct 22 2007 at 23:47 +0200, Linus Torvalds <[EMAIL PROTECTED]> wrote: > > > > On Mon, 22 Oct 2007, Alan Cox wrote: > > > >> For structures, not array elements or stack objects. Does gcc now get > >> aligned correct as an attribute on a stack obje

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Boaz Harrosh
On Mon, Oct 22 2007 at 23:47 +0200, Linus Torvalds <[EMAIL PROTECTED]> wrote: > > On Mon, 22 Oct 2007, Alan Cox wrote: > >> For structures, not array elements or stack objects. Does gcc now get >> aligned correct as an attribute on a stack object ? > > I think m68k stack layout still guarantees

Re: [PATCH 09/10] Change table chaining layout

2007-10-23 Thread Geert Uytterhoeven
On Mon, 22 Oct 2007, Linus Torvalds wrote: > On Mon, 22 Oct 2007, Alan Cox wrote: > > For structures, not array elements or stack objects. Does gcc now get > > aligned correct as an attribute on a stack object ? > > I think m68k stack layout still guarantees 4-byte-alignment, no? The stack pointe

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Jeff Garzik
Matt Mackall wrote: On Mon, Oct 22, 2007 at 11:52:51PM +0100, Alan Cox wrote: On Mon, 22 Oct 2007 16:47:07 -0500 Matt Mackall <[EMAIL PROTECTED]> wrote: On Mon, Oct 22, 2007 at 05:21:30PM -0400, Jeff Garzik wrote: Alan Cox wrote: Why can't we just make the list one item longer than the entry

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread David Miller
From: Linus Torvalds <[EMAIL PROTECTED]> Date: Mon, 22 Oct 2007 14:47:38 -0700 (PDT) > On Mon, 22 Oct 2007, Alan Cox wrote: > > > Still doesn't answer the rather more important question - why not just > > stick a NULL on the end instead of all the nutty hacks ? > > You still do need one bit for

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Matt Mackall
On Mon, Oct 22, 2007 at 11:52:51PM +0100, Alan Cox wrote: > On Mon, 22 Oct 2007 16:47:07 -0500 > Matt Mackall <[EMAIL PROTECTED]> wrote: > > > On Mon, Oct 22, 2007 at 05:21:30PM -0400, Jeff Garzik wrote: > > > Alan Cox wrote: > > > >Why can't we just make the list one item longer than the entry co

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Alan Cox
On Mon, 22 Oct 2007 16:47:07 -0500 Matt Mackall <[EMAIL PROTECTED]> wrote: > On Mon, Oct 22, 2007 at 05:21:30PM -0400, Jeff Garzik wrote: > > Alan Cox wrote: > > >Why can't we just make the list one item longer than the entry count and > > >stick a NULL on the end of it like normal people ? > > >

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Linus Torvalds
On Mon, 22 Oct 2007, Alan Cox wrote: > For structures, not array elements or stack objects. Does gcc now get > aligned correct as an attribute on a stack object ? I think m68k stack layout still guarantees 4-byte-alignment, no? > Still doesn't answer the rather more important question - why no

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Matt Mackall
On Mon, Oct 22, 2007 at 05:21:30PM -0400, Jeff Garzik wrote: > Alan Cox wrote: > >Why can't we just make the list one item longer than the entry count and > >stick a NULL on the end of it like normal people ? > > Certainly seems safer than the current "let's run off the end of the > list if anyth

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Alan Cox
On Mon, 22 Oct 2007 13:44:43 -0700 (PDT) Linus Torvalds <[EMAIL PROTECTED]> wrote: > > > On Mon, 22 Oct 2007, Alan Cox wrote: > > > > Why can't we just make the list one item longer than the entry count and > > stick a NULL on the end of it like normal people ? Then you need one bit > > which o

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Jeff Garzik
Alan Cox wrote: Why can't we just make the list one item longer than the entry count and stick a NULL on the end of it like normal people ? Certainly seems safer than the current "let's run off the end of the list if anything bad happens" setup... And I do not think allocating n+1 scatterlis

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Benny Halevy
On Oct. 22, 2007, 22:16 +0200, Alan Cox <[EMAIL PROTECTED]> wrote: > On Mon, 22 Oct 2007 12:49:40 -0700 (PDT) > Linus Torvalds <[EMAIL PROTECTED]> wrote: > >> >> On Mon, 22 Oct 2007, Geert Uytterhoeven wrote: >>> Better safe than sorry... >>> >>> Is it possible that a chain entry pointer has bit 1

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Linus Torvalds
On Mon, 22 Oct 2007, Alan Cox wrote: > > Why can't we just make the list one item longer than the entry count and > stick a NULL on the end of it like normal people ? Then you need one bit > which ought to be safe for everyone (and if the bit is a macro any CPU > warped enough to have byte align

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Matt Mackall
On Mon, Oct 22, 2007 at 09:16:17PM +0100, Alan Cox wrote: > On Mon, 22 Oct 2007 12:49:40 -0700 (PDT) > Linus Torvalds <[EMAIL PROTECTED]> wrote: > > > > > > > On Mon, 22 Oct 2007, Geert Uytterhoeven wrote: > > > > > > Better safe than sorry... > > > > > > Is it possible that a chain entry point

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Alan Cox
On Mon, 22 Oct 2007 12:49:40 -0700 (PDT) Linus Torvalds <[EMAIL PROTECTED]> wrote: > > > On Mon, 22 Oct 2007, Geert Uytterhoeven wrote: > > > > Better safe than sorry... > > > > Is it possible that a chain entry pointer has bit 1 set on architectures > > (e.g. m68k) where the natural alignment

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Jens Axboe
On Mon, Oct 22 2007, Linus Torvalds wrote: > > > On Mon, 22 Oct 2007, Geert Uytterhoeven wrote: > > > > Better safe than sorry... > > > > Is it possible that a chain entry pointer has bit 1 set on architectures > > (e.g. m68k) where the natural alignment of 32-bit quantities is _2_ bytes, > > no

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Linus Torvalds
On Mon, 22 Oct 2007, Geert Uytterhoeven wrote: > > Better safe than sorry... > > Is it possible that a chain entry pointer has bit 1 set on architectures > (e.g. m68k) where the natural alignment of 32-bit quantities is _2_ bytes, > not 4? Better make sure that such alignment never happens... B

Re: [PATCH 09/10] Change table chaining layout

2007-10-22 Thread Geert Uytterhoeven
On Mon, 22 Oct 2007, Jens Axboe wrote: > Change the page member of the scatterlist structure to be an unsigned > long, and encode more stuff in the lower bits: > > - Bits 0 and 1 zero: this is a normal sg entry. Next sg entry is located > at sg + 1. > - Bit 0 set: this is a chain entry, the next

[PATCH 09/10] Change table chaining layout

2007-10-22 Thread Jens Axboe
Change the page member of the scatterlist structure to be an unsigned long, and encode more stuff in the lower bits: - Bits 0 and 1 zero: this is a normal sg entry. Next sg entry is located at sg + 1. - Bit 0 set: this is a chain entry, the next real entry is at ->page_link with the two low bi