Skip to contentSkip to conversation

ftrace: Remove ftrace_start/stop() and friends

PATCH In review Steven Rostedt 13 participants 71 messages Jun 26, 2014 – Jul 18, 2014

Subsystems (15)
Documentation x86 PowerPC MIPS +11 more subsystems
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover ftrace: Remove ftrace_start/stop() and friends

* Request for Acks *

From the time I created the use of function_trace_stop, I hated it. There was two reasons to create this, one was to try to lower the function tracing overhead when debugfs file tracing_enable was set to zero (note, tracing_enable no longer exists), the other was a way to stop function tracing when going down into suspend and resume.

Some function was causing suspend and resume to reboot the kernel. In debugging this I found that an empty callback from mcount would work. That is, instead of running the tracing code, I would just have the function trace callback be a nop:

void function_trace_call(unsigned long ip, unsigned long parent_ip) {
}

This worked. That means the code in mcount wasn't an issue. I started bisecting the contents of the function_trace_call and found that this would cause the system to reboot!

void function_trace_call(unsigned long ip, unsigned long parent_ip)

 {
	smp_processor_id();

}

That is, just calling smp_processor_id() was enough to trigger a triple fault on resume of the system.

Today, this big hammer approach of disabling the function tracer is starting to show its issues. It can't help out in debugging suspend and resume, and there's other function trace callbacks that should still work.

I also have learned ways to bisect functions that cause bugs in function tracing. I finally got some time to do so with a box that would reboot on suspend and resume. This led me down to a single function:

restore_processor_state()

This made perfect sense, as this function is called from assembly on a CPU startup. One of the jobs of this function was to set up the GS register. That register is also the register that is used by smp_processor_id() to find what CPU the task is running on. With it not set up it will offset into some random location and fault. As the fault handlers can also be traced, those will fault too and finally the system will reset due to a triple fault.

This is all being very specific to x86 of course. For other archs, I don't have anything to test suspend on. But because the ftrace_stop() was added because x86 was complaining, I'm removing it because x86 no longer complains. If your arch exhibits problems with function tracing and suspend and resume let me know and I can work with you in finding the functions that need to be treated as notrace.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

Thanks!

-- Steve

Heiko Carstens (1):
s390/ftrace: remove check of obsolete variable function_trace_stop

Steven Rostedt (Red Hat) (26):
x86, power, suspend: Annotate restore_processor_state() with notrace PM / Sleep: Remove ftrace_stop/start() from suspend and hibernate
tracing: Remove ftrace_stop/start() from reading the trace file
ftrace-graph: Remove dependency of ftrace_stop() from ftrace_graph_stop() ftrace/x86: Add call to ftrace_graph_is_dead() in function graph code
microblaze: ftrace: Add call to ftrace_graph_is_dead() in function graph code
MIPS: ftrace: Add call to ftrace_graph_is_dead() in function graph code
parisc: ftrace: Add call to ftrace_graph_is_dead() in function graph code powerpc/ftrace: Add call to ftrace_graph_is_dead() in function graph code
sh: ftrace: Add call to ftrace_graph_is_dead() in function graph code
ftrace-graph: Remove usage of ftrace_stop() in ftrace_graph_stop()
ftrace: Remove ftrace_start/stop()
ftrace: Do no disable function tracing on enabling function tracing
ftrace: Remove function_trace_stop check from list func
ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST
ftrace: x86: Remove check of obsolete variable function_trace_stop
tile: ftrace: Remove check of obsolete variable function_trace_stop sparc64,ftrace: Remove check of obsolete variable function_trace_stop
sh: ftrace: Remove check of obsolete variable function_trace_stop
parisc: ftrace: Remove check of obsolete variable function_trace_stop
MIPS: ftrace: Remove check of obsolete variable function_trace_stop
microblaze: ftrace: Remove check of obsolete variable function_trace_stop
metag: ftrace: Remove check of obsolete variable function_trace_stop
Blackfin: ftrace: Remove check of obsolete variable function_trace_stop arm64, ftrace: Remove check of obsolete variable function_trace_stop
tracing: Remove function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST

----

 Documentation/trace/ftrace-design.txt | 26 --------------------------
 arch/arm64/kernel/entry-ftrace.S      |  5 -----
 arch/blackfin/Kconfig                 |  1 -
 arch/blackfin/kernel/ftrace-entry.S   | 18 ------------------
 arch/metag/Kconfig                    |  1 -
 arch/metag/kernel/ftrace_stub.S       | 14 --------------
 arch/microblaze/Kconfig               |  1 -
 arch/microblaze/kernel/ftrace.c       |  3 +++
 arch/microblaze/kernel/mcount.S       |  5 -----
 arch/mips/Kconfig                     |  1 -
 arch/mips/kernel/ftrace.c             |  3 +++
 arch/mips/kernel/mcount.S             |  7 -------
 arch/parisc/Kconfig                   |  1 -
 arch/parisc/kernel/ftrace.c           |  6 +++---
 arch/powerpc/kernel/ftrace.c          |  3 +++
 arch/s390/Kconfig                     |  1 -
 arch/s390/kernel/mcount.S             | 10 +++-------
 arch/s390/kernel/mcount64.S           |  3 ---
 arch/sh/Kconfig                       |  1 -
 arch/sh/kernel/ftrace.c               |  3 +++
 arch/sh/lib/mcount.S                  | 24 ++----------------------
 arch/sparc/Kconfig                    |  1 -
 arch/sparc/lib/mcount.S               | 10 ++--------
 arch/tile/Kconfig                     |  1 -
 arch/tile/kernel/mcount_64.S          | 18 ------------------
 arch/x86/Kconfig                      |  1 -
 arch/x86/kernel/entry_32.S            |  9 ---------
 arch/x86/kernel/ftrace.c              |  3 +++
 arch/x86/kernel/mcount_64.S           | 18 +-----------------
 arch/x86/power/cpu.c                  |  4 ++--
 include/linux/ftrace.h                | 34 ++--------------------------------
 kernel/power/hibernate.c              |  6 ------
 kernel/power/suspend.c                |  2 --
 kernel/trace/Kconfig                  |  5 -----
 kernel/trace/ftrace.c                 | 23 ++---------------------
 kernel/trace/trace.c                  |  2 --
 kernel/trace/trace_functions_graph.c  | 30 ++++++++++++++++++++++++++++++
 37 files changed, 62 insertions(+), 242 deletions(-)
author maintainer
#1 lore raw

PATCH 1/27 x86, power, suspend: Annotate restore_processor_state() with notrace

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is used to stop function tracing during suspend and resume which removes a lot of possible debugging opportunities with tracing. The reason was that some function in the resume path was causing a triple fault if it were to be traced. The issue I found was that doing something as simple as calling smp_processor_id() would reboot the box!

When function tracing was first created I didn't have a good way to figure out what function was having issues, or it looked to be multiple ones. To fix it, we just created a big hammer approach to the problem which was to add a flag in the mcount trampoline that could be checked and not call the traced functions.

Lately I developed better ways to find problem functions and I can bisect down to see what function is causing the issue. I removed the flag that stopped tracing and proceeded to find the problem function and it ended up being restore_processor_state(). This function makes sense as when the CPU comes back online from a suspend it calls this function to set up registers, amongst them the GS register, which stores things such as what CPU the processor is (if you call smp_processor_id() without this set up properly, it would fault).

By making restore_processor_state() notrace, the system can suspend and resume without the need of the big hammer tracing to stop.

---
 arch/x86/power/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/power/cpu.c +2 -2
index 424f4c97a44d..6ec7910f59bf 100644
@@ -165,7 +165,7 @@ static void fix_processor_context(void)
  *		by __save_processor_state()
  *	@ctxt - structure to load the registers contents from
  */
-static void __restore_processor_state(struct saved_context *ctxt)
+static void notrace __restore_processor_state(struct saved_context *ctxt)
 {
 	if (ctxt->misc_enable_saved)
 		wrmsrl(MSR_IA32_MISC_ENABLE, ctxt->misc_enable);
@@ -239,7 +239,7 @@ static void __restore_processor_state(struct saved_context *ctxt)
 }
 
 /* Needed by apm.c */
-void restore_processor_state(void)
+void notrace restore_processor_state(void)
 {
 	__restore_processor_state(&saved_context);
 }
Signature · 1 line
2.0.0
#2 lore raw

Re: [RFA][PATCH 01/27] x86, power, suspend: Annotate restore_processor_state() with notrace

Quoted 23 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is used to stop function tracing during suspend and resume which removes a lot of possible debugging opportunities with tracing. The reason was that some function in the resume path was causing a triple fault if it were to be traced. The issue I found was that doing something as simple as calling smp_processor_id() would reboot the box!

When function tracing was first created I didn't have a good way to figure out what function was having issues, or it looked to be multiple ones. To fix it, we just created a big hammer approach to the problem which was to add a flag in the mcount trampoline that could be checked and not call the traced functions.

Lately I developed better ways to find problem functions and I can bisect down to see what function is causing the issue. I removed the flag that stopped tracing and proceeded to find the problem function and it ended up being restore_processor_state(). This function makes sense as when the CPU comes back online from a suspend it calls this function to set up registers, amongst them the GS register, which stores things such as what CPU the processor is (if you call smp_processor_id() without this set up properly, it would fault).

Quoted 4 lines

By making restore_processor_state() notrace, the system can suspend and resume without the need of the big hammer tracing to stop.

ACK

Quoted 27 lines
---
 arch/x86/power/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/power/cpu.c +2 -2
index 424f4c97a44d..6ec7910f59bf 100644
@@ -165,7 +165,7 @@ static void fix_processor_context(void)
  *		by __save_processor_state()
  *	@ctxt - structure to load the registers contents from
  */
-static void __restore_processor_state(struct saved_context *ctxt)
+static void notrace __restore_processor_state(struct saved_context *ctxt)
 {
 	if (ctxt->misc_enable_saved)
 		wrmsrl(MSR_IA32_MISC_ENABLE, ctxt->misc_enable);
@@ -239,7 +239,7 @@ static void __restore_processor_state(struct saved_context *ctxt)
 }
 
 /* Needed by apm.c */
-void restore_processor_state(void)
+void notrace restore_processor_state(void)
 {
 	__restore_processor_state(&saved_context);
 }
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author maintainer
#3 lore raw

PATCH 2/27 PM / Sleep: Remove ftrace_stop/start() from suspend and hibernate

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() and ftrace_start() were added to the suspend and hibernate process because there was some function within the work flow that caused the system to reboot if it was traced. This function has recently been found (restore_processor_state()). Now there's no reason to disable function tracing while we are going into suspend or hibernate, which means that being able to trace this will help tremendously in debugging any issues with suspend or hibernate.

This also means that the ftrace_stop/start() functions can be removed and simplify the function tracing code a bit.

---
 kernel/power/hibernate.c | 6 ------
 kernel/power/suspend.c   | 2 --
 2 files changed, 8 deletions(-)
kernel/power/hibernate.c +0 -6
index 49e0a20fd010..ca7b1906c6c8 100644
@@ -365,7 +365,6 @@ int hibernation_snapshot(int platform_mode)
 	}
 
 	suspend_console();
-	ftrace_stop();
 	pm_restrict_gfp_mask();
 
 	error = dpm_suspend(PMSG_FREEZE);
@@ -391,7 +390,6 @@ int hibernation_snapshot(int platform_mode)
 	if (error || !in_suspend)
 		pm_restore_gfp_mask();
 
-	ftrace_start();
 	resume_console();
 	dpm_complete(msg);
 
@@ -494,7 +492,6 @@ int hibernation_restore(int platform_mode)
 
 	pm_prepare_console();
 	suspend_console();
-	ftrace_stop();
 	pm_restrict_gfp_mask();
 	error = dpm_suspend_start(PMSG_QUIESCE);
 	if (!error) {
@@ -502,7 +499,6 @@ int hibernation_restore(int platform_mode)
 		dpm_resume_end(PMSG_RECOVER);
 	}
 	pm_restore_gfp_mask();
-	ftrace_start();
 	resume_console();
 	pm_restore_console();
 	return error;
