linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Important per-cpu fix.
  2002-09-05  9:10 [PATCH] Important per-cpu fix Dipankar Sarma
@ 2002-09-05  9:09 ` William Lee Irwin III
  2002-09-05 19:08   ` Dipankar Sarma
  0 siblings, 1 reply; 32+ messages in thread
From: William Lee Irwin III @ 2002-09-05  9:09 UTC (permalink / raw)
  To: Dipankar Sarma
  Cc: rusty, Linus Torvalds, Andrew Morton, Dave Miller, linux-kernel

> In article <20020904023535.73D922C12D@lists.samba.org> Rusty Russell wrote:
>> This might explain the wierd per-cpu problem reports from Andrew and
>> Dave, and also that nagging feeling that I'm an idiot...

On Thu, Sep 05, 2002 at 02:40:23PM +0530, Dipankar Sarma wrote:
> Not only does this fix the tasklet BUG with 2.5.32 but it also fixes a serial
> console hang with my 2.5.32 version of Ingo/Davem/Alexey's scalable timers 
> code that I have been debugging for the last two days. I use
> a per-cpu tasklet to run the timers, so it was probably killing me
> there.

Are you running on NUMA-Q? Do you also see the tty deadlock?


Thanks,
Bill

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
@ 2002-09-05  9:10 Dipankar Sarma
  2002-09-05  9:09 ` William Lee Irwin III
  0 siblings, 1 reply; 32+ messages in thread
From: Dipankar Sarma @ 2002-09-05  9:10 UTC (permalink / raw)
  To: rusty; +Cc: Linus Torvalds, Andrew Morton, Dave Miller, linux-kernel


In article <20020904023535.73D922C12D@lists.samba.org> Rusty Russell wrote:
> Frankly, I'm amazed the kernel worked for long without this.

> Every linker script thinks the section is called .data.percpu.
> Without this patch, every CPU ends up sharing the same "per-cpu"
> variable.

> This might explain the wierd per-cpu problem reports from Andrew and
> Dave, and also that nagging feeling that I'm an idiot...

Not only does this fix the tasklet BUG with 2.5.32 but it also fixes a serial
console hang with my 2.5.32 version of Ingo/Davem/Alexey's scalable timers 
code that I have been debugging for the last two days. I use
a per-cpu tasklet to run the timers, so it was probably killing me
there.

Thanks
-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-05  9:09 ` William Lee Irwin III
@ 2002-09-05 19:08   ` Dipankar Sarma
  2002-09-05 19:11     ` William Lee Irwin III
  0 siblings, 1 reply; 32+ messages in thread
From: Dipankar Sarma @ 2002-09-05 19:08 UTC (permalink / raw)
  To: William Lee Irwin III; +Cc: linux-kernel

On Thu, Sep 05, 2002 at 02:09:59AM -0700, William Lee Irwin III wrote:
> Are you running on NUMA-Q? Do you also see the tty deadlock?
> 

No, a 4CPU PIII box. What tty deadlock ?

Thanks
-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-05 19:08   ` Dipankar Sarma
@ 2002-09-05 19:11     ` William Lee Irwin III
  0 siblings, 0 replies; 32+ messages in thread
From: William Lee Irwin III @ 2002-09-05 19:11 UTC (permalink / raw)
  To: Dipankar Sarma; +Cc: linux-kernel

On Thu, Sep 05, 2002 at 02:09:59AM -0700, William Lee Irwin III wrote:
>> Are you running on NUMA-Q? Do you also see the tty deadlock?

On Fri, Sep 06, 2002 at 12:38:53AM +0530, Dipankar Sarma wrote:
> No, a 4CPU PIII box. What tty deadlock ?
> Thanks

The one reported in the "mysterious tty deadlock" thread.
Basically, some kind of badness happens where it has to be sent
a signal-generating character before generating output a good
chunk of the time, where extra carriage returns sometimes help.


Cheers,
Bill

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09  8:15                       ` David S. Miller
  2002-09-09 20:58                         ` Alan Cox
