From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
"H. Peter Anvin" <hpa@zytor.com>, Dave Jones <davej@redhat.com>,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/5] ftrace: Use breakpoint method to update ftrace caller
Date: Thu, 31 May 2012 10:19:49 -0400 [thread overview]
Message-ID: <1338473989.13348.345.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1338463085.28384.54.camel@twins>
On Thu, 2012-05-31 at 13:18 +0200, Peter Zijlstra wrote:
> On Wed, 2012-05-30 at 21:28 -0400, Steven Rostedt wrote:
> > From: Steven Rostedt <srostedt@redhat.com>
> >
> > On boot up and module load, it is fine to modify the code directly,
> > without the use of breakpoints. This is because boot up modification
> > is done before SMP is initialized, thus the modification is serial,
> > and module load is done before the module executes.
> >
> > But after that we must use a SMP safe method to modify running code.
> >
> > This has been done to change the nops at all the functions, but
> > the change of the ftrace callback handler itself was still using a
> > direct modification. If tracing was enabled and the function callback
> > was changed then another CPU could fault if it was currently calling
> > the original callback. This modification must use the breakpoint method
> > too.
> >
> > Note, the direct method is still used for boot up and module load.
>
> The changelog isn't clear if this is a fix or optimization. I suspect
> the latter.
It's a bug fix. There's a GPF kernel crash creeping around in the
current code. I can add to the change log what I put into my cover
letter:
"The second fixes a bug where we don't do the breakpoint update of
the function trace callback (the one called in the mcount trampoline).
This could cause a GPF when tracing is running and the function
tracer changes."
>
> Still, you're now re-inventing text_poke() and text_poke_early().
I explained this in my other email. Also, it wasn't really re-invented,
as I believe ftrace did this first (back in 2007). text_poke() looks to
have come into play around 2008. Ftrace was the first to do live updates
of code while the system was up and running. Before that, the
alternatives code just changed the system at boot up (or going from SMP
to UP or vice versa). It never did the change in an SMP environment.
This patchset is not a implementation of text_poke() but a fix to what
was done earlier. The breakpoint method was something that text_poke()
tried earlier, but H. Peter, warned that Intel has not said it was safe
to do so. Thus we waited. When we got the unofficial OK, I added the
breakpoint method to get rid of stop_machine() from ftrace. That was the
main motivation for this.
>
> Why are you keeping all this inside of ftrace?
I'm not ;-) Well, actually, I wont be. As I explained in my last email,
I talked to Masami about it, and we are discussing ways to change text
poke to do basically what ftrace is doing. I'm doing this with ftrace
first because it removes stop_machine() from it, and it also a greater
test case. If something is to go wrong, it will more likely go wrong
with 30,000 changes at once, than just 100.
-- Steve
next prev parent reply other threads:[~2012-05-31 14:19 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 1:28 [PATCH 0/5] [GIT PULL] ftrace: Fix bug with function tracing and lockdep Steven Rostedt
2012-05-31 1:28 ` [PATCH 1/5] ftrace: Synchronize variable setting with breakpoints Steven Rostedt
2012-05-31 11:06 ` Peter Zijlstra
2012-05-31 14:08 ` Steven Rostedt
2012-05-31 15:16 ` Masami Hiramatsu
2012-05-31 15:29 ` Steven Rostedt
2012-05-31 17:28 ` Peter Zijlstra
2012-05-31 18:42 ` Steven Rostedt
2012-05-31 17:40 ` Peter Zijlstra
2012-05-31 17:44 ` Peter Zijlstra
2012-05-31 17:53 ` Steven Rostedt
2012-05-31 18:03 ` Peter Zijlstra
2012-05-31 18:50 ` Steven Rostedt
2012-05-31 19:06 ` Peter Zijlstra
2012-05-31 19:55 ` Mathieu Desnoyers
2012-05-31 20:10 ` Steven Rostedt
2012-05-31 20:26 ` Peter Zijlstra
2012-05-31 20:37 ` Steven Rostedt
2012-05-31 20:40 ` Steven Rostedt
2012-05-31 20:40 ` Peter Zijlstra
2012-05-31 20:49 ` Steven Rostedt
2012-06-01 4:53 ` Masami Hiramatsu
2012-06-01 11:37 ` Steven Rostedt
2012-06-01 12:52 ` Masami Hiramatsu
2012-06-01 0:45 ` Arnaldo Carvalho de Melo
2012-05-31 1:28 ` [PATCH 2/5] ftrace: Use breakpoint method to update ftrace caller Steven Rostedt
2012-05-31 11:18 ` Peter Zijlstra
2012-05-31 14:19 ` Steven Rostedt [this message]
2012-05-31 1:28 ` [PATCH 3/5] x86: Reset the debug_stack update counter Steven Rostedt
2012-05-31 19:19 ` H. Peter Anvin
2012-05-31 19:26 ` Steven Rostedt
2012-05-31 1:28 ` [PATCH 4/5] x86: Allow nesting of the debug stack IDT setting Steven Rostedt
2012-05-31 18:44 ` H. Peter Anvin
2012-05-31 18:58 ` H. Peter Anvin
2012-05-31 19:25 ` Steven Rostedt
2012-05-31 19:27 ` H. Peter Anvin
2012-05-31 20:00 ` Steven Rostedt
2012-05-31 20:17 ` H. Peter Anvin
2012-05-31 20:35 ` Steven Rostedt
2012-05-31 20:39 ` H. Peter Anvin
2012-05-31 20:56 ` Steven Rostedt
2012-05-31 21:09 ` H. Peter Anvin
2012-05-31 21:37 ` Steven Rostedt
2012-05-31 21:38 ` Steven Rostedt
2012-06-01 2:30 ` Steven Rostedt
2012-05-31 1:28 ` [PATCH 5/5] ftrace/x86: Do not change stacks in DEBUG when calling lockdep Steven Rostedt
2012-05-31 2:13 ` [PATCH 0/5] (for 3.5)[GIT PULL] ftrace: Fix bug with function tracing and lockdep Steven Rostedt
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=1338473989.13348.345.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=peterz@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
all inboxes | Powered by JetHome®