@@ -529,7 +525,6 @@ int hibernation_platform_enter(void)
 
 	entering_platform_hibernation = true;
 	suspend_console();
-	ftrace_stop();
 	error = dpm_suspend_start(PMSG_HIBERNATE);
 	if (error) {
 		if (hibernation_ops->recover)
@@ -573,7 +568,6 @@ int hibernation_platform_enter(void)
  Resume_devices:
 	entering_platform_hibernation = false;
 	dpm_resume_end(PMSG_RESTORE);
-	ftrace_start();
 	resume_console();
 
  Close:
kernel/power/suspend.c +0 -2
index 4dd8822f732a..f6623da034d8 100644
@@ -248,7 +248,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
 		goto Platform_wake;
 	}
 
-	ftrace_stop();
 	error = disable_nonboot_cpus();
 	if (error || suspend_test(TEST_CPUS))
 		goto Enable_cpus;
@@ -275,7 +274,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
 
  Enable_cpus:
 	enable_nonboot_cpus();
-	ftrace_start();
 
  Platform_wake:
 	if (need_suspend_ops(state) && suspend_ops->wake)
Signature · 1 line
2.0.0
#4 lore raw

Re: [RFA][PATCH 02/27] PM / Sleep: Remove ftrace_stop/start() from suspend and hibernate

Quoted 10 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() and ftrace_start() were added to the suspend and hibernate process because there was some function within the work flow that caused the system to reboot if it was traced. This function has recently been found (restore_processor_state()). Now there's no reason to disable function tracing while we are going into suspend or hibernate, which means that being able to trace this will help tremendously in debugging any issues with suspend or hibernate.

Quoted 4 lines

This also means that the ftrace_stop/start() functions can be removed and simplify the function tracing code a bit.

ACK

Quoted 78 lines
---
 kernel/power/hibernate.c | 6 ------
 kernel/power/suspend.c   | 2 --
 2 files changed, 8 deletions(-)
kernel/power/hibernate.c +0 -6
index 49e0a20fd010..ca7b1906c6c8 100644
@@ -365,7 +365,6 @@ int hibernation_snapshot(int platform_mode)
 	}
 
 	suspend_console();
-	ftrace_stop();
 	pm_restrict_gfp_mask();
 
 	error = dpm_suspend(PMSG_FREEZE);
@@ -391,7 +390,6 @@ int hibernation_snapshot(int platform_mode)
 	if (error || !in_suspend)
 		pm_restore_gfp_mask();
 
-	ftrace_start();
 	resume_console();
 	dpm_complete(msg);
 
@@ -494,7 +492,6 @@ int hibernation_restore(int platform_mode)
 
 	pm_prepare_console();
 	suspend_console();
-	ftrace_stop();
 	pm_restrict_gfp_mask();
 	error = dpm_suspend_start(PMSG_QUIESCE);
 	if (!error) {
@@ -502,7 +499,6 @@ int hibernation_restore(int platform_mode)
 		dpm_resume_end(PMSG_RECOVER);
 	}
 	pm_restore_gfp_mask();
-	ftrace_start();
 	resume_console();
 	pm_restore_console();
 	return error;
@@ -529,7 +525,6 @@ int hibernation_platform_enter(void)
 
 	entering_platform_hibernation = true;
 	suspend_console();
-	ftrace_stop();
 	error = dpm_suspend_start(PMSG_HIBERNATE);
 	if (error) {
 		if (hibernation_ops->recover)
@@ -573,7 +568,6 @@ int hibernation_platform_enter(void)
  Resume_devices:
 	entering_platform_hibernation = false;
 	dpm_resume_end(PMSG_RESTORE);
-	ftrace_start();
 	resume_console();
 
  Close:
kernel/power/suspend.c +0 -2
index 4dd8822f732a..f6623da034d8 100644
@@ -248,7 +248,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
 		goto Platform_wake;
 	}
 
-	ftrace_stop();
 	error = disable_nonboot_cpus();
 	if (error || suspend_test(TEST_CPUS))
 		goto Enable_cpus;
@@ -275,7 +274,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
 
  Enable_cpus:
 	enable_nonboot_cpus();
-	ftrace_start();
 
  Platform_wake:
 	if (need_suspend_ops(state) && suspend_ops->wake)
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author maintainer
#5 lore raw

PATCH 3/27 tracing: Remove ftrace_stop/start() from reading the trace file

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Disabling reading and writing to the trace file should not be able to disable all function tracing callbacks. There's other users today (like kprobes and perf). Reading a trace file should not stop those from happening.

---
 kernel/trace/trace.c | 2 --
 1 file changed, 2 deletions(-)
kernel/trace/trace.c +0 -2
index eeb233cbac4f..433a50ffc73e 100644
@@ -1372,7 +1372,6 @@ void tracing_start(void)
 
 	arch_spin_unlock(&global_trace.max_lock);
 
-	ftrace_start();
  out:
 	raw_spin_unlock_irqrestore(&global_trace.start_lock, flags);
 }
@@ -1419,7 +1418,6 @@ void tracing_stop(void)
 	struct ring_buffer *buffer;
 	unsigned long flags;
 
-	ftrace_stop();
 	raw_spin_lock_irqsave(&global_trace.start_lock, flags);
 	if (global_trace.stop_count++)
 		goto out;
Signature · 1 line
2.0.0
author maintainer
#6 lore raw

PATCH 4/27 ftrace-graph: Remove dependency of ftrace_stop() from ftrace_graph_stop()

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing.

A new function is created called ftrace_graph_is_dead(). This is called in strategic paths to prevent function graph from doing more harm and allowing at least a warning to be printed before the system crashes.

NOTE: ftrace_stop() is still used until all the archs are converted over to use ftrace_graph_is_dead(). After that, ftrace_stop() will be removed.

Cc Frederic Weisbecker <[email protected]>
---
 include/linux/ftrace.h               |  1 +
 kernel/trace/ftrace.c                |  5 -----
 kernel/trace/trace_functions_graph.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 5 deletions(-)
include/linux/ftrace.h +1 -0
index 11e18fd58b1a..ec059c343e78 100644
@@ -750,6 +750,7 @@ extern char __irqentry_text_end[];
 extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 				trace_func_graph_ent_t entryfunc);
 
+extern bool ftrace_graph_is_dead(void);
 extern void ftrace_graph_stop(void);
 
 /* The current handlers in use */
kernel/trace/ftrace.c +0 -5
index 3a6d44c76af7..823984c20262 100644
@@ -5439,9 +5439,4 @@ void ftrace_graph_exit_task(struct task_struct *t)
 
 	kfree(ret_stack);
 }
-
-void ftrace_graph_stop(void)
-{
-	ftrace_stop();
-}
 #endif
kernel/trace/trace_functions_graph.c +35 -0
index 4de3e57f723c..3604690be70b 100644
@@ -15,6 +15,38 @@
 #include "trace.h"
 #include "trace_output.h"
 
+static bool kill_ftrace_graph;
+
+/**
+ * ftrace_graph_is_dead - returns true if ftrace_graph_stop() was called
+ *
+ * ftrace_graph_stop() is called when a severe error is detected in
+ * the function graph tracing. This function is called by the critical
+ * paths of function graph to keep those paths from doing any more harm.
+ */
+bool ftrace_graph_is_dead(void)
+{
+	return kill_ftrace_graph;
+}
+
+/**
+ * ftrace_graph_stop - set to permanently disable function graph tracincg
+ *
+ * In case of an error int function graph tracing, this is called
+ * to try to keep function graph tracing from causing any more harm.
+ * Usually this is pretty severe and this is called to try to at least
+ * get a warning out to the user.
+ */
+void ftrace_graph_stop(void)
+{
+	kill_ftrace_graph = true;
+	/*
+	 * ftrace_stop() will be removed when all archs are updated to
+	 * use ftrace_graph_is_dead()
+	 */
+	ftrace_stop();
+}
+
 /* When set, irq functions will be ignored */
 static int ftrace_graph_skip_irqs;
 
@@ -92,6 +124,9 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
 	unsigned long long calltime;
 	int index;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return -EBUSY;
+
 	if (!current->ret_stack)
 		return -EBUSY;
 
Signature · 1 line
2.0.0
author maintainer
#7 lore raw

PATCH 5/27 ftrace/x86: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/x86/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/ftrace.c +3 -0
index cbc4a91b131e..3386dc9aa333 100644
@@ -703,6 +703,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Signature · 1 line
2.0.0
reviewer Acked-by on v1 5/27
#8 lore raw

Re: [RFA][PATCH 05/27] ftrace/x86: Add call to ftrace_graph_is_dead() in function graph code

Quoted 8 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Quoted 6 lines

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

author maintainer
#9 lore raw

PATCH 6/27 microblaze: ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/microblaze/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/microblaze/kernel/ftrace.c +3 -0
index bbcd2533766c..fc7b48a52cd5 100644
@@ -27,6 +27,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Signature · 1 line
2.0.0
author maintainer
#10 lore raw

Re: [RFA][PATCH 06/27] microblaze: ftrace: Add call to ftrace_graph_is_dead() in function graph code

Michal,

Can you give me your Acked-by on this and patch 22? I'm still waiting of a few arch maintainers before I can push these up to my for-next branch.

-- Steve

Quoted 32 lines · On Thu, 26 Jun 2014 12:52:27 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/microblaze/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/microblaze/kernel/ftrace.c +3 -0
index bbcd2533766c..fc7b48a52cd5 100644
@@ -27,6 +27,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
author maintainer
#11 lore raw

Re: [RFA][PATCH 06/27] microblaze: ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

Michal,

Can you ack this please?

-- Steve

Quoted 32 lines · On Thu, 26 Jun 2014 12:52:27 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/microblaze/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/microblaze/kernel/ftrace.c +3 -0
index bbcd2533766c..fc7b48a52cd5 100644
@@ -27,6 +27,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
maintainer Tested-by
#12 lore raw

Re: [RFA][PATCH 06/27] microblaze: ftrace: Add call to ftrace_graph_is_dead() in function graph code

Hi Steve,

Quoted 36 lines · Steven Rostedt

Michal,

Can you ack this please?

-- Steve

Quoted 26 lines · On Thu, 26 Jun 2014 12:52:27 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/microblaze/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/microblaze/kernel/ftrace.c +0 -0
index bbcd2533766c..fc7b48a52cd5 100644
@@ -27,6 +27,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
Quoted 7 lines

arch/microblaze/kernel/ftrace.c void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) · line 35

Quoted 6 lines
arch/microblaze/kernel/ftrace.c +3 -0
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 

sorry for delay. Here is mine.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
author maintainer
#13 lore raw

PATCH 7/27 MIPS: ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/mips/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/kernel/ftrace.c +3 -0
index 60e7e5e45af1..8b6538750fe1 100644
@@ -302,6 +302,9 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
 	    &return_to_handler;
 	int faulted, insns;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Signature · 1 line
2.0.0
author maintainer
#14 lore raw

Re: [RFA][PATCH 07/27] MIPS: ftrace: Add call to ftrace_graph_is_dead() in function graph code

Adding [email protected].

-- Steve

Quoted 32 lines · On Thu, 26 Jun 2014 12:52:28 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/mips/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/kernel/ftrace.c +3 -0
index 60e7e5e45af1..8b6538750fe1 100644
@@ -302,6 +302,9 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
 	    &return_to_handler;
 	int faulted, insns;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Tested-by
#15 lore raw

Re: [RFA][PATCH 07/27] MIPS: ftrace: Add call to ftrace_graph_is_dead() in function graph code

Hi Steven,

I've given this a quick test on a mips32 le target, on your rfc/remove-function-trace-stop branch (4161daee7df8). Booted fine, startup tests fine, function and function_graph trace appear to work from a quick cat of the trace file. Feel free to add my Tested-by:

Cheers
James

Quoted 47 lines · Steven Rostedt

Adding [email protected].

-- Steve

Quoted 23 lines · On Thu, 26 Jun 2014 12:52:28 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/mips/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/kernel/ftrace.c +0 -0
index 60e7e5e45af1..8b6538750fe1 100644