@ 2002-09-10  9:41                         ` Rusty Russell
  1 sibling, 0 replies; 32+ messages in thread
From: Rusty Russell @ 2002-09-10  9:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: pavel, torvalds, linux-kernel, akpm

In message <20020909.011539.122194350.davem@redhat.com> you write:
>    I want *you* to feel the pain, not spread it around by leaving turds
>    throughout the code long after the bug is forgotten:
>    
> Aha, but it is you putting the turd comments all over.  I'm
> suggesting to put the turd in one place, the header file.

.... and every user of it...

> And how difficult is it to discern which initializers were
> needed?  Hmmm let me see, if it was all zero --> removing it
> is harmless.

Let's not get onto initializer wars: I initialize all my variables
exactly once, so there's serious semantic difference between "static
int x;" and "static int x = 0;" in my code.

> Both of us are advocating adding shit to the tree, the only argument
> is which stinks less from a maintainence perspective.

Hey, I'm not stopping you sending a patch to Linus, but given how we
deprecated compilers on x86, I don't think he'll have sympathy for
you in 2.6.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09 12:17 Matthew Wilcox
@ 2002-09-09 23:24 ` Rusty Russell
  0 siblings, 0 replies; 32+ messages in thread
From: Rusty Russell @ 2002-09-09 23:24 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-kernel

In message <20020909131744.G10583@parcelfarce.linux.theplanet.co.uk> you write:
> Rusty wrote:
> > Yeah, but you can still leave a spinlock uninitialized, and it'll
> > work.
> 
> If your architecture has load-and-zero as its only atomic primitive,
> leaving spinlocks uninitialised will _not_ work ;-)

<sigh>

Context: static initializers. ie. you can use dynamic initialization
on your spinlocks.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09 20:58                         ` Alan Cox
@ 2002-09-09 21:06                           ` Andrew Morton
  0 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2002-09-09 21:06 UTC (permalink / raw)
  To: Alan Cox
  Cc: David S. Miller, rusty, pavel, Linus Torvalds, linux-kernel, akpm

Alan Cox wrote:
> 
> On Mon, 2002-09-09 at 09:15, David S. Miller wrote:
> > Note that Andrew Morton found the problem on one of his older
> > x86 EGCS's about the same time I found it on sparc64.
> 
> egcs gets so many long long things wrong on x86 that its only valid use
> IMHO for 2.5 is as a syntax checker. Is it really worth an ugly hack for
> a compiler one major developer has a personal affliction for and a port
> that has a tiny user base and now has a working compiler.
> 
> Maybe if we put less gunk in the kernel they'd fix gcc more often 8)

Please.  I'm not a reason for hanging onto egcs-1.1.2; and I'll
downgrade to 2.95.2 when egcs-1.1.2 is retired (as I did a while back).

But as long as we need to support 1.1.2, I use it.  To detect
breakage, and because it compiles kernels 30% faster.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09  8:15                       ` David S. Miller
@ 2002-09-09 20:58                         ` Alan Cox
  2002-09-09 21:06                           ` Andrew Morton
  2002-09-10  9:41                         ` Rusty Russell
  1 sibling, 1 reply; 32+ messages in thread
From: Alan Cox @ 2002-09-09 20:58 UTC (permalink / raw)
  To: David S. Miller; +Cc: rusty, pavel, Linus Torvalds, linux-kernel, akpm

On Mon, 2002-09-09 at 09:15, David S. Miller wrote:
> Note that Andrew Morton found the problem on one of his older
> x86 EGCS's about the same time I found it on sparc64.

egcs gets so many long long things wrong on x86 that its only valid use
IMHO for 2.5 is as a syntax checker. Is it really worth an ugly hack for
a compiler one major developer has a personal affliction for and a port
that has a tiny user base and now has a working compiler.

Maybe if we put less gunk in the kernel they'd fix gcc more often 8)


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
@ 2002-09-09 12:17 Matthew Wilcox
  2002-09-09 23:24 ` Rusty Russell
  0 siblings, 1 reply; 32+ messages in thread
From: Matthew Wilcox @ 2002-09-09 12:17 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

Rusty wrote:
> Yeah, but you can still leave a spinlock uninitialized, and it'll
> work.

If your architecture has load-and-zero as its only atomic primitive,
leaving spinlocks uninitialised will _not_ work ;-)

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09  6:13                   ` David S. Miller
@ 2002-09-09  8:17                     ` Rusty Russell
  2002-09-09  8:15                       ` David S. Miller
  0 siblings, 1 reply; 32+ messages in thread
From: Rusty Russell @ 2002-09-09  8:17 UTC (permalink / raw)
  To: David S. Miller; +Cc: pavel, torvalds, linux-kernel, akpm

