lkml.org 
[lkml]   [2002]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] Important per-cpu fix.
Date
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.076 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site