Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-13 Thread Rusty Russell
On Tue, 2007-03-13 at 10:15 -0700, Jeremy Fitzhardinge wrote: > Rusty Russell wrote: > > + pack_descriptor((u32 *)[GDT_ENTRY_PERCPU].a, > > + (u32 *)[GDT_ENTRY_PERCPU].b, > > + __per_cpu_offset[cpu], 0xF, > > 0x80 | DESCTYPE_S | 0x2,

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-13 Thread Jeremy Fitzhardinge
Rusty Russell wrote: > + pack_descriptor((u32 *)[GDT_ENTRY_PERCPU].a, > + (u32 *)[GDT_ENTRY_PERCPU].b, > + __per_cpu_offset[cpu], 0xF, > 0x80 | DESCTYPE_S | 0x2, 0); /* present read-write data > segment */ > Why testing

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-13 Thread Jeremy Fitzhardinge
Rusty Russell wrote: + pack_descriptor((u32 *)gdt[GDT_ENTRY_PERCPU].a, + (u32 *)gdt[GDT_ENTRY_PERCPU].b, + __per_cpu_offset[cpu], 0xF, 0x80 | DESCTYPE_S | 0x2, 0); /* present read-write data segment */ Why testing

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-13 Thread Rusty Russell
On Tue, 2007-03-13 at 10:15 -0700, Jeremy Fitzhardinge wrote: Rusty Russell wrote: + pack_descriptor((u32 *)gdt[GDT_ENTRY_PERCPU].a, + (u32 *)gdt[GDT_ENTRY_PERCPU].b, + __per_cpu_offset[cpu], 0xF, 0x80 | DESCTYPE_S | 0x2, 0);

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-07 Thread Rusty Russell
On Wed, 2007-03-07 at 11:33 +1100, Rusty Russell wrote: > On Tue, 2007-03-06 at 20:34 +0100, Andi Kleen wrote: > > Do you have text size comparisons before/after and possible lmbench? > > No, but I'll run them this evening. Last time the size reduction was > slight, and there was no measurable

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-07 Thread Rusty Russell
On Wed, 2007-03-07 at 11:33 +1100, Rusty Russell wrote: On Tue, 2007-03-06 at 20:34 +0100, Andi Kleen wrote: Do you have text size comparisons before/after and possible lmbench? No, but I'll run them this evening. Last time the size reduction was slight, and there was no measurable

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Jeremy Fitzhardinge
Rusty Russell wrote: > If we used __thread, then gcc could do this optimization for us when it > knows an rvalue is needed, however: > > 1) gcc wants to use %gs, not %fs, which is measurably slower for the > kernel, > 2) gcc wants to use huge offsets to store the address of the per-cpu >

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Rusty Russell
On Tue, 2007-03-06 at 20:34 +0100, Andi Kleen wrote: > Sigh -- i had hoped this had settled down because it was a > merging nightmare last time. Ok. Indeed, that's why I waited until everything else was fully merged and accepted. > > +#define percpu_to_op(op,var,val) \

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Rusty Russell
On Tue, 2007-03-06 at 14:10 +0100, Ingo Molnar wrote: > * Rusty Russell <[EMAIL PROTECTED]> wrote: > > > Currently x86 (similar to x84-64) has a special per-cpu structure > > called "i386_pda" which can be easily and efficiently referenced via > > the %fs register. An ELF section is more

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Jeremy Fitzhardinge
Andi Kleen wrote: > Sigh -- i had hoped this had settled down because it was a > merging nightmare last time. Ok. > > >> +#define percpu_to_op(op,var,val)\ >> +do {\ >> +typedef typeof(var) T__;

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Andi Kleen
Sigh -- i had hoped this had settled down because it was a merging nightmare last time. Ok. > +#define percpu_to_op(op,var,val) \ > + do {\ > + typedef typeof(var) T__;\ > +

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Jeremy Fitzhardinge
Rusty Russell wrote: > Currently x86 (similar to x84-64) has a special per-cpu structure > called "i386_pda" which can be easily and efficiently referenced via > the %fs register. An ELF section is more flexible than a structure, > allowing any piece of code to use this area. Indeed, such a

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Ingo Molnar
* Rusty Russell <[EMAIL PROTECTED]> wrote: > Currently x86 (similar to x84-64) has a special per-cpu structure > called "i386_pda" which can be easily and efficiently referenced via > the %fs register. An ELF section is more flexible than a structure, > allowing any piece of code to use this

[PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Rusty Russell
Currently x86 (similar to x84-64) has a special per-cpu structure called "i386_pda" which can be easily and efficiently referenced via the %fs register. An ELF section is more flexible than a structure, allowing any piece of code to use this area. Indeed, such a section already exists: the

[PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Rusty Russell
Currently x86 (similar to x84-64) has a special per-cpu structure called i386_pda which can be easily and efficiently referenced via the %fs register. An ELF section is more flexible than a structure, allowing any piece of code to use this area. Indeed, such a section already exists: the per-cpu

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Ingo Molnar
* Rusty Russell [EMAIL PROTECTED] wrote: Currently x86 (similar to x84-64) has a special per-cpu structure called i386_pda which can be easily and efficiently referenced via the %fs register. An ELF section is more flexible than a structure, allowing any piece of code to use this area.

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Jeremy Fitzhardinge
Rusty Russell wrote: Currently x86 (similar to x84-64) has a special per-cpu structure called i386_pda which can be easily and efficiently referenced via the %fs register. An ELF section is more flexible than a structure, allowing any piece of code to use this area. Indeed, such a section

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Andi Kleen
Sigh -- i had hoped this had settled down because it was a merging nightmare last time. Ok. +#define percpu_to_op(op,var,val) \ + do {\ + typedef typeof(var) T__;\ +

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Jeremy Fitzhardinge
Andi Kleen wrote: Sigh -- i had hoped this had settled down because it was a merging nightmare last time. Ok. +#define percpu_to_op(op,var,val)\ +do {\ +typedef typeof(var) T__;

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Rusty Russell
On Tue, 2007-03-06 at 14:10 +0100, Ingo Molnar wrote: * Rusty Russell [EMAIL PROTECTED] wrote: Currently x86 (similar to x84-64) has a special per-cpu structure called i386_pda which can be easily and efficiently referenced via the %fs register. An ELF section is more flexible than a

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Rusty Russell
On Tue, 2007-03-06 at 20:34 +0100, Andi Kleen wrote: Sigh -- i had hoped this had settled down because it was a merging nightmare last time. Ok. Indeed, that's why I waited until everything else was fully merged and accepted. +#define percpu_to_op(op,var,val) \ +

Re: [PATCH 8/8] Convert PDA into the percpu section

2007-03-06 Thread Jeremy Fitzhardinge
Rusty Russell wrote: If we used __thread, then gcc could do this optimization for us when it knows an rvalue is needed, however: 1) gcc wants to use %gs, not %fs, which is measurably slower for the kernel, 2) gcc wants to use huge offsets to store the address of the per-cpu space, and