From: Ingo Molnar <mingo@elte.hu>
To: Tejun Heo <tj@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Fr??d??ric Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Rusty Russell <rusty@rustcorp.com.au>,
Christoph Lameter <cl@linux-foundation.org>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: linux-next: percpu tree build warning
Date: Wed, 25 Nov 2009 14:40:58 +0100 [thread overview]
Message-ID: <20091125134058.GA9097@elte.hu> (raw)
In-Reply-To: <4B0D23A6.8040902@kernel.org>
* Tejun Heo <tj@kernel.org> wrote:
> > If yes then that needs to be fixed in the percpu tree. per-cpu
> > variables used to have a __per_cpu prefix and that should be
> > maintained - the two namespaces are obviously separate on the
> > logical space, so they should never overlap in the implementational
> > space either.
>
> If all we ever have are static variables, the prefix may be fine but
> with dynamic percpu variables now basically being the same first class
> citizen but prefix just doesn't cut it. It just ends up adding more
> confusion. The transition will be a bit painful (but not too much,
> how many of these reports have we had? Only several) but after that
> it's just plain local/global symbol collision the compiler would have
> no problem warning about. It behaves exactly like other global
> symbols.
>
> Percpu symbols and variables belong to a different address space than
> normal symbols. Unfortunately, C doesn't have support for such thing.
That argument does not parse for me. Obviously no sane programming
language should allow shadowed variables which are used in the same way
- it's way too easy to use the wrong one.
But we have _no_ real shadowing here - it's a pure artifact of how the
percpu symbol space is mapped back into C - and the collision (which
does not exist in the program space) is created where none existed
before.
In other words: you are solving a problem that does not exist - you
cannot mix up a local C variable and a percpu variable. The two spaces
are clearly separated via definition and APIs. A C variable is defined
via:
unsigned long *dr7;
and is used via:
dr7
While a percpu variable is defined and used in completely different
ways:
DEFINE_PER_CPU(unsigned long, dr7);
and is used via:
__get_cpu_var(cpu_dr7);
It's analogous as if we had a 'struct percpu' C structure, and
dereferenced it via:
cpu->dr7.
Note that we dont require it to be renamed to cpu->cpu_dr7.
And look at your own 'cleanup' patch - it changes the percpu name to
'cpu_dr7'. That results in nonsensical repetition:
dr7 = &__get_cpu_var(cpu_dr7);
I already said it's a percpu variable, via the __get_cpu_var()
primitive. Why do i have to type cpu_ again to express this, hm?
These kinds of messy interactions between clearly disjunct name spaces
are bad IMO. And i dont see how dynamic percpu variables change this in
any way - none of the above is a dynamic percpu variable.
I've applied your patch to not hold things up in linux-next (shadowing
is dangerous) but i dont see how your arguments add up.
Ingo
next prev parent reply other threads:[~2009-11-25 13:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 10:42 linux-next: percpu tree build warning Stephen Rothwell
2009-11-25 10:50 ` Ingo Molnar
2009-11-25 11:14 ` Rusty Russell
2009-11-25 11:58 ` Ingo Molnar
2009-11-25 12:39 ` Tejun Heo
2009-11-25 12:31 ` Tejun Heo
2009-11-25 13:40 ` Ingo Molnar [this message]
2009-11-25 15:12 ` Tejun Heo
2009-11-26 22:16 ` Rusty Russell
2009-11-27 5:41 ` Ingo Molnar
2009-11-27 5:57 ` Tejun Heo
2009-11-27 6:20 ` Ingo Molnar
2009-11-27 6:31 ` Tejun Heo
2009-11-27 6:32 ` Tejun Heo
2009-11-28 9:51 ` Rusty Russell
2009-11-29 6:40 ` Ingo Molnar
2009-11-30 0:31 ` Rusty Russell
2009-11-25 13:24 ` [PATCH] x86: rename global percpu symbol dr7 to cpu_dr7 Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2009-11-12 6:45 linux-next: percpu tree build warning Stephen Rothwell
2009-11-12 15:16 ` Christoph Lameter
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=20091125134058.GA9097@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=cl@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=sfr@canb.auug.org.au \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).