In message <20020908.231304.30400540.davem@redhat.com> you write:
>    From: Rusty Russell <rusty@rustcorp.com.au>
>    Date: Mon, 09 Sep 2002 13:45:02 +1000
> 
>    	/* FIXME: Initializer required so gcc 2.96 doesn't put in BSS */
>    	DEFINE_PER_CPU(int, xxx) = 0;
>    
>    everywhere, which can be deleted later
> 
> Why everywhere?  If you do it in the macro, then when you want
> to delete the initializer remove the macro arg.  Then you cover
> both in-kernel and cases in external sources because the build
> will break for them so they'll know to fixup their macro invocation.

So, you break everyone's compile later *and* you have to figure out
which initializers were required, and which ones were bogus.
*Planning* to break an interface is just stupid.

> See spinlock_t's declaration for older GCC versions, that is how we
> traditionally deal with compiler bugs like this, explicitly so that it
> is impossible to "miss" something and get it wrong.

Yeah, but you can still leave a spinlock uninitialized, and it'll
work.

I'm not making an interface harder to use because of one of 17
architectures refuses to fix a bug in their toolchain.  Just not
happening, sorry.

I want *you* to feel the pain, not spread it around by leaving turds
throughout the code long after the bug is forgotten:

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/Makefile working-2.5.33-cset-1.621-catch-percpu/Makefile
--- working-2.5.33-cset-1.621/Makefile	2002-09-09 13:31:44.000000000 +1000
+++ working-2.5.33-cset-1.621-catch-percpu/Makefile	2002-09-09 18:06:51.000000000 +1000
@@ -282,6 +282,8 @@ cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LD
 		-o vmlinux
 
 #	set -e makes the rule exit immediately on error
+#	Final awk script makes sure per-cpu vars are in per-cpu section, as
+#	old gcc (eg egcs 2.92.11) ignores section attribute if uninitialized.
 
 define rule_link_vmlinux
 	set -e
@@ -292,6 +294,7 @@ define rule_link_vmlinux
 	$(call cmd,link_vmlinux)
 	echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd
 	$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
+	awk '/ __per_cpu_start$/ { IN_PER_CPU=1 } / __per_cpu_end$/ { IN_PER_CPU=0 } /__per_cpu$/ { if (!IN_PER_CPU) { print $3 " not in per-cpu section" > "/dev/stderr"; FOUND=1; } } END { exit FOUND; }' < System.map
 endef
 
 vmlinux: $(vmlinux-objs) FORCE

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09  8:06       ` Rusty Russell
@ 2002-09-09  8:16         ` David S. Miller
  0 siblings, 0 replies; 32+ messages in thread
From: David S. Miller @ 2002-09-09  8:16 UTC (permalink / raw)
  To: rusty; +Cc: hpa, linux-kernel

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Mon, 9 Sep 2002 18:06:19 +1000

   On 3 Sep 2002 21:52:45 -0700
   "H. Peter Anvin" <hpa@zytor.com> wrote:
   
   > gcc puts all uninitialized variables in .bss, and it apparently can't
   > be overridden.  This seems to be a side effect of the way gcc handles
   > common variables.
   
   Err... no, as I said, it doesn't happen with 2.95.4 or 3.0.4.
   
But note that older GCCs do have the problem and it isn't platform
specific at all.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09  8:17                     ` Rusty Russell
@ 2002-09-09  8:15                       ` David S. Miller
  2002-09-09 20:58                         ` Alan Cox
  2002-09-10  9:41                         ` Rusty Russell
  0 siblings, 2 replies; 32+ messages in thread
From: David S. Miller @ 2002-09-09  8:15 UTC (permalink / raw)
  To: rusty; +Cc: pavel, torvalds, linux-kernel, akpm

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Mon, 09 Sep 2002 18:17:22 +1000

   In message <20020908.231304.30400540.davem@redhat.com> you write:
   I'm not making an interface harder to use because of one of 17
   architectures refuses to fix a bug in their toolchain.

It's not a sparc64 specific problem, as has been noted.
We are extended the life of an older toolchain on more than
one platform.
   
Note that Andrew Morton found the problem on one of his older
x86 EGCS's about the same time I found it on sparc64.

   I want *you* to feel the pain, not spread it around by leaving turds
   throughout the code long after the bug is forgotten:
   
Aha, but it is you putting the turd comments all over.  I'm
suggesting to put the turd in one place, the header file.

And how difficult is it to discern which initializers were
needed?  Hmmm let me see, if it was all zero --> removing it
is harmless.

Wow, that was hard. :-)

