* x86-64: __pa_symbol() vs. __pa()
@ 2008-12-09 10:05 Jan Beulich
2008-12-09 11:15 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2008-12-09 10:05 UTC (permalink / raw)
To: mingo, Andi Kleen, tglx, hpa; +Cc: linux-kernel
Can any of you recall the reason for the comment accompanying the
__pa_symbol() definition:
/* __pa_symbol should be used for C visible symbols.
This seems to be the official gcc blessed way to do such arithmetic. */
To me this rather sounds like a compiler problem, and if it indeed
exists then at least a few incorrect use have slipped in recently:
- arch/x86/mm/ioremap.c passes bm_pte to __pa()
- arch/x86/mm/pageattr.c passes _text and __{start,end}_rodata
to __pa()
- arch/x86/mm/pgtable.c and arch/x86/xen/smp.c pass
swapper_pg_dir to __pa()
- arch/x86/xen/enlighten passes level3_user_vsyscall to __pa()
This is only the set where x86-64 (which prior to the merge had
above comment already) is affected, i386 would have a few more.
What would be particularly problematic is the potential indirect use
of __pa(), e.g. through Xen's virt_to_{machine,bus}() as well as
the use in common code (e.g. kernel/kexec.c).
Thanks, Jan
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: x86-64: __pa_symbol() vs. __pa()
2008-12-09 10:05 x86-64: __pa_symbol() vs. __pa() Jan Beulich
@ 2008-12-09 11:15 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2008-12-09 11:15 UTC (permalink / raw)
To: Jan Beulich; +Cc: mingo, Andi Kleen, tglx, hpa, linux-kernel
On Tue, Dec 09, 2008 at 10:05:02AM +0000, Jan Beulich wrote:
> Can any of you recall the reason for the comment accompanying the
> __pa_symbol() definition:
>
> /* __pa_symbol should be used for C visible symbols.
> This seems to be the official gcc blessed way to do such arithmetic. */
gcc assumes that such symbol arithmetic doesn't wrap. iirc there was a
miscompilation on PPC64 because of that and then it was fixed
everywhere. On x86-64 there are normally no wraps, but there might
be in some cases.
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-09 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-09 10:05 x86-64: __pa_symbol() vs. __pa() Jan Beulich
2008-12-09 11:15 ` Andi Kleen
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®