arch/mips/kernel/ftrace.c void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, · line 310

Quoted 9 lines
arch/mips/kernel/ftrace.c +3 -0
@@ -302,6 +302,9 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
 	    &return_to_handler;
 	int faulted, insns;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#16 lore raw

Re: [RFA][PATCH 07/27] MIPS: ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

Ralf,

Can you give me your Acked-by on this and patch 21. I'm still waiting on a few arch maintainers for acks before I can push this to my for-next branch.

Thanks,

-- Steve

Quoted 32 lines · On Thu, 26 Jun 2014 12:52:28 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/mips/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/kernel/ftrace.c +3 -0
index 60e7e5e45af1..8b6538750fe1 100644
@@ -302,6 +302,9 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
 	    &return_to_handler;
 	int faulted, insns;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
author maintainer
#17 lore raw

PATCH 8/27 parisc: ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

Cc Helge Deller <[email protected]>
Cc Kyle McMartin <[email protected]>
---
 arch/parisc/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/parisc/kernel/ftrace.c +3 -0
index 5beb97bafbb1..5512ab32c5e0 100644
@@ -112,6 +112,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	unsigned long long calltime;
 	struct ftrace_graph_ent trace;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Signature · 1 line
2.0.0
author maintainer
#18 lore raw

PATCH 9/27 powerpc/ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

Cc Anton Blanchard <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
---
 arch/powerpc/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/powerpc/kernel/ftrace.c +3 -0
index f202d0731b06..f8c0ce5523a5 100644
@@ -527,6 +527,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	struct ftrace_graph_ent trace;
 	unsigned long return_hooker = (unsigned long)&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Signature · 1 line
2.0.0
author maintainer
#19 lore raw

Re: [RFA][PATCH 09/27] powerpc/ftrace: Add call to ftrace_graph_is_dead() in function graph code

Ben,

Can you ack this please?

Thanks,

-- Steve

Quoted 33 lines · On Thu, 26 Jun 2014 12:52:30 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

Cc Anton Blanchard <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
---
 arch/powerpc/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/powerpc/kernel/ftrace.c +3 -0
index f202d0731b06..f8c0ce5523a5 100644
@@ -527,6 +527,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	struct ftrace_graph_ent trace;
 	unsigned long return_hooker = (unsigned long)&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
author maintainer
#20 lore raw

PATCH 10/27 sh: ftrace: Add call to ftrace_graph_is_dead() in function graph code

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing.

Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. To do this, the arch code must call ftrace_graph_is_dead() before it implements function graph.

---
 arch/sh/kernel/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)
arch/sh/kernel/ftrace.c +3 -0
index 3c74f53db6db..079d70e6d74b 100644
@@ -344,6 +344,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 	struct ftrace_graph_ent trace;
 	unsigned long return_hooker = (unsigned long)&return_to_handler;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
Signature · 1 line
2.0.0
author maintainer
#21 lore raw

PATCH 11/27 ftrace-graph: Remove usage of ftrace_stop() in ftrace_graph_stop()

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

All archs now use ftrace_graph_is_dead() to stop function graph tracing. Remove the usage of ftrace_stop() as that is no longer needed.

Cc Frederic Weisbecker <[email protected]>
---
 kernel/trace/trace_functions_graph.c | 5 -----
 1 file changed, 5 deletions(-)
kernel/trace/trace_functions_graph.c +0 -5
index 3604690be70b..2c944e6c4a9d 100644
@@ -40,11 +40,6 @@ bool ftrace_graph_is_dead(void)
 void ftrace_graph_stop(void)
 {
 	kill_ftrace_graph = true;
-	/*
-	 * ftrace_stop() will be removed when all archs are updated to
-	 * use ftrace_graph_is_dead()
-	 */
-	ftrace_stop();
 }
 
 /* When set, irq functions will be ignored */
Signature · 1 line
2.0.0
author maintainer
#22 lore raw

PATCH 12/27 ftrace: Remove ftrace_start/stop()

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

There are no more kernel users of ftrace_stop() and ftrace_start(). Remove them.

---
 include/linux/ftrace.h | 28 ----------------------------
 1 file changed, 28 deletions(-)
