linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Torsten Duwe <duwe@lst.de>
Cc: linuxppc-dev@lists.ozlabs.org, live-patching@vger.kernel.org
Subject: Re: -mprofile-kernel vs. notrace in ppc64(le) Linux kernels
Date: Sat, 26 Sep 2015 09:52:43 -0500	[thread overview]
Message-ID: <20150926145243.GA14958@gate.crashing.org> (raw)
In-Reply-To: <20150926143008.GA14606@lst.de>

On Sat, Sep 26, 2015 at 04:30:08PM +0200, Torsten Duwe wrote:
> As I mentioned earlier this year, it's a bad idea to call _mcount from
> MMU helper functions (e.g. hash_page...), when the profiling/tracing/
> live-patching/whatever framewok might in turn cause another such fault.
> Jikos suggested to use fine-grained control of these functions with the
> "notrace" keyword in the Linux kernel. It is mapped to GCC's (4.8, FWIW)
> __attribute__((no_instrument_function)), which, to my surprise, works
> for -p and -pg nicely, but does not affect -mprofile-kernel at all!

That is surprising; please file a GCC bug.

> Should we consider this a bug? IMHO it is. I can see in the GCC sources
> that -mprofile-kernel is more like a low-level hack in rs6000.c,
> quite far below the RTL code generator, so the no_instrument_function
> attribute is probably hard to check for.
> 
> What is -mprofile-kernel good for, if it bears such a risk of crashing
> the kernel?

It didn't work when combined with other fringe functionality.  It happens.

> Is it the right hook for ppc64 live patching? How to protect
> those critical functions? Filter -mprofile-kernel for those object files?

That might work.

> Ask the GCC experts to fix this?

Yes please.  You probably need a workaround for released compilers though.


Segher

  reply	other threads:[~2015-09-26 14:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-26 14:30 -mprofile-kernel vs. notrace in ppc64(le) Linux kernels Torsten Duwe
2015-09-26 14:52 ` Segher Boessenkool [this message]
2015-09-26 23:03   ` Anton Blanchard
2015-09-27 11:06     ` Torsten Duwe
2015-09-28  0:08 ` Stewart Smith

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=20150926145243.GA14958@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=duwe@lst.de \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=live-patching@vger.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).