Both of us are advocating adding shit to the tree, the only argument
is which stinks less from a maintainence perspective.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  4:52     ` H. Peter Anvin
@ 2002-09-09  8:06       ` Rusty Russell
  2002-09-09  8:16         ` David S. Miller
  0 siblings, 1 reply; 32+ messages in thread
From: Rusty Russell @ 2002-09-09  8:06 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: linux-kernel

On 3 Sep 2002 21:52:45 -0700
"H. Peter Anvin" <hpa@zytor.com> wrote:

> Followup to:  <20020904042036.816A62C1B6@lists.samba.org>
> By author:    Rusty Russell <rusty@rustcorp.com.au>
> In newsgroup: linux.dev.kernel
> >
> > In message <20020903.195455.117344683.davem@redhat.com> you write:
> > >    From: Rusty Russell <rusty@rustcorp.com.au>
> > >    Date: Wed, 04 Sep 2002 12:35:41 +1000
> > > 
> > >    This might explain the wierd per-cpu problem reports from Andrew and
> > >    Dave, and also that nagging feeling that I'm an idiot...
> > > 
> > > Verifying...  no without the explicit initializers the per-cpu stuff
> > > still ends up in the BSS with egcs-2.9X, even with your fix applied.
> > 
> > OK.  I really hate working around wierd toolchain bugs (I use 2.95.4
> > here and it's fine), and adding an initializer to the macro is ugly.
> 
> gcc puts all uninitialized variables in .bss, and it apparently can't
> be overridden.  This seems to be a side effect of the way gcc handles
> common variables.

Err... no, as I said, it doesn't happen with 2.95.4 or 3.0.4.

Rusty.
-- 
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-09  3:45                 ` Rusty Russell
@ 2002-09-09  6:13                   ` David S. Miller
  2002-09-09  8:17                     ` Rusty Russell
  0 siblings, 1 reply; 32+ messages in thread
From: David S. Miller @ 2002-09-09  6:13 UTC (permalink / raw)
  To: rusty; +Cc: pavel, torvalds, linux-kernel, akpm

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Mon, 09 Sep 2002 13:45:02 +1000

   	/* FIXME: Initializer required so gcc 2.96 doesn't put in BSS */
   	DEFINE_PER_CPU(int, xxx) = 0;
   
   everywhere, which can be deleted later

Why everywhere?  If you do it in the macro, then when you want
to delete the initializer remove the macro arg.  Then you cover
both in-kernel and cases in external sources because the build
will break for them so they'll know to fixup their macro invocation.

I hate when things change silently, and if you don't put it in
the macro, someone will get it wrong and we'll find out only
when someone with an older compiler uses that feature on an SMP
machine.

Read as: This is bad programming practice Rusty, regardless of
         your personal views about this particular GCC bug or
	 what you think is a legitimate initializer.

See spinlock_t's declaration for older GCC versions, that is how we
traditionally deal with compiler bugs like this, explicitly so that it
is impossible to "miss" something and get it wrong.

Everytime I asked Linus to rearrange some piece of code that used
spinlock_t initializers to workaround the "empty initializer at
end of struct" GCC bug he always told me "someone will get it
wrong if we do it that way"  And I think he's right.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-06  9:57               ` Pavel Machek
@ 2002-09-09  3:45                 ` Rusty Russell
  2002-09-09  6:13                   ` David S. Miller
  0 siblings, 1 reply; 32+ messages in thread
From: Rusty Russell @ 2002-09-09  3:45 UTC (permalink / raw)
  To: Pavel Machek; +Cc: David S. Miller, torvalds, linux-kernel, akpm

In message <20020906095743.A35@toy.ucw.cz> you write:
> Hi!
> 
> > > Actually Rusty what's the big deal, add an "initializer"
> > > arg to the macro.  It doesn't hurt anyone, it doesn't lose
> > > any space in the kernel image, and the macro arg reminds
> > > people to do it.
> > > 
> > > I think it's a small price to pay to keep a longer range
> > > of compilers supported :-)
> > 
> > I disagree.  They might not have a convenient (static) initializer, in
> > which case it's simply cruel and unusual, to work around an obscure
> > compiler bug.
> 
> Ugh? of course it will always have convient initializer, namely zero.

What if you really need to initialize them at runtime?  You're putting
a static initializer there simply to mask an obscure toolchain bug.
I'd really prefer dotting:

	/* FIXME: Initializer required so gcc 2.96 doesn't put in BSS */
	DEFINE_PER_CPU(int, xxx) = 0;

