mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Namhyung Kim <namhyung@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: remove __phys_reloc_hide
Date: Tue, 10 Aug 2010 09:05:55 +0200	[thread overview]
Message-ID: <20100810070555.GA16638@elte.hu> (raw)
In-Reply-To: <4C604F54.2080506@zytor.com>


* H. Peter Anvin <hpa@zytor.com> wrote:

> On 08/09/2010 12:22 AM, Andi Kleen wrote:
> > On Mon, Aug 09, 2010 at 04:04:45PM +0900, Namhyung Kim wrote:
> >>> It hides the value conversion from the compiler through asm()
> >>>
> >>> -Andi
> >>>
> >>
> >> Yes, indeed. But for what? __pa_symbol() is just used to get the address
> >> of some linker symbols in forms of unsigned long which has same bit
> >> representation as pointer in x86 (and all supported archs). So do we
> >> still need it or am I missing something?
> > 
> > The original reason was that the C standard allows the compiler
> > to make some assumptions on the pointer arithmetic that is done 
> > on symbol addresses (e.g. no wrapping). This is exploited
> > by the optimizer in the compiler to generate better code.
> > 
> > This lead to a miscompilation on PowerPC a couple of years back at 
> > least with the va->pa conversion.
> > 
> > After that RELOC_HIDE was introduced after funelling the
> > symbol address through an empty asm statement was recommended 
> > as the official way to do this by the gcc developers.
> > 
> > I think x86-64 does not normally wrap here, but it's 
> > still safer to do it this way.
> > 
> 
> We pass -fno-strict-overflow to the kernel now, which takes care of the
> underlying problem, at least for current versions of gcc.  Unfortunately
> we still have people who want to use very old gcc versions to compile
> the kernel, so it's probably better to leave it in at least until we
> formally kill off support for gcc 3.

Namhyung, mind sending a patch that adds a comment to __pa_symbol() to point 
out the connection to -fno-strict-overflow and that it can be removed once all 
supported versions of GCC understand -fno-strict-overflow?

That would make for one less piece of legacy voodoo code in the kernel ;-)

Thanks,

	Ingo

  reply	other threads:[~2010-08-10  7:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-08 21:38 Namhyung Kim
2010-08-09  6:22 ` Andi Kleen
2010-08-09  6:40   ` Namhyung Kim
2010-08-09  6:44     ` Andi Kleen
2010-08-09  7:04       ` Namhyung Kim
2010-08-09  7:22         ` Andi Kleen
2010-08-09  7:47           ` Namhyung Kim
2010-08-09 18:56           ` H. Peter Anvin
2010-08-10  7:05             ` Ingo Molnar [this message]
2010-08-10 10:46               ` Namhyung Kim
2010-08-11  5:44                 ` Namhyung Kim
2010-08-11 19:09                   ` H. Peter Anvin
2010-08-11  6:37               ` [PATCH] x86: add a comment to __pa_symbol Namhyung Kim
2010-08-11  7:44                 ` [tip:x86/urgent] x86: Document __phys_reloc_hide() usage in __pa_symbol() tip-bot for Namhyung Kim
2018-06-19 23:00   ` [PATCH] x86: remove __phys_reloc_hide Thomas Gleixner
2010-08-09  8:07 ` Ingo Molnar
2010-08-09 18:56   ` H. Peter Anvin

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=20100810070555.GA16638@elte.hu \
    --to=mingo@elte.hu \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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

Powered by JetHome