From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Adrian Bunk" <bunk@kernel.org>
Cc: "Rusty Russell" <rusty@rustcorp.com.au>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"David Miller" <davem@davemloft.net>
Subject: Re: initialization of static per-cpu variables
Date: Fri, 23 May 2008 16:43:23 +0200 [thread overview]
Message-ID: <19f34abd0805230743m36c400afy7f4e3e05252383c3@mail.gmail.com> (raw)
In-Reply-To: <20080523142904.GB28257@cs181133002.pp.htv.fi>
On Fri, May 23, 2008 at 4:29 PM, Adrian Bunk <bunk@kernel.org> wrote:
> On Thu, May 22, 2008 at 06:20:06PM +1000, Rusty Russell wrote:
>> On Thursday 22 May 2008 04:28:02 Vegard Nossum wrote:
>> > Hi,
>> >
>> > I encountered this comment in kernel/softirq.c:
>> >
>> > /* Some compilers disobey section attribute on statics when not
>> > initialized -- RR */
>> > static DEFINE_PER_CPU(struct tasklet_head, tasklet_vec) = { NULL };
>> > static DEFINE_PER_CPU(struct tasklet_head, tasklet_hi_vec) = { NULL };
>> >
>> > So I assume it's the combination of static and whatever section
>> > DFINE_PER_CPU puts the variable in which is the problem.
>> >
>> > However, there's a LOT of these "static DEFINE_PER_CPU" without any
>> > initializer in the rest of the code, e.g.:
>>
>> Yep, it was an old toolchain used by Sparc: DaveM found this one. As you say,
>> it's ancient: I'm happy to queue a cleanup patch now everyone is on a modern
>> compiler.
>
> The commit says:
>
> [PATCH] softirq.c per_cpu fix
>
> GCC3.1 apparently gets confused about uninitialized sections
>
>
> We do still support gcc 3.2 (which is the same as 3.1 except for a C++
> ABI change) as a compiler for the kernel.
Ah, thanks for looking that up!
The question is then whether 3.1/3.2 will _ever_ do the right thing,
when you consider the number of places in the kernel that *don't*
initialize static per-cpu variables. (Or maybe: What makes this
variable so special that it breaks the kernel?)
Maybe it was fixed by accident in the kernel at some point later (e.g.
by change of the linker script) or maybe the commit message/original
reason was wrong and it was really something else?
Or maybe it is time to deprecate gcc 3.1/3.2 support?
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
next prev parent reply other threads:[~2008-05-23 14:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-21 18:28 Vegard Nossum
2008-05-22 8:20 ` Rusty Russell
2008-05-22 16:12 ` David Miller
2008-05-23 14:29 ` Adrian Bunk
2008-05-23 14:43 ` Vegard Nossum [this message]
2008-05-25 10:35 ` Rusty Russell
2008-06-02 7:59 ` Adrian Bunk
2008-06-02 23:11 ` Rusty Russell
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=19f34abd0805230743m36c400afy7f4e3e05252383c3@mail.gmail.com \
--to=vegard.nossum@gmail.com \
--cc=bunk@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®