everywhere, which can be deleted later, to enforcing it for everyone
in the infrastructure when it doesn't always make sense.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  7:38             ` Rusty Russell
@ 2002-09-06  9:57               ` Pavel Machek
  2002-09-09  3:45                 ` Rusty Russell
  0 siblings, 1 reply; 32+ messages in thread
From: Pavel Machek @ 2002-09-06  9:57 UTC (permalink / raw)
  To: Rusty Russell; +Cc: David S. Miller, torvalds, linux-kernel, akpm

Hi!

> > Actually Rusty what's the big deal, add an "initializer"
> > arg to the macro.  It doesn't hurt anyone, it doesn't lose
> > any space in the kernel image, and the macro arg reminds
> > people to do it.
> > 
> > I think it's a small price to pay to keep a longer range
> > of compilers supported :-)
> 
> I disagree.  They might not have a convenient (static) initializer, in
> which case it's simply cruel and unusual, to work around an obscure
> compiler bug.

Ugh? of course it will always have convient initializer, namely zero.

								Pavel
-- 
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04 15:44       ` Thunder from the hill
@ 2002-09-04 23:18         ` David S. Miller
  0 siblings, 0 replies; 32+ messages in thread
From: David S. Miller @ 2002-09-04 23:18 UTC (permalink / raw)
  To: thunder; +Cc: rusty, torvalds, linux-kernel, akpm

   From: Thunder from the hill <thunder@lightweight.ods.org>
   Date: Wed, 4 Sep 2002 09:44:51 -0600 (MDT)
   
   I couldn't use gcc 3.* on sparc64 for some weird reason

3.0 should be broken yes, but 3.1 definitely works as I use
it here for occaisionaly test builds all the time.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  5:05     ` David S. Miller
  2002-09-04  5:17       ` Linus Torvalds
  2002-09-04  6:00       ` Rusty Russell
@ 2002-09-04 15:44       ` Thunder from the hill
  2002-09-04 23:18         ` David S. Miller
  2 siblings, 1 reply; 32+ messages in thread
From: Thunder from the hill @ 2002-09-04 15:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: rusty, torvalds, linux-kernel, akpm

Hi,

On Tue, 3 Sep 2002, David S. Miller wrote:
> Oh, "I'm" willing to upgrade "my" compiler, it's my users that are the
> problem.  If you impose 3.1 or whatever, I get less people testing on
> sparc64 as a result.

Oh, well. I couldn't use gcc 3.* on sparc64 for some weird reason, gcc 
2.95* is unable to handle all that crap, and the egcs hackup can't handle 
the current kernel code. So what?

			Thunder
-- 
--./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .-
--/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..-
.- -/---/--/---/.-./.-./---/.--/.-.-.-
--./.-/-.../.-./.././.-../.-.-.-


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  6:19           ` David S. Miller
@ 2002-09-04  7:38             ` Rusty Russell
  2002-09-06  9:57               ` Pavel Machek
  0 siblings, 1 reply; 32+ messages in thread
From: Rusty Russell @ 2002-09-04  7:38 UTC (permalink / raw)
  To: David S. Miller; +Cc: torvalds, linux-kernel, akpm

In message <20020903.231907.21327801.davem@redhat.com> you write:
> 
> Actually Rusty what's the big deal, add an "initializer"
> arg to the macro.  It doesn't hurt anyone, it doesn't lose
> any space in the kernel image, and the macro arg reminds
> people to do it.
> 
> I think it's a small price to pay to keep a longer range
> of compilers supported :-)

I disagree.  They might not have a convenient (static) initializer, in
which case it's simply cruel and unusual, to work around an obscure
compiler bug.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  6:06         ` David S. Miller
@ 2002-09-04  6:19           ` David S. Miller
  2002-09-04  7:38             ` Rusty Russell
  0 siblings, 1 reply; 32+ messages in thread
From: David S. Miller @ 2002-09-04  6:19 UTC (permalink / raw)
  To: rusty; +Cc: torvalds, linux-kernel, akpm


Actually Rusty what's the big deal, add an "initializer"
arg to the macro.  It doesn't hurt anyone, it doesn't lose
any space in the kernel image, and the macro arg reminds
people to do it.

I think it's a small price to pay to keep a longer range
of compilers supported :-)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  6:00       ` Rusty Russell
@ 2002-09-04  6:06         ` David S. Miller
  2002-09-04  6:19           ` David S. Miller
  0 siblings, 1 reply; 32+ messages in thread
