linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: duwe@lst.de (Torsten Duwe)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] arm64: implement FTRACE_WITH_REGS
Date: Sat, 9 Jul 2016 11:06:32 +0200	[thread overview]
Message-ID: <20160709090632.GA2598@lst.de> (raw)
In-Reply-To: <20160708170808.1ab70ce3@gandalf.local.home>

On Fri, Jul 08, 2016 at 05:08:08PM -0400, Steven Rostedt wrote:
> On Fri, 8 Jul 2016 22:24:55 +0200
> Torsten Duwe <duwe@lst.de> wrote:
> 
> > On Fri, Jul 08, 2016 at 11:57:10AM -0400, Steven Rostedt wrote:
> > > On Fri, 8 Jul 2016 10:48:24 -0500
> > > Josh Poimboeuf <jpoimboe@redhat.com> wrote:  
> > > > 
> > > > Here, with -fprolog-pad, it's already a nop, so no change is needed.
> > > >   
> > 
> > Yes, exactly.
> > 
> > > That's what I was thinking. But as I stated in another email (probably
> > > in the air when you wrote this), the call to ftrace_modify_code() may be
> > > completely circumvented by ftrace_make_nop() if the addr is MCOUNT_ADDR.  
> > 
> > Only on the _first_ invocation. Later on, tracing can be switched on and off,
> > and then the instructions need to be changed just like with fentry (or
> > profile-kernel ;-)
> > 
> 
> Understood, but ftrace_modify_code() will only receive addr ==
> MCOUNT_ADDR on boot up or when a module is loaded. In both cases, with
> -fprolog-pad it will already be a nop, hence no need to call
> ftrace_modify_code(), in those cases.
> 
> In all other cases, addr will point to a ftrace trampoline.

Maybe the code in question can be replaced with the change below, now that
there is a preprocessor define in V2?
(untested)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 3f743b1..695a646 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2423,6 +2423,12 @@ ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)
 	if (unlikely(ftrace_disabled))
 		return 0;
 
+#ifdef CC_USING_PROLOG_PAD
+	/* If the compiler already generated NOPs instead of
+	 * calls to mcount, we're done here.
+	*/
+	return 1;
+#endif
 	ret = ftrace_make_nop(mod, rec, MCOUNT_ADDR);
 	if (ret) {
 		ftrace_bug(ret, rec);

  reply	other threads:[~2016-07-09  9:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 15:15 [PATCH v2 0/2] arm64 live patching Torsten Duwe
2016-06-27 15:17 ` [PATCH v2 1/2] arm64: implement FTRACE_WITH_REGS Torsten Duwe
2016-07-01 12:53   ` Josh Poimboeuf
2016-07-04  9:18     ` Torsten Duwe
2016-07-03  5:17   ` kbuild test robot
2016-07-08 14:58   ` Petr Mladek
2016-07-08 15:07     ` Torsten Duwe
2016-07-08 15:24       ` Petr Mladek
2016-07-08 15:48         ` Josh Poimboeuf
2016-07-08 15:57           ` Steven Rostedt
2016-07-08 20:24             ` Torsten Duwe
2016-07-08 21:08               ` Steven Rostedt
2016-07-09  9:06                 ` Torsten Duwe [this message]
2016-07-15 18:36                   ` Steven Rostedt
2016-07-08 15:49         ` Steven Rostedt
2016-06-27 15:17 ` [PATCH v2 2/2] arm64: implement live patching Torsten Duwe
2016-07-11 14:03   ` Miroslav Benes
2016-07-11 21:58     ` Jessica Yu
2016-07-12  9:47       ` Miroslav Benes
2016-07-13  0:11         ` [PATCH] arm64: take SHN_LIVEPATCH syms into account when calculating plt_max_entries Jessica Yu
2016-08-17  9:38           ` Miroslav Benes
2016-08-11 16:46     ` [PATCH v2 2/2] arm64: implement live patching Torsten Duwe
2016-07-15 16:03   ` Paul Gortmaker

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=20160709090632.GA2598@lst.de \
    --to=duwe@lst.de \
    --cc=linux-arm-kernel@lists.infradead.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).