linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [RFC][PATCH 1/9 v2] ftrace/x86: Have static tracing also use ftrace_caller_setup
Date: Tue, 25 Nov 2014 06:50:04 -0500	[thread overview]
Message-ID: <20141125115129.267534564@goodmis.org> (raw)
In-Reply-To: 20141125115003.856641273@goodmis.org

[-- Attachment #1: 0001-ftrace-x86-Have-static-tracing-also-use-ftrace_calle.patch --]
[-- Type: text/plain, Size: 2029 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Linus pointed out that there were locations that did the hard coded
update of the parent and rip parameters. One of them was the static tracer
which could also use the ftrace_caller_setup to do that work. In fact,
because it did not use it, it is prone to bugs, and since the static
tracer is hardly ever used (who wants function tracing code always being
called?) it doesn't get tested very often. I only run a few "does it still
work" tests on it. But I do not run stress tests on that code. Although,
since it is never turned off, just having it on should be stressful enough.
(especially for the performance folks)

There's no reason that the static tracer can't also use ftrace_caller_setup.
Have it do so.

Link: http://lkml.kernel.org/r/CA+55aFwF+qCGSKdGaEgW4p6N65GZ5_XTV=1NbtWDvxnd5yYLiw@mail.gmail.com

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/mcount_64.S | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index 6dc134b8dc70..24842c701660 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -21,12 +21,6 @@
 # define function_hook	mcount
 #endif
 
-#ifdef CONFIG_DYNAMIC_FTRACE
-
-ENTRY(function_hook)
-	retq
-END(function_hook)
-
 /* skip is set if stack has been adjusted */
 .macro ftrace_caller_setup trace_label skip=0
 	MCOUNT_SAVE_FRAME \skip
@@ -47,6 +41,12 @@ GLOBAL(\trace_label)
 #endif
 .endm
 
+#ifdef CONFIG_DYNAMIC_FTRACE
+
+ENTRY(function_hook)
+	retq
+END(function_hook)
+
 #ifdef CONFIG_FRAME_POINTER
 /*
  * Stack traces will stop at the ftrace trampoline if the frame pointer
@@ -207,15 +207,7 @@ GLOBAL(ftrace_stub)
 	retq
 
 trace:
-	MCOUNT_SAVE_FRAME
-
-	movq RIP(%rsp), %rdi
-#ifdef CC_USING_FENTRY
-	movq SS+16(%rsp), %rsi
-#else
-	movq 8(%rbp), %rsi
-#endif
-	subq $MCOUNT_INSN_SIZE, %rdi
+	ftrace_caller_setup ftrace_caller_op_ptr
 
 	call   *ftrace_trace_function
 
-- 
2.1.1



  reply	other threads:[~2014-11-25 11:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 11:50 [RFC][PATCH 0/9 v2] ftrace/x86: Clean up of mcount.S code Steven Rostedt
2014-11-25 11:50 ` Steven Rostedt [this message]
2014-11-25 11:50 ` [RFC][PATCH 2/9 v2] ftrace/x86: Move MCOUNT_SAVE_FRAME out of header file Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 3/9 v2] ftrace/x86: Rename MCOUNT_SAVE_FRAME and add more detailed comments Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 4/9 v2] ftrace/x86: Have save_mcount_regs store RIP in %rdi for first parameter Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 5/9 v2] ftrace/x86: Simplify save_mcount_regs on getting RIP Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 6/9 v2] ftrace/x86: Add macro MCOUNT_REG_SIZE for amount of stack used to save mcount regs Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 7/9 v2] ftrace/x86: Have save_mcount_regs macro also save stack frames if needed Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 8/9 v2] ftrace/x86: Get rid of ftrace_caller_setup Steven Rostedt
2014-11-25 11:50 ` [RFC][PATCH 9/9 v2] ftrace/fgraph/x86: Have prepare_ftrace_return() take ip as first parameter Steven Rostedt
2014-11-25 17:36 ` [RFC][PATCH 0/9 v2] ftrace/x86: Clean up of mcount.S code Linus Torvalds
2014-11-26 22:03 ` Thomas Gleixner
2014-11-26 22:05 ` Thomas Gleixner
2014-11-26 23:13   ` 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=20141125115129.267534564@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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).