From: David S. Miller @ 2002-09-04  6:06 UTC (permalink / raw)
  To: rusty; +Cc: torvalds, linux-kernel, akpm

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Wed, 04 Sep 2002 16:00:35 +1000
   
   I was actually proposing to provide a patch to an egcs version of your
   choice which you could provide as kgcc to your users.  But RH seem to
   have taken down the SRPM for 2.92.11 (egcs64-19980921-4.src.rpm).

The last sparc64 Red Hat distribution was 6.2  And it still works
unchanged with current kernels. :-)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  5:05     ` David S. Miller
  2002-09-04  5:17       ` Linus Torvalds
@ 2002-09-04  6:00       ` Rusty Russell
  2002-09-04  6:06         ` David S. Miller
  2002-09-04 15:44       ` Thunder from the hill
  2 siblings, 1 reply; 32+ messages in thread
From: Rusty Russell @ 2002-09-04  6:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: torvalds, linux-kernel, akpm

In message <20020903.220514.21399526.davem@redhat.com> you write:
>    If you're not going to upgrade your compiler, will you accept a gcc
>    patch to fix this?  If so, where can I get the source to your exact
>    version?
>    
> Oh, "I'm" willing to upgrade "my" compiler, it's my users
> that are the problem.  If you impose 3.1 or whatever, I get less
> people testing on sparc64 as a result.

I understand.  It's OK to piss off one Sparc64 Linux user, but if you
piss off both of them, you're in trouble 8)

I was actually proposing to provide a patch to an egcs version of your
choice which you could provide as kgcc to your users.  But RH seem to
have taken down the SRPM for 2.92.11 (egcs64-19980921-4.src.rpm).

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  5:05     ` David S. Miller
@ 2002-09-04  5:17       ` Linus Torvalds
  2002-09-04  5:12         ` David S. Miller
  2002-09-04  6:00       ` Rusty Russell
  2002-09-04 15:44       ` Thunder from the hill
  2 siblings, 1 reply; 32+ messages in thread
From: Linus Torvalds @ 2002-09-04  5:17 UTC (permalink / raw)
  To: David S. Miller; +Cc: rusty, linux-kernel, akpm


On Tue, 3 Sep 2002, David S. Miller wrote:
> Oh, "I'm" willing to upgrade "my" compiler, it's my users
> that are the problem.  If you impose 3.1 or whatever, I get less
> people testing on sparc64 as a result.

Well, I don't think you have to go to 3.1.x.

gcc-2.96 at least seems to do all right. Apparently 2.95 does too. It's 
only the truly ancient compilers that don't work.

		Linus


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  5:17       ` Linus Torvalds
@ 2002-09-04  5:12         ` David S. Miller
  0 siblings, 0 replies; 32+ messages in thread
From: David S. Miller @ 2002-09-04  5:12 UTC (permalink / raw)
  To: torvalds; +Cc: rusty, linux-kernel, akpm

   From: Linus Torvalds <torvalds@transmeta.com>
   Date: Tue, 3 Sep 2002 22:17:39 -0700 (PDT)
   
   Well, I don't think you have to go to 3.1.x.
   
Yes I do, anything after our standard sparc64 (ie. egcs-2.92.11)
compiler up until 3.1.x is seriously unusable for kernel builds.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  4:04   ` Rusty Russell
  2002-09-04  4:52     ` H. Peter Anvin