include/linux/ftrace.h +0 -28
index ec059c343e78..d74a37d53271 100644
@@ -143,32 +143,6 @@ enum ftrace_tracing_type_t {
 /* Current tracing type, default is FTRACE_TYPE_ENTER */
 extern enum ftrace_tracing_type_t ftrace_tracing_type;
 
-/**
- * ftrace_stop - stop function tracer.
- *
- * A quick way to stop the function tracer. Note this an on off switch,
- * it is not something that is recursive like preempt_disable.
- * This does not disable the calling of mcount, it only stops the
- * calling of functions from mcount.
- */
-static inline void ftrace_stop(void)
-{
-	function_trace_stop = 1;
-}
-
-/**
- * ftrace_start - start the function tracer.
- *
- * This function is the inverse of ftrace_stop. This does not enable
- * the function tracing if the function tracer is disabled. This only
- * sets the function tracer flag to continue calling the functions
- * from mcount.
- */
-static inline void ftrace_start(void)
-{
-	function_trace_stop = 0;
-}
-
 /*
  * The ftrace_ops must be a static and should also
  * be read_mostly.  These functions do modify read_mostly variables
@@ -245,8 +219,6 @@ static inline int ftrace_nr_registered_ops(void)
 }
 static inline void clear_ftrace_function(void) { }
 static inline void ftrace_kill(void) { }
-static inline void ftrace_stop(void) { }
-static inline void ftrace_start(void) { }
 #endif /* CONFIG_FUNCTION_TRACER */
 
 #ifdef CONFIG_STACK_TRACER
Signature · 1 line
2.0.0
author maintainer
#23 lore raw

PATCH 13/27 ftrace: Do no disable function tracing on enabling function tracing

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

When function tracing is being updated function_trace_stop is set to keep from tracing the updates. This was fine when function tracing was done from stop machine. But it is no longer done that way and this can cause real tracing to be missed.

Remove it.

---
 kernel/trace/ftrace.c | 7 -------
 1 file changed, 7 deletions(-)
kernel/trace/ftrace.c +0 -7
index 823984c20262..1e4e9bbb8dfa 100644
@@ -2260,11 +2260,6 @@ static void ftrace_run_update_code(int command)
 	FTRACE_WARN_ON(ret);
 	if (ret)
 		return;
-	/*
-	 * Do not call function tracer while we update the code.
-	 * We are in stop machine.
-	 */
-	function_trace_stop++;
 
 	/*
 	 * By default we use stop_machine() to modify the code.
@@ -2274,8 +2269,6 @@ static void ftrace_run_update_code(int command)
 	 */
 	arch_ftrace_update_code(command);
 
-	function_trace_stop--;
-
 	ret = ftrace_arch_code_modify_post_process();
 	FTRACE_WARN_ON(ret);
 
Signature · 1 line
2.0.0
author maintainer
#24 lore raw

PATCH 14/27 ftrace: Remove function_trace_stop check from list func

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

function_trace_stop is no longer used to stop function tracing. Remove the check from __ftrace_ops_list_func().

Also, call FTRACE_WARN_ON() instead of setting function_trace_stop if a ops has no func to call.

---
 kernel/trace/ftrace.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
kernel/trace/ftrace.c +2 -6
index 1e4e9bbb8dfa..34994885bb1d 100644
@@ -4692,9 +4692,6 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
 	struct ftrace_ops *op;
 	int bit;
 
-	if (function_trace_stop)
-		return;
-
 	bit = trace_test_and_set_recursion(TRACE_LIST_START, TRACE_LIST_MAX);
 	if (bit < 0)
 		return;
@@ -4706,9 +4703,8 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
 	preempt_disable_notrace();
 	do_for_each_ftrace_op(op, ftrace_ops_list) {
 		if (ftrace_ops_test(op, ip, regs)) {
-			if (WARN_ON(!op->func)) {
-				function_trace_stop = 1;
-				printk("op=%p %pS\n", op, op);
+			if (FTRACE_WARN_ON(!op->func)) {
+				pr_warn("op=%p %pS\n", op, op);
 				goto out;
 			}
 			op->func(ip, parent_ip, op, regs);
Signature · 1 line
2.0.0
author maintainer
#25 lore raw

PATCH 15/27 ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

function_trace_stop is no longer used to disable function tracing. This means that archs are no longer limited if it does not support checking this variable in the mcount trampoline.

No need to use the list_func for archs that do not support this obsolete method.

---
 Documentation/trace/ftrace-design.txt | 26 --------------------------
 include/linux/ftrace.h                |  3 +--
 2 files changed, 1 insertion(+), 28 deletions(-)
Documentation/trace/ftrace-design.txt +0 -26
index 3f669b9e8852..dd5f916b351d 100644
@@ -102,30 +102,6 @@ extern void mcount(void);
 EXPORT_SYMBOL(mcount);
 
 
-HAVE_FUNCTION_TRACE_MCOUNT_TEST
--------------------------------
-
-This is an optional optimization for the normal case when tracing is turned off
-in the system.  If you do not enable this Kconfig option, the common ftrace
-code will take care of doing the checking for you.
-
-To support this feature, you only need to check the function_trace_stop
-variable in the mcount function.  If it is non-zero, there is no tracing to be
-done at all, so you can return.
-
-This additional pseudo code would simply be:
-void mcount(void)
-{
-	/* save any bare state needed in order to do initial checking */
-
-+	if (function_trace_stop)
-+		return;
-
-	extern void (*ftrace_trace_function)(unsigned long, unsigned long);
-	if (ftrace_trace_function != ftrace_stub)
-...
-
-
 HAVE_FUNCTION_GRAPH_TRACER
 --------------------------
 
@@ -328,8 +304,6 @@ void mcount(void)
 
 void ftrace_caller(void)
 {
-	/* implement HAVE_FUNCTION_TRACE_MCOUNT_TEST if you desire */
-
 	/* save all state needed by the ABI (see paragraph above) */
 
 	unsigned long frompc = ...;
include/linux/ftrace.h +1 -2
index d74a37d53271..7a21d5358b74 100644
@@ -33,8 +33,7 @@
  * features, then it must call an indirect function that
  * does. Or at least does enough to prevent any unwelcomed side effects.
  */
-#if !defined(CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST) || \
-	!ARCH_SUPPORTS_FTRACE_OPS
+#if !ARCH_SUPPORTS_FTRACE_OPS
 # define FTRACE_FORCE_LIST_FUNC 1
 #else
 # define FTRACE_FORCE_LIST_FUNC 0
Signature · 1 line
2.0.0
author maintainer
#26 lore raw

PATCH 16/27 ftrace: x86: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

---
 arch/x86/Kconfig            |  1 -
 arch/x86/kernel/entry_32.S  |  9 ---------
 arch/x86/kernel/mcount_64.S | 18 +-----------------
 3 files changed, 1 insertion(+), 27 deletions(-)
arch/x86/Kconfig +0 -1
index fcefdda5136d..e9df49244741 100644
@@ -54,7 +54,6 @@ config X86
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_GRAPH_FP_TEST
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_SYSCALL_TRACEPOINTS
 	select SYSCTL_EXCEPTION_TRACE
 	select HAVE_KVM
arch/x86/kernel/entry_32.S +0 -9
index f0da82b8e634..e352cad614d4 100644
@@ -1052,9 +1052,6 @@ ENTRY(mcount)
 END(mcount)
 
 ENTRY(ftrace_caller)
-	cmpl $0, function_trace_stop
-	jne  ftrace_stub
-
 	pushl %eax
 	pushl %ecx
 	pushl %edx
@@ -1086,8 +1083,6 @@ END(ftrace_caller)
 
 ENTRY(ftrace_regs_caller)
 	pushf	/* push flags before compare (in cs location) */
-	cmpl $0, function_trace_stop
-	jne ftrace_restore_flags
 
 	/*
 	 * i386 does not save SS and ESP when coming from kernel.
@@ -1146,7 +1141,6 @@ GLOBAL(ftrace_regs_call)
 	popf			/* Pop flags at end (no addl to corrupt flags) */
 	jmp ftrace_ret
 
-ftrace_restore_flags:
 	popf
 	jmp  ftrace_stub
 #else /* ! CONFIG_DYNAMIC_FTRACE */
@@ -1155,9 +1149,6 @@ ENTRY(mcount)
 	cmpl $__PAGE_OFFSET, %esp
 	jb ftrace_stub		/* Paging not enabled yet? */
 
-	cmpl $0, function_trace_stop
-	jne  ftrace_stub
-
 	cmpl $ftrace_stub, ftrace_trace_function
 	jnz trace
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
arch/x86/kernel/mcount_64.S +1 -17
index 6b4e3c3b3d74..c73aecf10d34 100644
@@ -46,10 +46,6 @@ END(function_hook)
 .endm
 
 ENTRY(ftrace_caller)
-	/* Check if tracing was disabled (quick check) */
-	cmpl $0, function_trace_stop
-	jne  ftrace_stub
-
 	ftrace_caller_setup
 	/* regs go into 4th parameter (but make it NULL) */
 	movq $0, %rcx
@@ -73,10 +69,6 @@ ENTRY(ftrace_regs_caller)
 	/* Save the current flags before compare (in SS location)*/
 	pushfq
 
-	/* Check if tracing was disabled (quick check) */
-	cmpl $0, function_trace_stop
-	jne  ftrace_restore_flags
-
 	/* skip=8 to skip flags saved in SS */
 	ftrace_caller_setup 8
 
@@ -131,7 +123,7 @@ GLOBAL(ftrace_regs_call)
 	popfq
 
 	jmp ftrace_return
-ftrace_restore_flags:
+
 	popfq
 	jmp  ftrace_stub
 
@@ -141,9 +133,6 @@ END(ftrace_regs_caller)
 #else /* ! CONFIG_DYNAMIC_FTRACE */
 
 ENTRY(function_hook)
-	cmpl $0, function_trace_stop
-	jne  ftrace_stub
-
 	cmpq $ftrace_stub, ftrace_trace_function
 	jnz trace
 
@@ -182,10 +171,6 @@ END(function_hook)
 ENTRY(ftrace_graph_caller)
 	MCOUNT_SAVE_FRAME
 
-	/* Check if tracing was disabled (quick check) */
-	cmpl $0, function_trace_stop
-	jne  fgraph_skip
-
 #ifdef CC_USING_FENTRY
 	leaq SS+16(%rsp), %rdi
 	movq $0, %rdx	/* No framepointers needed */
@@ -198,7 +183,6 @@ ENTRY(ftrace_graph_caller)
 
 	call	prepare_ftrace_return
 
-fgraph_skip:
 	MCOUNT_RESTORE_FRAME
 
 	retq
Signature · 1 line
2.0.0
author maintainer
#28 lore raw

PATCH 17/27 tile: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/tile/Kconfig            |  1 -
 arch/tile/kernel/mcount_64.S | 18 ------------------
 2 files changed, 19 deletions(-)
arch/tile/Kconfig +0 -1
index 4f3006b600e3..7fcd492adbfc 100644
@@ -128,7 +128,6 @@ config TILEGX
 	select SPARSE_IRQ
 	select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
arch/tile/kernel/mcount_64.S +0 -18
index 70d7bb0c4d8f..3c2b8d5e1d1a 100644
@@ -77,15 +77,6 @@ STD_ENDPROC(__mcount)
 
 	.align	64
 STD_ENTRY(ftrace_caller)
-	moveli	r11, hw2_last(function_trace_stop)
-	{ shl16insli	r11, r11, hw1(function_trace_stop); move r12, lr }
-	{ shl16insli	r11, r11, hw0(function_trace_stop); move lr, r10 }
-	ld	r11, r11
-	beqz	r11, 1f
-	jrp	r12
-
-1:
-	{ move	r10, lr; move	lr, r12 }
 	MCOUNT_SAVE_REGS
 
 	/* arg1: self return address */
@@ -119,15 +110,6 @@ STD_ENDPROC(ftrace_caller)
 
 	.align	64
 STD_ENTRY(__mcount)
-	moveli	r11, hw2_last(function_trace_stop)
-	{ shl16insli	r11, r11, hw1(function_trace_stop); move r12, lr }
-	{ shl16insli	r11, r11, hw0(function_trace_stop); move lr, r10 }
-	ld	r11, r11
-	beqz	r11, 1f
-	jrp	r12
-
-1:
-	{ move	r10, lr; move	lr, r12 }
 	{
 	 moveli	r11, hw2_last(ftrace_trace_function)
 	 moveli	r13, hw2_last(ftrace_stub)
Signature · 1 line
2.0.0
author maintainer
#29 lore raw

Re: [RFA][PATCH 17/27] tile: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 12:52:38 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter (you were not Cc'd on)

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 56 lines
---
 arch/tile/Kconfig            |  1 -
 arch/tile/kernel/mcount_64.S | 18 ------------------
 2 files changed, 19 deletions(-)
arch/tile/Kconfig +0 -1
index 4f3006b600e3..7fcd492adbfc 100644
@@ -128,7 +128,6 @@ config TILEGX
 	select SPARSE_IRQ
 	select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
arch/tile/kernel/mcount_64.S +0 -18
index 70d7bb0c4d8f..3c2b8d5e1d1a 100644
@@ -77,15 +77,6 @@ STD_ENDPROC(__mcount)
 
 	.align	64
 STD_ENTRY(ftrace_caller)
-	moveli	r11, hw2_last(function_trace_stop)
-	{ shl16insli	r11, r11, hw1(function_trace_stop); move r12, lr }
-	{ shl16insli	r11, r11, hw0(function_trace_stop); move lr, r10 }
-	ld	r11, r11
-	beqz	r11, 1f
-	jrp	r12
-
-1:
-	{ move	r10, lr; move	lr, r12 }
 	MCOUNT_SAVE_REGS
 
 	/* arg1: self return address */
@@ -119,15 +110,6 @@ STD_ENDPROC(ftrace_caller)
 
 	.align	64
 STD_ENTRY(__mcount)
-	moveli	r11, hw2_last(function_trace_stop)
-	{ shl16insli	r11, r11, hw1(function_trace_stop); move r12, lr }
-	{ shl16insli	r11, r11, hw0(function_trace_stop); move lr, r10 }
-	ld	r11, r11
-	beqz	r11, 1f
-	jrp	r12
-
-1:
-	{ move	r10, lr; move	lr, r12 }
 	{
 	 moveli	r11, hw2_last(ftrace_trace_function)
 	 moveli	r13, hw2_last(ftrace_stub)
Acked-by Zhigang Lu on v1 17/27
#30 lore raw

Re: [RFA][PATCH 17/27] tile: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt
Quoted 9 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)"<[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

I forwarded this internally to the guy who did the work at Tilera and he's happy with the change.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
author maintainer
#31 lore raw

Re: [RFA][PATCH 17/27] tile: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 3 Jul 2014 09:53:37 -0400 Chris Metcalf <[email protected]> wrote:
Quoted 5 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)"<[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

Quoted 9 lines
Quoted 4 lines

[ Please test this on your arch ]

I forwarded this internally to the guy who did the work at Tilera and he's happy with the change.

Thanks!

-- Steve

author maintainer
#32 lore raw

PATCH 18/27 sparc64,ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/sparc/Kconfig      |  1 -
 arch/sparc/lib/mcount.S | 10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)
arch/sparc/Kconfig +0 -1
index 29f2e988c56a..abd7d5575a7d 100644
@@ -55,7 +55,6 @@ config SPARC64
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_GRAPH_FP_TEST
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_KRETPROBES
 	select HAVE_KPROBES
 	select HAVE_RCU_TABLE_FREE if SMP
arch/sparc/lib/mcount.S +2 -8
index 3ad6cbdc2163..0b0ed4d34219 100644
@@ -24,10 +24,7 @@ mcount:
 #ifdef CONFIG_DYNAMIC_FTRACE
 	/* Do nothing, the retl/nop below is all we need.  */
 #else
-	sethi		%hi(function_trace_stop), %g1
-	lduw		[%g1 + %lo(function_trace_stop)], %g2
-	brnz,pn		%g2, 2f
-	 sethi		%hi(ftrace_trace_function), %g1
+	sethi		%hi(ftrace_trace_function), %g1
 	sethi		%hi(ftrace_stub), %g2
 	ldx		[%g1 + %lo(ftrace_trace_function)], %g1
 	or		%g2, %lo(ftrace_stub), %g2
@@ -80,11 +77,8 @@ ftrace_stub:
 	.globl		ftrace_caller
 	.type		ftrace_caller,#function
 ftrace_caller:
-	sethi		%hi(function_trace_stop), %g1
 	mov		%i7, %g2
-	lduw		[%g1 + %lo(function_trace_stop)], %g1
-	brnz,pn		%g1, ftrace_stub
-	 mov		%fp, %g3
+	mov		%fp, %g3
 	save		%sp, -176, %sp
 	mov		%g2, %o1
 	mov		%g2, %l0
Signature · 1 line
2.0.0
author maintainer
#33 lore raw

Re: [RFA][PATCH 18/27] sparc64,ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 12:52:39 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 49 lines
---
 arch/sparc/Kconfig      |  1 -
 arch/sparc/lib/mcount.S | 10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)
arch/sparc/Kconfig +0 -1
index 29f2e988c56a..abd7d5575a7d 100644
@@ -55,7 +55,6 @@ config SPARC64
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_GRAPH_FP_TEST
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_KRETPROBES
 	select HAVE_KPROBES
 	select HAVE_RCU_TABLE_FREE if SMP
arch/sparc/lib/mcount.S +2 -8
index 3ad6cbdc2163..0b0ed4d34219 100644
@@ -24,10 +24,7 @@ mcount:
 #ifdef CONFIG_DYNAMIC_FTRACE
 	/* Do nothing, the retl/nop below is all we need.  */
 #else
-	sethi		%hi(function_trace_stop), %g1
-	lduw		[%g1 + %lo(function_trace_stop)], %g2
-	brnz,pn		%g2, 2f
-	 sethi		%hi(ftrace_trace_function), %g1
+	sethi		%hi(ftrace_trace_function), %g1
 	sethi		%hi(ftrace_stub), %g2
 	ldx		[%g1 + %lo(ftrace_trace_function)], %g1
 	or		%g2, %lo(ftrace_stub), %g2
@@ -80,11 +77,8 @@ ftrace_stub:
 	.globl		ftrace_caller
 	.type		ftrace_caller,#function
 ftrace_caller:
-	sethi		%hi(function_trace_stop), %g1
 	mov		%i7, %g2
-	lduw		[%g1 + %lo(function_trace_stop)], %g1
-	brnz,pn		%g1, ftrace_stub
-	 mov		%fp, %g3
+	mov		%fp, %g3
 	save		%sp, -176, %sp
 	mov		%g2, %o1
 	mov		%g2, %l0
author maintainer
#34 lore raw

Re: [RFA][PATCH 18/27] sparc64,ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

David,

Do you have any problem with this patch going through my tree? It compiles, but I do not have any hardware to test it. If you can verify that this patch works and ack it, it would be much appreciated.

This code is at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git

branch: rfc/remove-function-trace-stop

Thanks!

-- Steve

Quoted 55 lines · On Thu, 26 Jun 2014 12:52:39 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/sparc/Kconfig      |  1 -
 arch/sparc/lib/mcount.S | 10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)
arch/sparc/Kconfig +0 -1
index 29f2e988c56a..abd7d5575a7d 100644
@@ -55,7 +55,6 @@ config SPARC64
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_GRAPH_FP_TEST
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_KRETPROBES
 	select HAVE_KPROBES
 	select HAVE_RCU_TABLE_FREE if SMP
arch/sparc/lib/mcount.S +2 -8
index 3ad6cbdc2163..0b0ed4d34219 100644
@@ -24,10 +24,7 @@ mcount:
 #ifdef CONFIG_DYNAMIC_FTRACE
 	/* Do nothing, the retl/nop below is all we need.  */
 #else
-	sethi		%hi(function_trace_stop), %g1
-	lduw		[%g1 + %lo(function_trace_stop)], %g2
-	brnz,pn		%g2, 2f
-	 sethi		%hi(ftrace_trace_function), %g1
+	sethi		%hi(ftrace_trace_function), %g1
 	sethi		%hi(ftrace_stub), %g2
 	ldx		[%g1 + %lo(ftrace_trace_function)], %g1
 	or		%g2, %lo(ftrace_stub), %g2
@@ -80,11 +77,8 @@ ftrace_stub:
 	.globl		ftrace_caller
 	.type		ftrace_caller,#function
 ftrace_caller:
-	sethi		%hi(function_trace_stop), %g1
 	mov		%i7, %g2
-	lduw		[%g1 + %lo(function_trace_stop)], %g1
-	brnz,pn		%g1, ftrace_stub
-	 mov		%fp, %g3
+	mov		%fp, %g3
 	save		%sp, -176, %sp
 	mov		%g2, %o1
 	mov		%g2, %l0
maintainer
#35 lore raw

Re: [RFA][PATCH 18/27] sparc64,ftrace: Remove check of obsolete variable function_trace_stop

From: Steven Rostedt <[email protected]>
Date: Thu, 3 Jul 2014 12:41:46 -0400

Quoted 9 lines

Do you have any problem with this patch going through my tree? It compiles, but I do not have any hardware to test it. If you can verify that this patch works and ack it, it would be much appreciated.

This code is at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git

branch: rfc/remove-function-trace-stop

I can look at this next week at the earliest. But frankly I have no problem if you just merge it as-is now, we can sort out any fallout later.

Thanks.

author maintainer
#36 lore raw

PATCH 19/27 sh: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

Cc Matt Fleming <[email protected]>
Cc Paul Mundt <[email protected]>
---
 arch/sh/Kconfig      |  1 -
 arch/sh/lib/mcount.S | 24 ++----------------------
 2 files changed, 2 insertions(+), 23 deletions(-)
arch/sh/Kconfig +0 -1
index 834b67c4db5a..aa2df3eaeb29 100644
@@ -57,7 +57,6 @@ config SUPERH32
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_DYNAMIC_FTRACE
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select HAVE_FUNCTION_GRAPH_TRACER
arch/sh/lib/mcount.S +2 -22
index 52aa2011d753..7a8572f9d58b 100644
@@ -92,13 +92,6 @@ mcount:
 	rts
 	 nop
 #else
-#ifndef CONFIG_DYNAMIC_FTRACE
-	mov.l	.Lfunction_trace_stop, r0
-	mov.l	@r0, r0
-	tst	r0, r0
-	bf	ftrace_stub
-#endif
-
 	MCOUNT_ENTER()
 
 #ifdef CONFIG_DYNAMIC_FTRACE
@@ -174,11 +167,6 @@ ftrace_graph_call:
 
 	.globl ftrace_caller
 ftrace_caller:
-	mov.l	.Lfunction_trace_stop, r0
-	mov.l	@r0, r0
-	tst	r0, r0
-	bf	ftrace_stub
-
 	MCOUNT_ENTER()
 
 	.globl ftrace_call
@@ -196,8 +184,6 @@ ftrace_call:
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 	.align 2
-.Lfunction_trace_stop:
-	.long	function_trace_stop
 
 /*
  * NOTE: From here on the locations of the .Lftrace_stub label and
@@ -217,12 +203,7 @@ ftrace_stub:
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	.globl	ftrace_graph_caller
 ftrace_graph_caller:
-	mov.l	2f, r0
-	mov.l	@r0, r0
-	tst	r0, r0
-	bt	1f
-
-	mov.l	3f, r1
+	mov.l	2f, r1
 	jmp	@r1
 	 nop
 1:
@@ -242,8 +223,7 @@ ftrace_graph_caller:
 	MCOUNT_LEAVE()
 
 	.align 2
-2:	.long	function_trace_stop
-3:	.long	skip_trace
+2:	.long	skip_trace
 .Lprepare_ftrace_return:
 	.long	prepare_ftrace_return
 
Signature · 1 line
2.0.0
author maintainer
#37 lore raw

Re: [RFA][PATCH 19/27] sh: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 12:52:40 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 84 lines
Cc Matt Fleming <[email protected]>
Cc Paul Mundt <[email protected]>
---
 arch/sh/Kconfig      |  1 -
 arch/sh/lib/mcount.S | 24 ++----------------------
 2 files changed, 2 insertions(+), 23 deletions(-)
arch/sh/Kconfig +0 -1
index 834b67c4db5a..aa2df3eaeb29 100644
@@ -57,7 +57,6 @@ config SUPERH32
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_DYNAMIC_FTRACE
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select HAVE_FUNCTION_GRAPH_TRACER
arch/sh/lib/mcount.S +2 -22
index 52aa2011d753..7a8572f9d58b 100644
@@ -92,13 +92,6 @@ mcount:
 	rts
 	 nop
 #else
-#ifndef CONFIG_DYNAMIC_FTRACE
-	mov.l	.Lfunction_trace_stop, r0
-	mov.l	@r0, r0
-	tst	r0, r0
-	bf	ftrace_stub
-#endif
-
 	MCOUNT_ENTER()
 
 #ifdef CONFIG_DYNAMIC_FTRACE
@@ -174,11 +167,6 @@ ftrace_graph_call:
 
 	.globl ftrace_caller
 ftrace_caller:
-	mov.l	.Lfunction_trace_stop, r0
-	mov.l	@r0, r0
-	tst	r0, r0
-	bf	ftrace_stub
-
 	MCOUNT_ENTER()
 
 	.globl ftrace_call
@@ -196,8 +184,6 @@ ftrace_call:
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 	.align 2
-.Lfunction_trace_stop:
-	.long	function_trace_stop
 
 /*
  * NOTE: From here on the locations of the .Lftrace_stub label and
@@ -217,12 +203,7 @@ ftrace_stub:
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	.globl	ftrace_graph_caller
 ftrace_graph_caller:
-	mov.l	2f, r0
-	mov.l	@r0, r0
-	tst	r0, r0
-	bt	1f
-
-	mov.l	3f, r1
+	mov.l	2f, r1
 	jmp	@r1
 	 nop
 1:
@@ -242,8 +223,7 @@ ftrace_graph_caller:
 	MCOUNT_LEAVE()
 
 	.align 2
-2:	.long	function_trace_stop
-3:	.long	skip_trace
+2:	.long	skip_trace
 .Lprepare_ftrace_return:
 	.long	prepare_ftrace_return
 
author maintainer
#38 lore raw

PATCH 20/27 parisc: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

Cc Helge Deller <[email protected]>
Cc Kyle McMartin <[email protected]>
---
 arch/parisc/Kconfig         | 1 -
 arch/parisc/kernel/ftrace.c | 3 ---
 2 files changed, 4 deletions(-)
arch/parisc/Kconfig +0 -1
index 108d48e652af..6e75e2030927 100644
@@ -6,7 +6,6 @@ config PARISC
 	select HAVE_OPROFILE
 	select HAVE_FUNCTION_TRACER if 64BIT
 	select HAVE_FUNCTION_GRAPH_TRACER if 64BIT
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST if 64BIT
 	select ARCH_WANT_FRAME_POINTERS
 	select RTC_CLASS
 	select RTC_DRV_GENERIC
arch/parisc/kernel/ftrace.c +0 -3
index 5512ab32c5e0..559d400f9385 100644
@@ -155,9 +155,6 @@ void ftrace_function_trampoline(unsigned long parent,
 {
 	extern ftrace_func_t ftrace_trace_function;
 
-	if (function_trace_stop)
-		return;
-
 	if (ftrace_trace_function != ftrace_stub) {
 		ftrace_trace_function(parent, self_addr);
 		return;
Signature · 1 line
2.0.0
author maintainer
#39 lore raw

Re: [RFA][PATCH 20/27] parisc: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 4 lines · On Thu, 26 Jun 2014 12:52:41 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 35 lines
Cc Helge Deller <[email protected]>
Cc Kyle McMartin <[email protected]>
---
 arch/parisc/Kconfig         | 1 -
 arch/parisc/kernel/ftrace.c | 3 ---
 2 files changed, 4 deletions(-)
arch/parisc/Kconfig +0 -1
index 108d48e652af..6e75e2030927 100644
@@ -6,7 +6,6 @@ config PARISC
 	select HAVE_OPROFILE
 	select HAVE_FUNCTION_TRACER if 64BIT
 	select HAVE_FUNCTION_GRAPH_TRACER if 64BIT
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST if 64BIT
 	select ARCH_WANT_FRAME_POINTERS
 	select RTC_CLASS
 	select RTC_DRV_GENERIC
arch/parisc/kernel/ftrace.c +0 -3
index 5512ab32c5e0..559d400f9385 100644
@@ -155,9 +155,6 @@ void ftrace_function_trampoline(unsigned long parent,
 {
 	extern ftrace_func_t ftrace_trace_function;
 
-	if (function_trace_stop)
-		return;
-
 	if (ftrace_trace_function != ftrace_stub) {
 		ftrace_trace_function(parent, self_addr);
 		return;
maintainer Acked-by
#40 lore raw

Re: [RFA][PATCH 20/27] parisc: ftrace: Remove check of obsolete variable function_trace_stop

Hi Steven,

Quoted 31 lines · Steven Rostedt
Quoted 4 lines · On Thu, 26 Jun 2014 12:52:41 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

Quoted 4 lines

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

Sadly the arch-related tracing code in parisc is really broken.
It doesn't even compile cleanly on parisc (at least on 64bit), and as I wrote you in another mail I really need to fix this soon (which I already started on).

But your patches look clean, so to get the basics right, I'm happy to give a

for the two patches which affect parisc, which are:
[PATCH 08/27] parisc: ftrace: Add call to ftrace_graph_is_dead() in function graph code [PATCH 20/27] parisc: ftrace: Remove check of obsolete variable function_trace_stop

It would be good if you can push them through your tree. I assume your tree is:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
with branch ftrace/next.
Is this correct?
If yes, I can build my patches upon this tree...

Thanks!
Helge

author maintainer
#41 lore raw

Re: [RFA][PATCH 20/27] parisc: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 9 lines · On Sun, 29 Jun 2014 23:20:23 +0200 Helge Deller <[email protected]> wrote:

Sadly the arch-related tracing code in parisc is really broken.
It doesn't even compile cleanly on parisc (at least on 64bit), and as I wrote you in another mail I really need to fix this soon (which I already started on).

But your patches look clean, so to get the basics right, I'm happy to give a

for the two patches which affect parisc, which are:
[PATCH 08/27] parisc: ftrace: Add call to ftrace_graph_is_dead() in function graph code [PATCH 20/27] parisc: ftrace: Remove check of obsolete variable function_trace_stop

Thanks!

Quoted 8 lines

It would be good if you can push them through your tree. I assume your tree is:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
with branch ftrace/next.
Is this correct?
If yes, I can build my patches upon this tree...

Actually the patches are in my branch: rfc/remove-function-trace-stop

-- Steve

author maintainer
#42 lore raw

PATCH 21/27 MIPS: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/mips/Kconfig         | 1 -
 arch/mips/kernel/mcount.S | 7 -------
 2 files changed, 8 deletions(-)
arch/mips/Kconfig +0 -1
index 7a469acee33c..9ca52987fcd5 100644
@@ -15,7 +15,6 @@ config MIPS
 	select HAVE_BPF_JIT if !CPU_MICROMIPS
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_C_RECORDMCOUNT
arch/mips/kernel/mcount.S +0 -7
index 539b6294b613..00940d1d5c4f 100644
@@ -74,10 +74,6 @@ _mcount:
 #endif
 
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
-
 	MCOUNT_SAVE_REGS
 #ifdef KBUILD_MCOUNT_RA_ADDRESS
 	PTR_S	MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
@@ -105,9 +101,6 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
Signature · 1 line
2.0.0
author maintainer
#43 lore raw

Re: [RFA][PATCH 21/27] MIPS: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 7 lines · On Thu, 26 Jun 2014 12:52:42 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

Bah! I forgot to add you to the Cc of this email :-p

Anyway,

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 43 lines
---
 arch/mips/Kconfig         | 1 -
 arch/mips/kernel/mcount.S | 7 -------
 2 files changed, 8 deletions(-)
arch/mips/Kconfig +0 -1
index 7a469acee33c..9ca52987fcd5 100644
@@ -15,7 +15,6 @@ config MIPS
 	select HAVE_BPF_JIT if !CPU_MICROMIPS
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_C_RECORDMCOUNT
arch/mips/kernel/mcount.S +0 -7
index 539b6294b613..00940d1d5c4f 100644
@@ -74,10 +74,6 @@ _mcount:
 #endif
 
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
-
 	MCOUNT_SAVE_REGS
 #ifdef KBUILD_MCOUNT_RA_ADDRESS
 	PTR_S	MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
@@ -105,9 +101,6 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
author maintainer
#44 lore raw

Re: [RFA][PATCH 21/27] MIPS: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

Adding [email protected].

-- Steve

Quoted 50 lines · On Thu, 26 Jun 2014 12:52:42 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/mips/Kconfig         | 1 -
 arch/mips/kernel/mcount.S | 7 -------
 2 files changed, 8 deletions(-)
arch/mips/Kconfig +0 -1
index 7a469acee33c..9ca52987fcd5 100644
@@ -15,7 +15,6 @@ config MIPS
 	select HAVE_BPF_JIT if !CPU_MICROMIPS
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_C_RECORDMCOUNT
arch/mips/kernel/mcount.S +0 -7
index 539b6294b613..00940d1d5c4f 100644
@@ -74,10 +74,6 @@ _mcount:
 #endif
 
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
-
 	MCOUNT_SAVE_REGS
 #ifdef KBUILD_MCOUNT_RA_ADDRESS
 	PTR_S	MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
@@ -105,9 +101,6 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
author maintainer
#45 lore raw

Re: [RFA][PATCH 21/27] MIPS: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

Ralf,

Can you please ack this patch.

Thanks,

-- Steve

Quoted 50 lines · On Thu, 26 Jun 2014 12:52:42 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/mips/Kconfig         | 1 -
 arch/mips/kernel/mcount.S | 7 -------
 2 files changed, 8 deletions(-)
arch/mips/Kconfig +0 -1
index 7a469acee33c..9ca52987fcd5 100644
@@ -15,7 +15,6 @@ config MIPS
 	select HAVE_BPF_JIT if !CPU_MICROMIPS
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_C_RECORDMCOUNT
arch/mips/kernel/mcount.S +0 -7
index 539b6294b613..00940d1d5c4f 100644
@@ -74,10 +74,6 @@ _mcount:
 #endif
 
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
-
 	MCOUNT_SAVE_REGS
 #ifdef KBUILD_MCOUNT_RA_ADDRESS
 	PTR_S	MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
@@ -105,9 +101,6 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
author maintainer
#46 lore raw

Re: [RFA][PATCH 21/27] MIPS: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

Ralf,

Can you please test and ack this and patch 7. It would make it better than just pushing it through.

Thanks!

-- Steve

Quoted 50 lines · On Thu, 26 Jun 2014 12:52:42 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/mips/Kconfig         | 1 -
 arch/mips/kernel/mcount.S | 7 -------
 2 files changed, 8 deletions(-)
arch/mips/Kconfig +0 -1
index 7a469acee33c..9ca52987fcd5 100644
@@ -15,7 +15,6 @@ config MIPS
 	select HAVE_BPF_JIT if !CPU_MICROMIPS
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_C_RECORDMCOUNT
arch/mips/kernel/mcount.S +0 -7
index 539b6294b613..00940d1d5c4f 100644
@@ -74,10 +74,6 @@ _mcount:
 #endif
 
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
-
 	MCOUNT_SAVE_REGS
 #ifdef KBUILD_MCOUNT_RA_ADDRESS
 	PTR_S	MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
@@ -105,9 +101,6 @@ ftrace_stub:
 #else	/* ! CONFIG_DYNAMIC_FTRACE */
 
 NESTED(_mcount, PT_SIZE, ra)
-	lw	t1, function_trace_stop
-	bnez	t1, ftrace_stub
-	 nop
 	PTR_LA	t1, ftrace_stub
 	PTR_L	t2, ftrace_trace_function /* Prepare t2 for (1) */
 	bne	t1, t2, static_trace
author maintainer
#47 lore raw

PATCH 22/27 microblaze: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/microblaze/Kconfig         | 1 -
 arch/microblaze/kernel/mcount.S | 5 -----
 2 files changed, 6 deletions(-)
arch/microblaze/Kconfig +0 -1
index 9ae08541e30d..40e1c1dd0e24 100644
@@ -22,7 +22,6 @@ config MICROBLAZE
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUNCTION_TRACER
 	select HAVE_MEMBLOCK
 	select HAVE_MEMBLOCK_NODE_MAP
arch/microblaze/kernel/mcount.S +0 -5
index fc1e1322ce4c..fed9da5de8c4 100644
@@ -91,11 +91,6 @@ ENTRY(ftrace_caller)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 	SAVE_REGS
 	swi	r15, r1, 0;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST begin of checking */
-	lwi	r5, r0, function_trace_stop;
-	bneid	r5, end;
-	nop;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST end of checking */
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #ifndef CONFIG_DYNAMIC_FTRACE
 	lwi	r5, r0, ftrace_graph_return;
Signature · 1 line
2.0.0
author maintainer
#48 lore raw

Re: [RFA][PATCH 22/27] microblaze: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 12:52:43 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 36 lines
---
 arch/microblaze/Kconfig         | 1 -
 arch/microblaze/kernel/mcount.S | 5 -----
 2 files changed, 6 deletions(-)
arch/microblaze/Kconfig +0 -1
index 9ae08541e30d..40e1c1dd0e24 100644
@@ -22,7 +22,6 @@ config MICROBLAZE
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUNCTION_TRACER
 	select HAVE_MEMBLOCK
 	select HAVE_MEMBLOCK_NODE_MAP
arch/microblaze/kernel/mcount.S +0 -5
index fc1e1322ce4c..fed9da5de8c4 100644
@@ -91,11 +91,6 @@ ENTRY(ftrace_caller)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 	SAVE_REGS
 	swi	r15, r1, 0;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST begin of checking */
-	lwi	r5, r0, function_trace_stop;
-	bneid	r5, end;
-	nop;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST end of checking */
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #ifndef CONFIG_DYNAMIC_FTRACE
 	lwi	r5, r0, ftrace_graph_return;
author maintainer
#49 lore raw

Re: [RFA][PATCH 22/27] microblaze: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

Michal,

Can you please ack this patch.

Thanks!

-- Steve

Quoted 42 lines · On Thu, 26 Jun 2014 12:52:43 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/microblaze/Kconfig         | 1 -
 arch/microblaze/kernel/mcount.S | 5 -----
 2 files changed, 6 deletions(-)
arch/microblaze/Kconfig +0 -1
index 9ae08541e30d..40e1c1dd0e24 100644
@@ -22,7 +22,6 @@ config MICROBLAZE
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUNCTION_TRACER
 	select HAVE_MEMBLOCK
 	select HAVE_MEMBLOCK_NODE_MAP
arch/microblaze/kernel/mcount.S +0 -5
index fc1e1322ce4c..fed9da5de8c4 100644
@@ -91,11 +91,6 @@ ENTRY(ftrace_caller)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 	SAVE_REGS
 	swi	r15, r1, 0;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST begin of checking */
-	lwi	r5, r0, function_trace_stop;
-	bneid	r5, end;
-	nop;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST end of checking */
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #ifndef CONFIG_DYNAMIC_FTRACE
 	lwi	r5, r0, ftrace_graph_return;
author maintainer
#50 lore raw

Re: [RFA][PATCH 22/27] microblaze: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

Michal,

Can you please test and ack this and patch 6 of this series. Otherwise I may have to stip it out of the series which will break the build on microblaze.

You can test my branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
rfc/remove-function-trace-stop

-- Steve

Quoted 42 lines · On Thu, 26 Jun 2014 12:52:43 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/microblaze/Kconfig         | 1 -
 arch/microblaze/kernel/mcount.S | 5 -----
 2 files changed, 6 deletions(-)
arch/microblaze/Kconfig +0 -1
index 9ae08541e30d..40e1c1dd0e24 100644
@@ -22,7 +22,6 @@ config MICROBLAZE
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUNCTION_TRACER
 	select HAVE_MEMBLOCK
 	select HAVE_MEMBLOCK_NODE_MAP
arch/microblaze/kernel/mcount.S +0 -5
index fc1e1322ce4c..fed9da5de8c4 100644
@@ -91,11 +91,6 @@ ENTRY(ftrace_caller)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 	SAVE_REGS
 	swi	r15, r1, 0;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST begin of checking */
-	lwi	r5, r0, function_trace_stop;
-	bneid	r5, end;
-	nop;
-	/* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST end of checking */
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #ifndef CONFIG_DYNAMIC_FTRACE
 	lwi	r5, r0, ftrace_graph_return;
maintainer Tested-by
#51 lore raw

Re: [RFA][PATCH 22/27] microblaze: ftrace: Remove check of obsolete variable function_trace_stop

Hi Steve,

Quoted 10 lines · Steven Rostedt

Michal,

Can you please test and ack this and patch 6 of this series. Otherwise I may have to stip it out of the series which will break the build on microblaze.

You can test my branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
rfc/remove-function-trace-stop

I have tested this full branch and there is no issue on Microblaze that's why here is:

Thanks,
Michal

author maintainer
#52 lore raw

PATCH 23/27 metag: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/metag/Kconfig              |  1 -
 arch/metag/kernel/ftrace_stub.S | 14 --------------
 2 files changed, 15 deletions(-)
arch/metag/Kconfig +0 -1
index 499b7610eaaf..0b389a81c43a 100644
@@ -13,7 +13,6 @@ config METAG
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_KERNEL_BZIP2
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZO
arch/metag/kernel/ftrace_stub.S +0 -14
index e70bff745bdd..3acc288217c0 100644
@@ -16,13 +16,6 @@ _mcount_wrapper:
 	.global _ftrace_caller
 	.type	_ftrace_caller,function
 _ftrace_caller:
-	MOVT    D0Re0,#HI(_function_trace_stop)
-	ADD	D0Re0,D0Re0,#LO(_function_trace_stop)
-	GETD	D0Re0,[D0Re0]
-	CMP	D0Re0,#0
-	BEQ	$Lcall_stub
-	MOV	PC,D0.4
-$Lcall_stub:
 	MSETL   [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4
 	MOV     D1Ar1, D0.4
 	MOV     D0Ar2, D1RtP
@@ -42,13 +35,6 @@ _ftrace_call:
 	.global	_mcount_wrapper
 	.type	_mcount_wrapper,function
 _mcount_wrapper:
-	MOVT    D0Re0,#HI(_function_trace_stop)
-	ADD	D0Re0,D0Re0,#LO(_function_trace_stop)
-	GETD	D0Re0,[D0Re0]
-	CMP	D0Re0,#0
-	BEQ	$Lcall_mcount
-	MOV	PC,D0.4
-$Lcall_mcount:
 	MSETL   [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4
 	MOV     D1Ar1, D0.4
 	MOV     D0Ar2, D1RtP
Signature · 1 line
2.0.0
author maintainer
#53 lore raw

Re: [RFA][PATCH 23/27] metag: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 12:52:44 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 52 lines
---
 arch/metag/Kconfig              |  1 -
 arch/metag/kernel/ftrace_stub.S | 14 --------------
 2 files changed, 15 deletions(-)
arch/metag/Kconfig +0 -1
index 499b7610eaaf..0b389a81c43a 100644
@@ -13,7 +13,6 @@ config METAG
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_KERNEL_BZIP2
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZO
arch/metag/kernel/ftrace_stub.S +0 -14
index e70bff745bdd..3acc288217c0 100644
@@ -16,13 +16,6 @@ _mcount_wrapper:
 	.global _ftrace_caller
 	.type	_ftrace_caller,function
 _ftrace_caller:
-	MOVT    D0Re0,#HI(_function_trace_stop)
-	ADD	D0Re0,D0Re0,#LO(_function_trace_stop)
-	GETD	D0Re0,[D0Re0]
-	CMP	D0Re0,#0
-	BEQ	$Lcall_stub
-	MOV	PC,D0.4
-$Lcall_stub:
 	MSETL   [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4
 	MOV     D1Ar1, D0.4
 	MOV     D0Ar2, D1RtP
@@ -42,13 +35,6 @@ _ftrace_call:
 	.global	_mcount_wrapper
 	.type	_mcount_wrapper,function
 _mcount_wrapper:
-	MOVT    D0Re0,#HI(_function_trace_stop)
-	ADD	D0Re0,D0Re0,#LO(_function_trace_stop)
-	GETD	D0Re0,[D0Re0]
-	CMP	D0Re0,#0
-	BEQ	$Lcall_mcount
-	MOV	PC,D0.4
-$Lcall_mcount:
 	MSETL   [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4
 	MOV     D1Ar1, D0.4
 	MOV     D0Ar2, D1RtP
Acked-by
#54 lore raw

Re: [RFA][PATCH 23/27] metag: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 33 lines · Steven Rostedt
Quoted 6 lines · On Thu, 26 Jun 2014 12:52:44 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

Quoted 5 lines

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

This patch is pretty much the inverse of the original patch that added it, so looks good to me (and it didn't seem to break anything).

So, for both this patch and the "ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST" one:

Cheers
James

Quoted 55 lines

-- Steve

Quoted 52 lines
---
 arch/metag/Kconfig              |  1 -
 arch/metag/kernel/ftrace_stub.S | 14 --------------
 2 files changed, 15 deletions(-)
arch/metag/Kconfig +0 -1
index 499b7610eaaf..0b389a81c43a 100644
@@ -13,7 +13,6 @@ config METAG
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_KERNEL_BZIP2
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZO
arch/metag/kernel/ftrace_stub.S +0 -14
index e70bff745bdd..3acc288217c0 100644
@@ -16,13 +16,6 @@ _mcount_wrapper:
 	.global _ftrace_caller
 	.type	_ftrace_caller,function
 _ftrace_caller:
-	MOVT    D0Re0,#HI(_function_trace_stop)
-	ADD	D0Re0,D0Re0,#LO(_function_trace_stop)
-	GETD	D0Re0,[D0Re0]
-	CMP	D0Re0,#0
-	BEQ	$Lcall_stub
-	MOV	PC,D0.4
-$Lcall_stub:
 	MSETL   [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4
 	MOV     D1Ar1, D0.4
 	MOV     D0Ar2, D1RtP
@@ -42,13 +35,6 @@ _ftrace_call:
 	.global	_mcount_wrapper
 	.type	_mcount_wrapper,function
 _mcount_wrapper:
-	MOVT    D0Re0,#HI(_function_trace_stop)
-	ADD	D0Re0,D0Re0,#LO(_function_trace_stop)
-	GETD	D0Re0,[D0Re0]
-	CMP	D0Re0,#0
-	BEQ	$Lcall_mcount
-	MOV	PC,D0.4
-$Lcall_mcount:
 	MSETL   [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4
 	MOV     D1Ar1, D0.4
 	MOV     D0Ar2, D1RtP
author maintainer
#55 lore raw

Re: [RFA][PATCH 23/27] metag: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 7 lines · On Wed, 2 Jul 2014 14:34:07 +0100 James Hogan <[email protected]> wrote:

This patch is pretty much the inverse of the original patch that added it, so looks good to me (and it didn't seem to break anything).

So, for both this patch and the "ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST" one:

Thanks!

-- Steve

author maintainer
#56 lore raw

PATCH 24/27 Blackfin: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

---
 arch/blackfin/Kconfig               |  1 -
 arch/blackfin/kernel/ftrace-entry.S | 18 ------------------
 2 files changed, 19 deletions(-)
arch/blackfin/Kconfig +0 -1
index f81e7b989fff..ed30699cc635 100644
@@ -18,7 +18,6 @@ config BLACKFIN
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_IDE
 	select HAVE_KERNEL_GZIP if RAMKERNEL
 	select HAVE_KERNEL_BZIP2 if RAMKERNEL
arch/blackfin/kernel/ftrace-entry.S +0 -18
index 7eed00bbd26d..28d059540424 100644
@@ -33,15 +33,6 @@ ENDPROC(__mcount)
  * function will be waiting there.  mmmm pie.
  */
 ENTRY(_ftrace_caller)
-# ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	/* optional micro optimization: return if stopped */
-	p1.l = _function_trace_stop;
-	p1.h = _function_trace_stop;
-	r3 = [p1];
-	cc = r3 == 0;
-	if ! cc jump _ftrace_stub (bp);
-# endif
-
 	/* save first/second/third function arg and the return register */
 	[--sp] = r2;
 	[--sp] = r0;
@@ -83,15 +74,6 @@ ENDPROC(_ftrace_caller)
 
 /* See documentation for _ftrace_caller */
 ENTRY(__mcount)
-# ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	/* optional micro optimization: return if stopped */
-	p1.l = _function_trace_stop;
-	p1.h = _function_trace_stop;
-	r3 = [p1];
-	cc = r3 == 0;
-	if ! cc jump _ftrace_stub (bp);
-# endif
-
 	/* save third function arg early so we can do testing below */
 	[--sp] = r2;
 
Signature · 1 line
2.0.0
author maintainer
#57 lore raw

Re: [RFA][PATCH 24/27] Blackfin: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 12:52:45 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 56 lines
---
 arch/blackfin/Kconfig               |  1 -
 arch/blackfin/kernel/ftrace-entry.S | 18 ------------------
 2 files changed, 19 deletions(-)
arch/blackfin/Kconfig +0 -1
index f81e7b989fff..ed30699cc635 100644
@@ -18,7 +18,6 @@ config BLACKFIN
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_IDE
 	select HAVE_KERNEL_GZIP if RAMKERNEL
 	select HAVE_KERNEL_BZIP2 if RAMKERNEL
arch/blackfin/kernel/ftrace-entry.S +0 -18
index 7eed00bbd26d..28d059540424 100644
@@ -33,15 +33,6 @@ ENDPROC(__mcount)
  * function will be waiting there.  mmmm pie.
  */
 ENTRY(_ftrace_caller)
-# ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	/* optional micro optimization: return if stopped */
-	p1.l = _function_trace_stop;
-	p1.h = _function_trace_stop;
-	r3 = [p1];
-	cc = r3 == 0;
-	if ! cc jump _ftrace_stub (bp);
-# endif
-
 	/* save first/second/third function arg and the return register */
 	[--sp] = r2;
 	[--sp] = r0;
@@ -83,15 +74,6 @@ ENDPROC(_ftrace_caller)
 
 /* See documentation for _ftrace_caller */
 ENTRY(__mcount)
-# ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	/* optional micro optimization: return if stopped */
-	p1.l = _function_trace_stop;
-	p1.h = _function_trace_stop;
-	r3 = [p1];
-	cc = r3 == 0;
-	if ! cc jump _ftrace_stub (bp);
-# endif
-
 	/* save third function arg early so we can do testing below */
 	[--sp] = r2;
 
Acked-by on v1 24/27
#58 lore raw

Re: [RFA][PATCH 24/27] Blackfin: ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt
Quoted 6 lines · On Thu 26 Jun 2014 12:52:45 Steven Rostedt wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

[ Please test this on your arch ]

i haven't tested, but the asm looks correct -- it's only using scratch registers, and the rest of the code doesn't rely on the state in that ifdef (by design).

-mike

author maintainer
#59 lore raw

Re: [RFA][PATCH 24/27] Blackfin: ftrace: Remove check of obsolete variable function_trace_stop

Quoted 6 lines · On Thu, 26 Jun 2014 15:25:31 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 5 lines · On Thu 26 Jun 2014 12:52:45 Steven Rostedt wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

Quoted 8 lines
Quoted 1 line

[ Please test this on your arch ]

i haven't tested, but the asm looks correct -- it's only using scratch registers, and the rest of the code doesn't rely on the state in that ifdef (by design).

-mike

Thanks!

-- Steve

author maintainer
#60 lore raw

PATCH 25/27 arm64, ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

arm64 was broken anyway, as it had an ifdef testing
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST which is only set if
the arch supports the code (which it obviously did not), and it was testing a non existent ftrace_trace_stop instead of function_trace_stop.

Cc AKASHI Takahiro <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/entry-ftrace.S | 5 -----
 1 file changed, 5 deletions(-)
arch/arm64/kernel/entry-ftrace.S +0 -5
index b051871f2965..1b1e330e6849 100644
@@ -96,11 +96,6 @@
  *     - ftrace_graph_caller to set up an exit hook
  */
 ENTRY(_mcount)
-#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	ldr	x0, =ftrace_trace_stop
-	ldr	x0, [x0]		// if ftrace_trace_stop
-	ret				//   return;
-#endif
 	mcount_enter
 
 	ldr	x0, =ftrace_trace_function
Signature · 1 line
2.0.0
author maintainer
#61 lore raw

Re: [RFA][PATCH 25/27] arm64, ftrace: Remove check of obsolete variable function_trace_stop

Quoted 10 lines · On Thu, 26 Jun 2014 12:52:46 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

arm64 was broken anyway, as it had an ifdef testing
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST which is only set if
the arch supports the code (which it obviously did not), and it was testing a non existent ftrace_trace_stop instead of function_trace_stop.

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.

-- Steve

Quoted 24 lines
Cc AKASHI Takahiro <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/entry-ftrace.S | 5 -----
 1 file changed, 5 deletions(-)
arch/arm64/kernel/entry-ftrace.S +0 -5
index b051871f2965..1b1e330e6849 100644
@@ -96,11 +96,6 @@
  *     - ftrace_graph_caller to set up an exit hook
  */
 ENTRY(_mcount)
-#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	ldr	x0, =ftrace_trace_stop
-	ldr	x0, [x0]		// if ftrace_trace_stop
-	ret				//   return;
-#endif
 	mcount_enter
 
 	ldr	x0, =ftrace_trace_function
Acked-by on v1 25/27
#62 lore raw

Re: [RFA][PATCH 25/27] arm64, ftrace: Remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

Hi Steve,

Quoted 10 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

arm64 was broken anyway, as it had an ifdef testing
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST which is only set if
the arch supports the code (which it obviously did not), and it was testing a non existent ftrace_trace_stop instead of function_trace_stop.

Yeah, the current code is total crap. Well spotted.

Quoted 6 lines
Cc AKASHI Takahiro <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/entry-ftrace.S | 5 -----
 1 file changed, 5 deletions(-)

I'm happy for you to take this via the ftrace tree, along with the rest of the series.

I successfully ran the ftrace self tests with this applied (on top of "ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST"), but note that I don't have a platform with working suspend/resume right now.

Cheers,

Will

Quoted 21 lines
arch/arm64/kernel/entry-ftrace.S +0 -5
index b051871f2965..1b1e330e6849 100644
@@ -96,11 +96,6 @@
  *     - ftrace_graph_caller to set up an exit hook
  */
 ENTRY(_mcount)
-#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	ldr	x0, =ftrace_trace_stop
-	ldr	x0, [x0]		// if ftrace_trace_stop
-	ret				//   return;
-#endif
 	mcount_enter
 
 	ldr	x0, =ftrace_trace_function
Signature · 1 line
2.0.0
#63 lore raw

Re: [RFA][PATCH 25/27] arm64, ftrace: Remove check of obsolete variable function_trace_stop

Quoted 8 lines · Will Deacon

Hi Steve,

Quoted 5 lines · Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

Nothing sets function_trace_stop to disable function tracing anymore. Remove the check for it in the arch code.

Quoted 7 lines
Quoted 5 lines

arm64 was broken anyway, as it had an ifdef testing
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST which is only set if
the arch supports the code (which it obviously did not), and it was testing a non existent ftrace_trace_stop instead of function_trace_stop.

Yeah, the current code is total crap. Well spotted.

Thank you for fixing my bug :)
I also exercised ftrace with sysfs interface, and it just works well.

-Takahiro AKASHI

Quoted 42 lines
Quoted 7 lines
Cc AKASHI Takahiro <[email protected]>
Cc Will Deacon <[email protected]>
---
  arch/arm64/kernel/entry-ftrace.S | 5 -----
  1 file changed, 5 deletions(-)

I'm happy for you to take this via the ftrace tree, along with the rest of the series.

I successfully ran the ftrace self tests with this applied (on top of "ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST"), but note that I don't have a platform with working suspend/resume right now.

Cheers,

Will

Quoted 21 lines
arch/arm64/kernel/entry-ftrace.S +0 -6
index b051871f2965..1b1e330e6849 100644
@@ -96,11 +96,6 @@
   *     - ftrace_graph_caller to set up an exit hook
   */
  ENTRY(_mcount)
-#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	ldr	x0, =ftrace_trace_stop
-	ldr	x0, [x0]		// if ftrace_trace_stop
-	ret				//   return;
-#endif
  	mcount_enter
 
  	ldr	x0, =ftrace_trace_function
--

2.0.0

author maintainer
#64 lore raw

PATCH 26/27 s390/ftrace: remove check of obsolete variable function_trace_stop

In reply to Steven Rostedt

From: Heiko Carstens <[email protected]>

Remove check of obsolete variable function_trace_stop as requested by Steven Rostedt.

---
 arch/s390/Kconfig           |  1 -
 arch/s390/kernel/mcount.S   | 10 +++-------
 arch/s390/kernel/mcount64.S |  3 ---
 3 files changed, 3 insertions(+), 11 deletions(-)
arch/s390/Kconfig +0 -1
index bb63499fc5d3..f5af5f6ef0f4 100644
@@ -116,7 +116,6 @@ config S390
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_KERNEL_BZIP2
 	select HAVE_KERNEL_GZIP
arch/s390/kernel/mcount.S +3 -7
index 08dcf21cb8df..433c6dbfa442 100644
@@ -21,13 +21,9 @@ ENTRY(_mcount)
 ENTRY(ftrace_caller)
 #endif
 	stm	%r2,%r5,16(%r15)
-	bras	%r1,2f
+	bras	%r1,1f
 0:	.long	ftrace_trace_function
-1:	.long	function_trace_stop
-2:	l	%r2,1b-0b(%r1)
-	icm	%r2,0xf,0(%r2)
-	jnz	3f
-	st	%r14,56(%r15)
+1:	st	%r14,56(%r15)
 	lr	%r0,%r15
 	ahi	%r15,-96
 	l	%r3,100(%r15)
@@ -50,7 +46,7 @@ ENTRY(ftrace_graph_caller)
 #endif
 	ahi	%r15,96
 	l	%r14,56(%r15)
-3:	lm	%r2,%r5,16(%r15)
+	lm	%r2,%r5,16(%r15)
 	br	%r14
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
arch/s390/kernel/mcount64.S +0 -3
index 1c52eae3396a..c67a8bf0fd9a 100644
@@ -20,9 +20,6 @@ ENTRY(_mcount)
 
 ENTRY(ftrace_caller)
 #endif
-	larl	%r1,function_trace_stop
-	icm	%r1,0xf,0(%r1)
-	bnzr	%r14
 	stmg	%r2,%r5,32(%r15)
 	stg	%r14,112(%r15)
 	lgr	%r1,%r15
Signature · 1 line
2.0.0
author maintainer
#65 lore raw

Re: [RFA][PATCH 26/27] s390/ftrace: remove check of obsolete variable function_trace_stop

Quoted 4 lines · On Thu, 26 Jun 2014 12:52:47 -0400 Steven Rostedt <[email protected]> wrote:

From: Heiko Carstens <[email protected]>

Remove check of obsolete variable function_trace_stop as requested by Steven Rostedt.

From the cover letter, you were not Cc'd on.

Anyway, as there is no more reason to set function_trace_stop it is time to remove it. Unfortunately it's in several archs in assembly. Most of the assembly looks rather straight forward and I removed them myself. But I was only able to compile test them (for archs: arm64, metag, and microblaze I do not have my cross tools set up for them and did not even compile test it). But I would really love it if people can download their patch and test it out. You only need the patches that go against your arch and to really test it, also include the patch titled:

ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST

Otherwise your arch patch will call the list op that still does the check. That is, if you want to test suspend and resume on your arch.

As you may see, there are patches to the ftrace infrastructure that depend on the arch patches being implemented. I removed the functionality from the infrastructure, then removed it from the archs, and then finally removed the existence of the function_trace_stop variable, which would cause the archs to fail to compile if that were to go first.

If you can test your arch and give me your acked-by, I would appreciate it. Otherwise, if you need this to go through your tree, I would ask you to set up a dedicated branch that I can pull from to keep this order intact.
---

I know you wrote this patch, but you may want to test it out with the ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST patch applied too.

-- Steve

Quoted 64 lines
---
 arch/s390/Kconfig           |  1 -
 arch/s390/kernel/mcount.S   | 10 +++-------
 arch/s390/kernel/mcount64.S |  3 ---
 3 files changed, 3 insertions(+), 11 deletions(-)
arch/s390/Kconfig +0 -1
index bb63499fc5d3..f5af5f6ef0f4 100644
@@ -116,7 +116,6 @@ config S390
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_TRACER
-	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_KERNEL_BZIP2
 	select HAVE_KERNEL_GZIP
arch/s390/kernel/mcount.S +3 -7
index 08dcf21cb8df..433c6dbfa442 100644
@@ -21,13 +21,9 @@ ENTRY(_mcount)
 ENTRY(ftrace_caller)
 #endif
 	stm	%r2,%r5,16(%r15)
-	bras	%r1,2f
+	bras	%r1,1f
 0:	.long	ftrace_trace_function
-1:	.long	function_trace_stop
-2:	l	%r2,1b-0b(%r1)
-	icm	%r2,0xf,0(%r2)
-	jnz	3f
-	st	%r14,56(%r15)
+1:	st	%r14,56(%r15)
 	lr	%r0,%r15
 	ahi	%r15,-96
 	l	%r3,100(%r15)
@@ -50,7 +46,7 @@ ENTRY(ftrace_graph_caller)
 #endif
 	ahi	%r15,96
 	l	%r14,56(%r15)
-3:	lm	%r2,%r5,16(%r15)
+	lm	%r2,%r5,16(%r15)
 	br	%r14
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
arch/s390/kernel/mcount64.S +0 -3
index 1c52eae3396a..c67a8bf0fd9a 100644
@@ -20,9 +20,6 @@ ENTRY(_mcount)
 
 ENTRY(ftrace_caller)
 #endif
-	larl	%r1,function_trace_stop
-	icm	%r1,0xf,0(%r1)
-	bnzr	%r14
 	stmg	%r2,%r5,32(%r15)
 	stg	%r14,112(%r15)
 	lgr	%r1,%r15
#66 lore raw

Re: [RFA][PATCH 26/27] s390/ftrace: remove check of obsolete variable function_trace_stop

Quoted 4 lines · Steven Rostedt

I know you wrote this patch, but you may want to test it out with the ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST patch applied too.

In order to compile this, I'd have to apply all common code patches, I think. But they don't apply against Linus' master tree and I wouldn't know which tree these patches are against.
But anyway, it all looks good ;)

author maintainer
#67 lore raw

PATCH 27/27 tracing: Remove function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

All users of function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST have been removed. We can safely remove them from the kernel.

---
 include/linux/ftrace.h | 2 --
 kernel/trace/Kconfig   | 5 -----
 kernel/trace/ftrace.c  | 3 ---
 3 files changed, 10 deletions(-)
include/linux/ftrace.h +0 -2
index 7a21d5358b74..ff860dbff75a 100644
@@ -129,8 +129,6 @@ struct ftrace_ops {
 #endif
 };
 
-extern int function_trace_stop;
-
 /*
  * Type of the current tracing.
  */
kernel/trace/Kconfig +0 -5
index d4409356f40d..a5da09c899dd 100644
@@ -29,11 +29,6 @@ config HAVE_FUNCTION_GRAPH_FP_TEST
 	help
 	  See Documentation/trace/ftrace-design.txt
 
-config HAVE_FUNCTION_TRACE_MCOUNT_TEST
-	bool
-	help
-	  See Documentation/trace/ftrace-design.txt
-
 config HAVE_DYNAMIC_FTRACE
 	bool
 	help
kernel/trace/ftrace.c +0 -3
index 34994885bb1d..2241bfbe4fbc 100644
@@ -80,9 +80,6 @@ static struct ftrace_ops ftrace_list_end __read_mostly = {
 int ftrace_enabled __read_mostly;
 static int last_ftrace_enabled;
 
-/* Quick disabling of function tracer. */
-int function_trace_stop __read_mostly;
-
 /* Current function tracing op */
 struct ftrace_ops *function_trace_op __read_mostly = &ftrace_list_end;
 /* What to set function_trace_op to */
Signature · 1 line
2.0.0
#68 lore raw
In reply to Steven Rostedt
Quoted 39 lines · Steven Rostedt

* Request for Acks *

Quoted 1 line

From the time I created the use of function_trace_stop, I hated it.

There was two reasons to create this, one was to try to lower the function tracing overhead when debugfs file tracing_enable was set to zero (note, tracing_enable no longer exists), the other was a way to stop function tracing when going down into suspend and resume.

Some function was causing suspend and resume to reboot the kernel. In debugging this I found that an empty callback from mcount would work. That is, instead of running the tracing code, I would just have the function trace callback be a nop:

void function_trace_call(unsigned long ip, unsigned long parent_ip) {
}

This worked. That means the code in mcount wasn't an issue. I started bisecting the contents of the function_trace_call and found that this would cause the system to reboot!

void function_trace_call(unsigned long ip, unsigned long parent_ip)

 {
	smp_processor_id();

}

That is, just calling smp_processor_id() was enough to trigger a triple fault on resume of the system.

Today, this big hammer approach of disabling the function tracer is starting to show its issues. It can't help out in debugging suspend and resume, and there's other function trace callbacks that should still work.

I also have learned ways to bisect functions that cause bugs in function tracing. I finally got some time to do so with a box that would reboot on suspend and resume. This led me down to a single function:

restore_processor_state()

Quoted 7 lines

This made perfect sense, as this function is called from assembly on a CPU startup. One of the jobs of this function was to set up the GS register. That register is also the register that is used by smp_processor_id() to find what CPU the task is running on. With it not set up it will offset into some random location and fault. As the fault handlers can also be traced, those will fault too and finally the system will reset due to a triple fault.

Uh, from the same reason, I must list it in the kprobe blacklist too...

BTW, as far as I can review, x86 and generic parts of the series seems OK to me. :)

Thank you,

Signature · 4 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]
author maintainer
#69 lore raw
Quoted 1 line · On Mon, 30 Jun 2014 12:13:08 +0900 Masami Hiramatsu…

Uh, from the same reason, I must list it in the kprobe blacklist too...

Ah yes!

Quoted 4 lines

BTW, as far as I can review, x86 and generic parts of the series seems OK to me. :)

Can you post a Acked-by or Reviewed-by then?

Thanks,

-- Steve

Reviewed-by
#70 lore raw
Quoted 5 lines · Steven Rostedt
Quoted 1 line · On Mon, 30 Jun 2014 12:13:08 +0900 Masami Hiramatsu…

Uh, from the same reason, I must list it in the kprobe blacklist too...

Quoted 8 lines

Ah yes!

Quoted 4 lines

BTW, as far as I can review, x86 and generic parts of the series seems OK to me. :)

Can you post a Acked-by or Reviewed-by then?

Yeah, Please feel free to add my Reviewed-by to 1-5, 11-16, and 27 :)

Thank you!

Signature · 4 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]