@ 2002-09-04  5:05     ` David S. Miller
  2002-09-04  5:17       ` Linus Torvalds
                         ` (2 more replies)
  1 sibling, 3 replies; 32+ messages in thread
From: David S. Miller @ 2002-09-04  5:05 UTC (permalink / raw)
  To: rusty; +Cc: torvalds, linux-kernel, akpm

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Wed, 04 Sep 2002 14:04:22 +1000

   OK.  I really hate working around wierd toolchain bugs (I use 2.95.4
   here and it's fine), and adding an initializer to the macro is ugly.
   
Mine is 2.92.11

   If you're not going to upgrade your compiler, will you accept a gcc
   patch to fix this?  If so, where can I get the source to your exact
   version?
   
Oh, "I'm" willing to upgrade "my" compiler, it's my users
that are the problem.  If you impose 3.1 or whatever, I get less
people testing on sparc64 as a result.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  4:04   ` Rusty Russell
@ 2002-09-04  4:52     ` H. Peter Anvin
  2002-09-09  8:06       ` Rusty Russell
  2002-09-04  5:05     ` David S. Miller
  1 sibling, 1 reply; 32+ messages in thread
From: H. Peter Anvin @ 2002-09-04  4:52 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20020904042036.816A62C1B6@lists.samba.org>
By author:    Rusty Russell <rusty@rustcorp.com.au>
In newsgroup: linux.dev.kernel
>
> In message <20020903.195455.117344683.davem@redhat.com> you write:
> >    From: Rusty Russell <rusty@rustcorp.com.au>
> >    Date: Wed, 04 Sep 2002 12:35:41 +1000
> > 
> >    This might explain the wierd per-cpu problem reports from Andrew and
> >    Dave, and also that nagging feeling that I'm an idiot...
> > 
> > Verifying...  no without the explicit initializers the per-cpu stuff
> > still ends up in the BSS with egcs-2.9X, even with your fix applied.
> 
> OK.  I really hate working around wierd toolchain bugs (I use 2.95.4
> here and it's fine), and adding an initializer to the macro is ugly.
> 
> If you're not going to upgrade your compiler, will you accept a gcc
> patch to fix this?  If so, where can I get the source to your exact
> version?
> 

gcc puts all uninitialized variables in .bss, and it apparently can't
be overridden.  This seems to be a side effect of the way gcc handles
common variables.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  2:54 ` David S. Miller
@ 2002-09-04  4:04   ` Rusty Russell
  2002-09-04  4:52     ` H. Peter Anvin
  2002-09-04  5:05     ` David S. Miller
  0 siblings, 2 replies; 32+ messages in thread
From: Rusty Russell @ 2002-09-04  4:04 UTC (permalink / raw)
  To: David S. Miller; +Cc: torvalds, linux-kernel, akpm

In message <20020903.195455.117344683.davem@redhat.com> you write:
>    From: Rusty Russell <rusty@rustcorp.com.au>
>    Date: Wed, 04 Sep 2002 12:35:41 +1000
> 
>    This might explain the wierd per-cpu problem reports from Andrew and
>    Dave, and also that nagging feeling that I'm an idiot...
> 
> Verifying...  no without the explicit initializers the per-cpu stuff
> still ends up in the BSS with egcs-2.9X, even with your fix applied.

OK.  I really hate working around wierd toolchain bugs (I use 2.95.4
here and it's fine), and adding an initializer to the macro is ugly.

If you're not going to upgrade your compiler, will you accept a gcc
patch to fix this?  If so, where can I get the source to your exact
version?

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  2:35 Rusty Russell
  2002-09-04  2:54 ` David S. Miller
  2002-09-04  2:56 ` Andrew Morton
@ 2002-09-04  3:42 ` William Lee Irwin III
  2 siblings, 0 replies; 32+ messages in thread
From: William Lee Irwin III @ 2002-09-04  3:42 UTC (permalink / raw)
  To: Rusty Russell; +Cc: torvalds, linux-kernel, davem, akpm

On Wed, Sep 04, 2002 at 12:35:41PM +1000, Rusty Russell wrote:
> Frankly, I'm amazed the kernel worked for long without this.
> Every linker script thinks the section is called .data.percpu.
> Without this patch, every CPU ends up sharing the same "per-cpu"
> variable.
> This might explain the wierd per-cpu problem reports from Andrew and
> Dave, and also that nagging feeling that I'm an idiot...

Hmm, 2.5.33 is doing some *really* weird crap. OTOH it doesn't appear
to be tripping the BUG() in softirq.c, and disks seem to be doing okay.
It survived 4 parallel mkfs's. I'll follow up with some kind of
bugreport on the PCI and/or starfire.c front in a separate post.


Cheers,
Bill

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  2:35 Rusty Russell
  2002-09-04  2:54 ` David S. Miller
@ 2002-09-04  2:56 ` Andrew Morton
  2002-09-04  2:46   ` William Lee Irwin III
  2002-09-04  3:42 ` William Lee Irwin III
  2 siblings, 1 reply; 32+ messages in thread
From: Andrew Morton @ 2002-09-04  2:56 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

Rusty Russell wrote:
> 
> Frankly, I'm amazed the kernel worked for long without this.
> 
> Every linker script thinks the section is called .data.percpu.
> Without this patch, every CPU ends up sharing the same "per-cpu"
> variable.
> 

wow.  Either this was working by fluke, or Bill's softirq problem
just got solved.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  2:35 Rusty Russell
@ 2002-09-04  2:54 ` David S. Miller
  2002-09-04  4:04   ` Rusty Russell
  2002-09-04  2:56 ` Andrew Morton
  2002-09-04  3:42 ` William Lee Irwin III
  2 siblings, 1 reply; 32+ messages in thread
From: David S. Miller @ 2002-09-04  2:54 UTC (permalink / raw)
  To: rusty; +Cc: torvalds, linux-kernel, davem, akpm

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Wed, 04 Sep 2002 12:35:41 +1000

   This might explain the wierd per-cpu problem reports from Andrew and
   Dave, and also that nagging feeling that I'm an idiot...

Verifying...  no without the explicit initializers the per-cpu stuff
still ends up in the BSS with egcs-2.9X, even with your fix applied.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] Important per-cpu fix.
  2002-09-04  2:56 ` Andrew Morton
@ 2002-09-04  2:46   ` William Lee Irwin III
  0 siblings, 0 replies; 32+ messages in thread
From: William Lee Irwin III @ 2002-09-04  2:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Rusty Russell, linux-kernel

Rusty Russell wrote:
>> Frankly, I'm amazed the kernel worked for long without this.
>> Every linker script thinks the section is called .data.percpu.
>> Without this patch, every CPU ends up sharing the same "per-cpu"
>> variable.

On Tue, Sep 03, 2002 at 07:56:47PM -0700, Andrew Morton wrote:
> wow.  Either this was working by fluke, or Bill's softirq problem
> just got solved.

It's pretty easy to find out, my machines don't get past
execve("/sbin/init", argv_init, envp_init); without some kind of softirq
fix. The boot cycle is not swift though... in progress.


Cheers,
Bill

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] Important per-cpu fix.
@ 2002-09-04  2:35 Rusty Russell
  2002-09-04  2:54 ` David S. Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: Rusty Russell @ 2002-09-04  2:35 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, davem, akpm

Frankly, I'm amazed the kernel worked for long without this.

Every linker script thinks the section is called .data.percpu.
Without this patch, every CPU ends up sharing the same "per-cpu"
variable.

This might explain the wierd per-cpu problem reports from Andrew and
Dave, and also that nagging feeling that I'm an idiot...

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

--- working-2.5.33-hotcpu-cpudown-i386/include/asm-generic/percpu.h.~1~	Wed Aug 28 09:29:50 2002
+++ working-2.5.33-hotcpu-cpudown-i386/include/asm-generic/percpu.h	Wed Sep  4 12:32:34 2002
@@ -10,7 +10,7 @@
 /* Separate out the type, so (int[3], foo) works. */
 #ifndef MODULE
 #define DEFINE_PER_CPU(type, name) \
-    __attribute__((__section__(".percpu"))) __typeof__(type) name##__per_cpu
+    __attribute__((__section__(".data.percpu"))) __typeof__(type) name##__per_cpu
 #endif
 
 /* var is in discarded region: offset to particular copy we want */

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2002-09-10  9:35 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-05  9:10 [PATCH] Important per-cpu fix Dipankar Sarma
2002-09-05  9:09 ` William Lee Irwin III
2002-09-05 19:08   ` Dipankar Sarma
2002-09-05 19:11     ` William Lee Irwin III
  -- strict thread matches above, loose matches on Subject: below --
2002-09-09 12:17 Matthew Wilcox
2002-09-09 23:24 ` Rusty Russell
2002-09-04  2:35 Rusty Russell
2002-09-04  2:54 ` David S. Miller
2002-09-04  4:04   ` Rusty Russell
2002-09-04  4:52     ` H. Peter Anvin
2002-09-09  8:06       ` Rusty Russell
2002-09-09  8:16         ` David S. Miller
2002-09-04  5:05     ` David S. Miller
2002-09-04  5:17       ` Linus Torvalds
2002-09-04  5:12         ` David S. Miller
2002-09-04  6:00       ` Rusty Russell
2002-09-04  6:06         ` David S. Miller
2002-09-04  6:19           ` David S. Miller
2002-09-04  7:38             ` Rusty Russell
2002-09-06  9:57               ` Pavel Machek
2002-09-09  3:45                 ` Rusty Russell
2002-09-09  6:13                   ` David S. Miller
2002-09-09  8:17                     ` Rusty Russell
2002-09-09  8:15                       ` David S. Miller
2002-09-09 20:58                         ` Alan Cox
2002-09-09 21:06                           ` Andrew Morton
2002-09-10  9:41                         ` Rusty Russell
2002-09-04 15:44       ` Thunder from the hill
2002-09-04 23:18         ` David S. Miller
2002-09-04  2:56 ` Andrew Morton
2002-09-04  2:46   ` William Lee Irwin III
2002-09-04  3:42 ` William Lee Irwin III

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).