linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks
@ 2013-09-04 14:35 Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 01/18] tracing: Make tracing_cpumask available for all instances Steven Rostedt
                   ` (18 more replies)
  0 siblings, 19 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

This is the latest patches to be queued for 3.12.

A little late, but as Dave Jones has been stumbling over this for a
while, I thought it would be good to get it in now. It's not that
complex to resolve any issues that may pop up.

I'll keep it in linux-next for a while to make sure it really is clean.

Note, the checker will stumble over a few functions in irq and scheduler
code if enabled. This is because those patches have not received Acks
from Thomas Gleixner and Peter Zijlstra. When I get those acks, I'll
add the changes to silent those too.

Thanks to Paul McKenney for reviewing the patches.

Enjoy,

-- Steve

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

Head SHA1: 7fb3a66134ed5a40448131cf4195823d22f70aa3


Alexander Z Lam (1)
      tracing: Make tracing_cpumask available for all instances

Steven Rostedt (Red Hat) (17)
      ftrace: Fix a slight race in modifying what function callback gets traced
      ftrace/rcu: Do not trace debug_lockdep_rcu_enabled()
      ftrace: Add hash list to save RCU unsafe functions
      ftrace: Do not set ftrace records for unsafe RCU when not allowed
      ftrace: Set ftrace internal function tracing RCU safe
      ftrace: Add test for ops against unsafe RCU functions in callback
      ftrace: Do not display non safe RCU functions in available_filter_functions
      ftrace: Add rcu_unsafe_filter_functions file
      ftrace: Add selftest to check if RCU unsafe functions are filtered properly
      ftrace: Create a RCU unsafe checker
      ftrace: Add infrastructure to stop RCU unsafe checker from checking
      ftrace: Disable RCU unsafe checker when function graph is enabled
      ftrace: Disable the RCU unsafe checker when irqsoff is enabled
      ftrace/lockdep: Have the RCU lockdep splat show what function triggered
      ftrace/rcu: Mark functions that are RCU unsafe
      ftrace/cpuidle/x86: Mark functions that are RCU unsafe
      ftrace: Print a message when the rcu checker is disabled

----
 b/arch/x86/kernel/process.c             |    2 
 b/drivers/cpuidle/cpuidle.c             |    2 
 b/include/asm-generic/vmlinux.lds.h     |   10 +
 b/include/linux/ftrace.h                |   38 +++++
 b/kernel/cpu/idle.c                     |    2 
 b/kernel/lockdep.c                      |    2 
 b/kernel/rcupdate.c                     |    2 
 b/kernel/rcutiny.c                      |    1 
 b/kernel/rcutree.c                      |    7 +
 b/kernel/trace/Kconfig                  |   22 +++
 b/kernel/trace/ftrace.c                 |   17 ++
 b/kernel/trace/trace.c                  |   37 ++---
 b/kernel/trace/trace.h                  |    1 
 b/kernel/trace/trace_functions.c        |   48 ++++++-
 b/kernel/trace/trace_irqsoff.c          |   16 ++
 b/kernel/trace/trace_selftest.c         |   94 +++++++++++++
 b/kernel/trace/trace_selftest_dynamic.c |    7 +
 include/linux/ftrace.h                  |    8 +
 kernel/trace/ftrace.c                   |  218 +++++++++++++++++++++++++++++---
 kernel/trace/trace.h                    |   17 ++
 kernel/trace/trace_functions.c          |   40 +++++
 21 files changed, 551 insertions(+), 40 deletions(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [for-next][PATCH 01/18] tracing: Make tracing_cpumask available for all instances
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 02/18] ftrace: Fix a slight race in modifying what function callback gets traced Steven Rostedt
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Vaibhav Nagarnaik,
	David Sharp, Alexander Z Lam, Alexander Z Lam

[-- Attachment #1: 0000-tracing-Make-tracing_cpumask-available-for-all-insta.patch --]
[-- Type: text/plain, Size: 5754 bytes --]

From: Alexander Z Lam <azl@google.com>

Allow tracer instances to disable tracing by cpu by moving
the static global tracing_cpumask into trace_array.

Link: http://lkml.kernel.org/r/921622317f239bfc2283cac2242647801ef584f2.1375980149.git.azl@google.com

Cc: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: David Sharp <dhsharp@google.com>
Cc: Alexander Z Lam <lambchop468@gmail.com>
Signed-off-by: Alexander Z Lam <azl@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |   37 ++++++++++++++++++++-----------------
 kernel/trace/trace.h |    1 +
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 496f94d..7974ba2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3166,11 +3166,6 @@ static const struct file_operations show_traces_fops = {
 };
 
 /*
- * Only trace on a CPU if the bitmask is set:
- */
-static cpumask_var_t tracing_cpumask;
-
-/*
  * The tracer itself will not take this lock, but still we want
  * to provide a consistent cpumask to user-space:
  */
@@ -3186,11 +3181,12 @@ static ssize_t
 tracing_cpumask_read(struct file *filp, char __user *ubuf,
 		     size_t count, loff_t *ppos)
 {
+	struct trace_array *tr = file_inode(filp)->i_private;
 	int len;
 
 	mutex_lock(&tracing_cpumask_update_lock);
 
-	len = cpumask_scnprintf(mask_str, count, tracing_cpumask);
+	len = cpumask_scnprintf(mask_str, count, tr->tracing_cpumask);
 	if (count - len < 2) {
 		count = -EINVAL;
 		goto out_err;
@@ -3208,7 +3204,7 @@ static ssize_t
 tracing_cpumask_write(struct file *filp, const char __user *ubuf,
 		      size_t count, loff_t *ppos)
 {
-	struct trace_array *tr = filp->private_data;
+	struct trace_array *tr = file_inode(filp)->i_private;
 	cpumask_var_t tracing_cpumask_new;
 	int err, cpu;
 
@@ -3228,12 +3224,12 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
 		 * Increase/decrease the disabled counter if we are
 		 * about to flip a bit in the cpumask:
 		 */
-		if (cpumask_test_cpu(cpu, tracing_cpumask) &&
+		if (cpumask_test_cpu(cpu, tr->tracing_cpumask) &&
 				!cpumask_test_cpu(cpu, tracing_cpumask_new)) {
 			atomic_inc(&per_cpu_ptr(tr->trace_buffer.data, cpu)->disabled);
 			ring_buffer_record_disable_cpu(tr->trace_buffer.buffer, cpu);
 		}
-		if (!cpumask_test_cpu(cpu, tracing_cpumask) &&
+		if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) &&
 				cpumask_test_cpu(cpu, tracing_cpumask_new)) {
 			atomic_dec(&per_cpu_ptr(tr->trace_buffer.data, cpu)->disabled);
 			ring_buffer_record_enable_cpu(tr->trace_buffer.buffer, cpu);
@@ -3242,7 +3238,7 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
 	arch_spin_unlock(&ftrace_max_lock);
 	local_irq_enable();
 
-	cpumask_copy(tracing_cpumask, tracing_cpumask_new);
+	cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new);
 
 	mutex_unlock(&tracing_cpumask_update_lock);
 	free_cpumask_var(tracing_cpumask_new);
@@ -3256,9 +3252,10 @@ err_unlock:
 }
 
 static const struct file_operations tracing_cpumask_fops = {
-	.open		= tracing_open_generic,
+	.open		= tracing_open_generic_tr,
 	.read		= tracing_cpumask_read,
 	.write		= tracing_cpumask_write,
+	.release	= tracing_release_generic_tr,
 	.llseek		= generic_file_llseek,
 };
 
@@ -5938,6 +5935,11 @@ static int new_instance_create(const char *name)
 	if (!tr->name)
 		goto out_free_tr;
 
+	if (!alloc_cpumask_var(&tr->tracing_cpumask, GFP_KERNEL))
+		goto out_free_tr;
+
+	cpumask_copy(tr->tracing_cpumask, cpu_all_mask);
+
 	raw_spin_lock_init(&tr->start_lock);
 
 	tr->current_trace = &nop_trace;
@@ -5969,6 +5971,7 @@ static int new_instance_create(const char *name)
  out_free_tr:
 	if (tr->trace_buffer.buffer)
 		ring_buffer_free(tr->trace_buffer.buffer);
+	free_cpumask_var(tr->tracing_cpumask);
 	kfree(tr->name);
 	kfree(tr);
 
@@ -6098,6 +6101,9 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer)
 {
 	int cpu;
 
+	trace_create_file("tracing_cpumask", 0644, d_tracer,
+			  tr, &tracing_cpumask_fops);
+
 	trace_create_file("trace_options", 0644, d_tracer,
 			  tr, &tracing_iter_fops);
 
@@ -6147,9 +6153,6 @@ static __init int tracer_init_debugfs(void)
 
 	init_tracer_debugfs(&global_trace, d_tracer);
 
-	trace_create_file("tracing_cpumask", 0644, d_tracer,
-			&global_trace, &tracing_cpumask_fops);
-
 	trace_create_file("available_tracers", 0444, d_tracer,
 			&global_trace, &show_traces_fops);
 
@@ -6371,7 +6374,7 @@ __init static int tracer_alloc_buffers(void)
 	if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL))
 		goto out;
 
-	if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL))
+	if (!alloc_cpumask_var(&global_trace.tracing_cpumask, GFP_KERNEL))
 		goto out_free_buffer_mask;
 
 	/* Only allocate trace_printk buffers if a trace_printk exists */
@@ -6386,7 +6389,7 @@ __init static int tracer_alloc_buffers(void)
 		ring_buf_size = 1;
 
 	cpumask_copy(tracing_buffer_mask, cpu_possible_mask);
-	cpumask_copy(tracing_cpumask, cpu_all_mask);
+	cpumask_copy(global_trace.tracing_cpumask, cpu_all_mask);
 
 	raw_spin_lock_init(&global_trace.start_lock);
 
@@ -6441,7 +6444,7 @@ out_free_cpumask:
 #ifdef CONFIG_TRACER_MAX_TRACE
 	free_percpu(global_trace.max_buffer.data);
 #endif
-	free_cpumask_var(tracing_cpumask);
+	free_cpumask_var(global_trace.tracing_cpumask);
 out_free_buffer_mask:
 	free_cpumask_var(tracing_buffer_mask);
 out:
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index afaae41..502fed7 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -206,6 +206,7 @@ struct trace_array {
 	struct dentry		*event_dir;
 	struct list_head	systems;
 	struct list_head	events;
+	cpumask_var_t		tracing_cpumask; /* only trace on set CPUs */
 	int			ref;
 };
 
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 02/18] ftrace: Fix a slight race in modifying what function callback gets traced
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 01/18] tracing: Make tracing_cpumask available for all instances Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 03/18] ftrace/rcu: Do not trace debug_lockdep_rcu_enabled() Steven Rostedt
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0001-ftrace-Fix-a-slight-race-in-modifying-what-function-.patch --]
[-- Type: text/plain, Size: 2027 bytes --]

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

There's a slight race when going from a list function to a non list
function. That is, when only one callback is registered to the function
tracer, it gets called directly by the mcount trampoline. But if this
function has filters, it may be called by the wrong functions.

As the list ops callback that handles multiple callbacks that are
registered to ftrace, it also handles what functions they call. While
the transaction is taking place, use the list function always, and
after all the updates are finished (only the functions that should be
traced are being traced), then we can update the trampoline to call
the function directly.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a6d098c..03cf44a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1978,12 +1978,27 @@ int __weak ftrace_arch_code_modify_post_process(void)
 
 void ftrace_modify_all_code(int command)
 {
+	int update = command & FTRACE_UPDATE_TRACE_FUNC;
+
+	/*
+	 * If the ftrace_caller calls a ftrace_ops func directly,
+	 * we need to make sure that it only traces functions it
+	 * expects to trace. When doing the switch of functions,
+	 * we need to update to the ftrace_ops_list_func first
+	 * before the transition between old and new calls are set,
+	 * as the ftrace_ops_list_func will check the ops hashes
+	 * to make sure the ops are having the right functions
+	 * traced.
+	 */
+	if (update)
+		ftrace_update_ftrace_func(ftrace_ops_list_func);
+
 	if (command & FTRACE_UPDATE_CALLS)
 		ftrace_replace_code(1);
 	else if (command & FTRACE_DISABLE_CALLS)
 		ftrace_replace_code(0);
 
-	if (command & FTRACE_UPDATE_TRACE_FUNC)
+	if (update && ftrace_trace_function != ftrace_ops_list_func)
 		ftrace_update_ftrace_func(ftrace_trace_function);
 
 	if (command & FTRACE_START_FUNC_RET)
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 03/18] ftrace/rcu: Do not trace debug_lockdep_rcu_enabled()
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 01/18] tracing: Make tracing_cpumask available for all instances Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 02/18] ftrace: Fix a slight race in modifying what function callback gets traced Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 04/18] ftrace: Add hash list to save RCU unsafe functions Steven Rostedt
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0002-ftrace-rcu-Do-not-trace-debug_lockdep_rcu_enabled.patch --]
[-- Type: text/plain, Size: 1059 bytes --]

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

The function debug_lockdep_rcu_enabled() is part of the RCU lockdep
debugging, and is called very frequently. I found that if I enable
a lot of debugging and run the function graph tracer, this
function can cause a live lock of the system.

We don't usually trace lockdep infrastructure, no need to trace
this either.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/rcupdate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index cce6ba8..4f20c6c 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -122,7 +122,7 @@ struct lockdep_map rcu_sched_lock_map =
 	STATIC_LOCKDEP_MAP_INIT("rcu_read_lock_sched", &rcu_sched_lock_key);
 EXPORT_SYMBOL_GPL(rcu_sched_lock_map);
 
-int debug_lockdep_rcu_enabled(void)
+int notrace debug_lockdep_rcu_enabled(void)
 {
 	return rcu_scheduler_active && debug_locks &&
 	       current->lockdep_recursion == 0;
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 04/18] ftrace: Add hash list to save RCU unsafe functions
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (2 preceding siblings ...)
  2013-09-04 14:35 ` [for-next][PATCH 03/18] ftrace/rcu: Do not trace debug_lockdep_rcu_enabled() Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 05/18] ftrace: Do not set ftrace records for unsafe RCU when not allowed Steven Rostedt
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0003-ftrace-Add-hash-list-to-save-RCU-unsafe-functions.patch --]
[-- Type: text/plain, Size: 8977 bytes --]

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

Some ftrace function tracing callbacks use RCU (perf), thus if
it gets called from tracing a function outside of the RCU tracking,
like in entering or leaving NO_HZ idle/userspace, the RCU read locks
in the callback are useless.

As normal function tracing does not use RCU, and function tracing
happens to help debug RCU, we do not want to limit all callbacks
from tracing these "unsafe" RCU functions. Instead, we create an
infrastructure that will let us mark these unsafe RCU functions
and we will only allow callbacks that explicitly say they do not
use RCU to be called by these functions.

This patch adds the infrastructure to create the hash of functions
that are RCU unsafe. This is done with the FTRACE_UNSAFE_RCU()
macro. It works like EXPORT_SYMBOL() does. Simply place the macro
under the RCU unsafe function:

void func(void)
{
	[...]
}
FTRACE_UNSAFE_RCU(func);

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/asm-generic/vmlinux.lds.h |   10 +++
 include/linux/ftrace.h            |   38 +++++++++++
 kernel/trace/ftrace.c             |  135 ++++++++++++++++++++++++++++++++++---
 3 files changed, 174 insertions(+), 9 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 69732d2..fdfddd2 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -93,6 +93,15 @@
 #define MCOUNT_REC()
 #endif
 
+#ifdef CONFIG_FUNCTION_TRACER
+#define FTRACE_UNSAFE_RCU()	. = ALIGN(8);				\
+			VMLINUX_SYMBOL(__start_ftrace_unsafe_rcu) = .;	\
+			*(_ftrace_unsafe_rcu)				\
+			VMLINUX_SYMBOL(__stop_ftrace_unsafe_rcu) = .;
+#else
+#define FTRACE_UNSAFE_RCU()
+#endif
+
 #ifdef CONFIG_TRACE_BRANCH_PROFILING
 #define LIKELY_PROFILE()	VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
 				*(_ftrace_annotated_branch)			      \
@@ -479,6 +488,7 @@
 	MEM_DISCARD(init.data)						\
 	KERNEL_CTORS()							\
 	MCOUNT_REC()							\
+	FTRACE_UNSAFE_RCU()						\
 	*(.init.rodata)							\
 	FTRACE_EVENTS()							\
 	TRACE_SYSCALLS()						\
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9f15c00..1d17a82 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -92,6 +92,9 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
  * STUB   - The ftrace_ops is just a place holder.
  * INITIALIZED - The ftrace_ops has already been initialized (first use time
  *            register_ftrace_function() is called, it will initialized the ops)
+ * RCU_SAFE - The callback uses no rcu type locking. This allows the
+ *            callback to be called in locations that RCU is not active.
+ *            (like going into or coming out of idle NO_HZ)
  */
 enum {
 	FTRACE_OPS_FL_ENABLED			= 1 << 0,
@@ -103,6 +106,7 @@ enum {
 	FTRACE_OPS_FL_RECURSION_SAFE		= 1 << 6,
 	FTRACE_OPS_FL_STUB			= 1 << 7,
 	FTRACE_OPS_FL_INITIALIZED		= 1 << 8,
+	FTRACE_OPS_FL_RCU_SAFE			= 1 << 9,
 };
 
 struct ftrace_ops {
@@ -219,6 +223,40 @@ static inline int ftrace_function_local_disabled(struct ftrace_ops *ops)
 extern void ftrace_stub(unsigned long a0, unsigned long a1,
 			struct ftrace_ops *op, struct pt_regs *regs);
 
+/*
+ * In order to speed up boot, save both the name and the
+ * address of the function to find to add to hashes. The
+ * list of function mcount addresses are sorted by the address,
+ * but we still need to use the name to find the actual location
+ * as the mcount call is usually not at the address of the
+ * start of the function.
+ */
+struct ftrace_func_finder {
+	const char		*name;
+	unsigned long		ip;
+};
+
+/*
+ * For functions that are called when RCU is not tracking the CPU
+ * (like for entering or leaving NO_HZ mode, and RCU then ignores
+ * the CPU), they need to be marked with FTRACE_UNSAFE_RCU().
+ * This will prevent all function tracing callbacks from calling
+ * this function unless the callback explicitly states that it
+ * doesn't use RCU with the FTRACE_OPS_FL_RCU_SAFE flag.
+ *
+ * The usage of FTRACE_UNSAFE_RCU() is the same as EXPORT_SYMBOL().
+ * Just place the macro underneath the function that is unsafe.
+ */
+#define FTRACE_UNSAFE_RCU(func) \
+	static struct ftrace_func_finder __ftrace_unsafe_rcu_##func	\
+	 __initdata = {							\
+		.name = #func,						\
+		.ip = (unsigned long)func,				\
+	};							\
+	struct ftrace_func_finder *__ftrace_unsafe_rcu_ptr_##func	\
+		  __attribute__((__section__("_ftrace_unsafe_rcu"))) =	\
+		&__ftrace_unsafe_rcu_##func
+
 #else /* !CONFIG_FUNCTION_TRACER */
 /*
  * (un)register_ftrace_function must be a macro since the ops parameter
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 03cf44a..cc63a35 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1356,6 +1356,23 @@ ftrace_hash_rec_disable(struct ftrace_ops *ops, int filter_hash);
 static void
 ftrace_hash_rec_enable(struct ftrace_ops *ops, int filter_hash);
 
+static int ftrace_convert_size_to_bits(int size)
+{
+	int bits = 0;
+
+	/*
+	 * Make the hash size about 1/2 the # found
+	 */
+	for (size /= 2; size; size >>= 1)
+		bits++;
+
+	/* Don't allocate too much */
+	if (bits > FTRACE_HASH_MAX_BITS)
+		bits = FTRACE_HASH_MAX_BITS;
+
+	return bits;
+}
+
 static int
 ftrace_hash_move(struct ftrace_ops *ops, int enable,
 		 struct ftrace_hash **dst, struct ftrace_hash *src)
@@ -1388,15 +1405,7 @@ ftrace_hash_move(struct ftrace_ops *ops, int enable,
 		goto out;
 	}
 
-	/*
-	 * Make the hash size about 1/2 the # found
-	 */
-	for (size /= 2; size; size >>= 1)
-		bits++;
-
-	/* Don't allocate too much */
-	if (bits > FTRACE_HASH_MAX_BITS)
-		bits = FTRACE_HASH_MAX_BITS;
+	bits = ftrace_convert_size_to_bits(size);
 
 	ret = -ENOMEM;
 	new_hash = alloc_ftrace_hash(bits);
@@ -1486,6 +1495,74 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
 	}
 
 
+static __init int ftrace_find_ip(const void *a, const void *b)
+{
+	const struct dyn_ftrace *key = a;
+	const struct dyn_ftrace *rec = b;
+
+	if (key->ip == rec->ip)
+		return 0;
+
+	if (key->ip < rec->ip) {
+		/* If previous is less than, then this is our func */
+		rec--;
+		if (rec->ip < key->ip)
+			return 0;
+		return -1;
+	}
+
+	/* All else, we are greater */
+	return 1;
+}
+
+/*
+ * Find the mcount caller location given the ip address of the
+ * function that contains it. As the mcount caller is usually
+ * after the mcount itself.
+ *
+ * Done for just core functions at boot.
+ */
+static __init unsigned long ftrace_mcount_from_func(unsigned long ip)
+{
+	struct ftrace_page *pg, *last_pg = NULL;
+	struct dyn_ftrace *rec;
+	struct dyn_ftrace key;
+
+	key.ip = ip;
+
+	for (pg = ftrace_pages_start; pg; last_pg = pg, pg = pg->next) {
+		if (ip >= (pg->records[pg->index - 1].ip + MCOUNT_INSN_SIZE))
+			continue;
+
+		/*
+		 * Do the first record manually, as we need to check
+		 * the previous record from the previous page
+		 */
+		if (ip < pg->records[0].ip) {
+			/* First page? Then we found our record! */
+			if (!last_pg)
+				return pg->records[0].ip;
+
+			rec = &last_pg->records[last_pg->index - 1];
+			if (rec->ip < ip)
+				return pg->records[0].ip;
+
+			/* Not found */
+			return 0;
+		}
+
+		rec = bsearch(&key, pg->records + 1, pg->index - 1,
+			      sizeof(struct dyn_ftrace),
+			      ftrace_find_ip);
+		if (rec)
+			return rec->ip;
+
+		break;
+	}
+
+	return 0;
+}
+
 static int ftrace_cmp_recs(const void *a, const void *b)
 {
 	const struct dyn_ftrace *key = a;
@@ -4226,6 +4303,44 @@ struct notifier_block ftrace_module_exit_nb = {
 	.priority = INT_MIN,	/* Run after anything that can remove kprobes */
 };
 
+extern struct ftrace_func_finder *__start_ftrace_unsafe_rcu[];
+extern struct ftrace_func_finder *__stop_ftrace_unsafe_rcu[];
+
+static struct ftrace_hash *ftrace_unsafe_rcu;
+
+static void __init create_unsafe_rcu_hash(void)
+{
+	struct ftrace_func_finder *finder;
+	struct ftrace_func_finder **p;
+	unsigned long ip;
+	char str[KSYM_SYMBOL_LEN];
+	int count;
+
+	count = __stop_ftrace_unsafe_rcu - __start_ftrace_unsafe_rcu;
+	if (!count)
+		return;
+
+	count = ftrace_convert_size_to_bits(count);
+	ftrace_unsafe_rcu = alloc_ftrace_hash(count);
+
+	for (p = __start_ftrace_unsafe_rcu;
+	     p < __stop_ftrace_unsafe_rcu;
+	     p++) {
+		finder = *p;
+
+		ip = ftrace_mcount_from_func(finder->ip);
+		if (WARN_ON_ONCE(!ip))
+			continue;
+
+		/* Make sure this is our ip */
+		kallsyms_lookup(ip, NULL, NULL, NULL, str);
+		if (WARN_ON_ONCE(strcmp(str, finder->name) != 0))
+			continue;
+
+		add_hash_entry(ftrace_unsafe_rcu, ip);
+	}
+}
+
 extern unsigned long __start_mcount_loc[];
 extern unsigned long __stop_mcount_loc[];
 
@@ -4265,6 +4380,8 @@ void __init ftrace_init(void)
 	if (ret)
 		pr_warning("Failed to register trace ftrace module exit notifier\n");
 
+	create_unsafe_rcu_hash();
+
 	set_ftrace_early_filters();
 
 	return;
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 05/18] ftrace: Do not set ftrace records for unsafe RCU when not allowed
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (3 preceding siblings ...)
  2013-09-04 14:35 ` [for-next][PATCH 04/18] ftrace: Add hash list to save RCU unsafe functions Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 06/18] ftrace: Set ftrace internal function tracing RCU safe Steven Rostedt
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0004-ftrace-Do-not-set-ftrace-records-for-unsafe-RCU-when.patch --]
[-- Type: text/plain, Size: 2670 bytes --]

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

For the ftrace_ops that use RCU read locks, and can not be called by
unsafe RCU functions (those outside of RCU tracking), have them not
update the RCU unsafe function records when they are being registered
or unregistered.

The ftrace function records store a counter of all the ftrace_ops
callbacks that are hooked to the function the record represents.
As unsafe RCU functions should not call callbacks that do not specify
that they do not use RCU, do not update those records for ops that
do not specify they are RCU safe.

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index cc63a35..3327aff 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1168,6 +1168,12 @@ static struct ftrace_page *ftrace_new_pgs;
 static struct ftrace_page	*ftrace_pages_start;
 static struct ftrace_page	*ftrace_pages;
 
+/*
+ * Hash of functions that are not safe to be called by
+ * callbacks that use RCU read locks.
+ */
+static struct ftrace_hash *ftrace_unsafe_rcu;
+
 static bool ftrace_hash_empty(struct ftrace_hash *hash)
 {
 	return !hash || !hash->count;
@@ -1638,6 +1644,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 {
 	struct ftrace_hash *hash;
 	struct ftrace_hash *other_hash;
+	struct ftrace_hash *rcu_hash;
 	struct ftrace_page *pg;
 	struct dyn_ftrace *rec;
 	int count = 0;
@@ -1647,6 +1654,12 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 	if (!(ops->flags & FTRACE_OPS_FL_ENABLED))
 		return;
 
+	/* Ignore rcu unsafe functions unless ops handles them */
+	if (ops->flags & FTRACE_OPS_FL_RCU_SAFE)
+		rcu_hash = NULL;
+	else
+		rcu_hash = ftrace_unsafe_rcu;
+
 	/*
 	 * In the filter_hash case:
 	 *   If the count is zero, we update all records.
@@ -1680,6 +1693,10 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 		int in_hash = 0;
 		int match = 0;
 
+		/* Ignore all in the rcu unsafe hash */
+		if (ftrace_lookup_ip(rcu_hash, rec->ip))
+			continue;
+
 		if (all) {
 			/*
 			 * Only the filter_hash affects all records.
@@ -4306,8 +4323,6 @@ struct notifier_block ftrace_module_exit_nb = {
 extern struct ftrace_func_finder *__start_ftrace_unsafe_rcu[];
 extern struct ftrace_func_finder *__stop_ftrace_unsafe_rcu[];
 
-static struct ftrace_hash *ftrace_unsafe_rcu;
-
 static void __init create_unsafe_rcu_hash(void)
 {
 	struct ftrace_func_finder *finder;
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 06/18] ftrace: Set ftrace internal function tracing RCU safe
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (4 preceding siblings ...)
  2013-09-04 14:35 ` [for-next][PATCH 05/18] ftrace: Do not set ftrace records for unsafe RCU when not allowed Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:35 ` [for-next][PATCH 07/18] ftrace: Add test for ops against unsafe RCU functions in callback Steven Rostedt
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0005-ftrace-Set-ftrace-internal-function-tracing-RCU-safe.patch --]
[-- Type: text/plain, Size: 964 bytes --]

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

Since none of the internal ftrace function tracing uses RCU in
their callbacks, it is OK to set the global_ops (the one that
they all use) to RCU safe.

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 3327aff..caeeda24 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1146,7 +1146,9 @@ static struct ftrace_ops global_ops = {
 	.func			= ftrace_stub,
 	.notrace_hash		= EMPTY_HASH,
 	.filter_hash		= EMPTY_HASH,
-	.flags			= FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED,
+	.flags			= FTRACE_OPS_FL_RECURSION_SAFE |
+				  FTRACE_OPS_FL_INITIALIZED |
+				  FTRACE_OPS_FL_RCU_SAFE,
 	INIT_REGEX_LOCK(global_ops)
 };
 
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 07/18] ftrace: Add test for ops against unsafe RCU functions in callback
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (5 preceding siblings ...)
  2013-09-04 14:35 ` [for-next][PATCH 06/18] ftrace: Set ftrace internal function tracing RCU safe Steven Rostedt
@ 2013-09-04 14:35 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 08/18] ftrace: Do not display non safe RCU functions in available_filter_functions Steven Rostedt
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0006-ftrace-Add-test-for-ops-against-unsafe-RCU-functions.patch --]
[-- Type: text/plain, Size: 1644 bytes --]

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

When more than one ftrace_ops is registered, the list function is
used to call all registered functions. It uses the filter and
notrace hashes from the ftrace_ops to determine if the corresponding
callback should be called or not.

Currently, it does not take into account for RCU unsafe functions.
If multiple functions are registered, and an RCU safe callback is
used on a RCU unsafe function, and the RCU unsafe callback says to
trace all functions, it will end up tracing this RCU unsafe function
and still suffer the problems when using RCU when RCU tracing is
off.

Add a test to the multiple ops list function to test if the ops in
question can use an RCU unsafe function or not, and if the function
being traced happens to be an RCU unsafe function.

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index caeeda24..45822de 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1480,7 +1480,9 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
 	if ((ftrace_hash_empty(filter_hash) ||
 	     ftrace_lookup_ip(filter_hash, ip)) &&
 	    (ftrace_hash_empty(notrace_hash) ||
-	     !ftrace_lookup_ip(notrace_hash, ip)))
+	     !ftrace_lookup_ip(notrace_hash, ip)) &&
+	    (ops->flags & FTRACE_OPS_FL_RCU_SAFE ||
+	     !ftrace_lookup_ip(ftrace_unsafe_rcu, ip)))
 		ret = 1;
 	else
 		ret = 0;
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 08/18] ftrace: Do not display non safe RCU functions in available_filter_functions
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (6 preceding siblings ...)
  2013-09-04 14:35 ` [for-next][PATCH 07/18] ftrace: Add test for ops against unsafe RCU functions in callback Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 09/18] ftrace: Add rcu_unsafe_filter_functions file Steven Rostedt
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0007-ftrace-Do-not-display-non-safe-RCU-functions-in-avai.patch --]
[-- Type: text/plain, Size: 1781 bytes --]

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

As available_filter_functions file displays functions that are generally
available for tracing, do not show the ones that are RCU unsafe. Otherwise
it may be confusing for perf users to see these functions in this file but
not be able to trace them.

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/ftrace.h |    1 +
 kernel/trace/ftrace.c  |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 1d17a82..4709264 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -411,6 +411,7 @@ enum {
 	FTRACE_ITER_DO_HASH	= (1 << 3),
 	FTRACE_ITER_HASH	= (1 << 4),
 	FTRACE_ITER_ENABLED	= (1 << 5),
+	FTRACE_ITER_NO_UNSAFE	= (1 << 6),
 };
 
 void arch_ftrace_update_code(int command);
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 45822de..df46e93 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2660,7 +2660,10 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
 		     !ftrace_lookup_ip(ops->notrace_hash, rec->ip)) ||
 
 		    ((iter->flags & FTRACE_ITER_ENABLED) &&
-		     !(rec->flags & FTRACE_FL_ENABLED))) {
+		     !(rec->flags & FTRACE_FL_ENABLED)) ||
+
+		    ((iter->flags & FTRACE_ITER_NO_UNSAFE) &&
+		     ftrace_lookup_ip(ftrace_unsafe_rcu, rec->ip))) {
 
 			rec = NULL;
 			goto retry;
@@ -2788,6 +2791,7 @@ ftrace_avail_open(struct inode *inode, struct file *file)
 	iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
 	if (iter) {
 		iter->pg = ftrace_pages_start;
+		iter->flags = FTRACE_ITER_NO_UNSAFE;
 		iter->ops = &global_ops;
 	}
 
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 09/18] ftrace: Add rcu_unsafe_filter_functions file
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (7 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 08/18] ftrace: Do not display non safe RCU functions in available_filter_functions Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 10/18] ftrace: Add selftest to check if RCU unsafe functions are filtered properly Steven Rostedt
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0008-ftrace-Add-rcu_unsafe_filter_functions-file.patch --]
[-- Type: text/plain, Size: 2865 bytes --]

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

Since the RCU unsafe functions are no longer displayed by the
available_filter_functions, we still need a way to see these
functions in order to trace them. Create a new file that lists
the functions that were declared RCU unsafe.

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/ftrace.h |    1 +
 kernel/trace/ftrace.c  |   31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 4709264..4752764 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -412,6 +412,7 @@ enum {
 	FTRACE_ITER_HASH	= (1 << 4),
 	FTRACE_ITER_ENABLED	= (1 << 5),
 	FTRACE_ITER_NO_UNSAFE	= (1 << 6),
+	FTRACE_ITER_UNSAFE_ONLY	= (1 << 7),
 };
 
 void arch_ftrace_update_code(int command);
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index df46e93..d78f2cb 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2662,6 +2662,9 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
 		    ((iter->flags & FTRACE_ITER_ENABLED) &&
 		     !(rec->flags & FTRACE_FL_ENABLED)) ||
 
+		    ((iter->flags & FTRACE_ITER_UNSAFE_ONLY) &&
+		     !ftrace_lookup_ip(ftrace_unsafe_rcu, rec->ip)) ||
+
 		    ((iter->flags & FTRACE_ITER_NO_UNSAFE) &&
 		     ftrace_lookup_ip(ftrace_unsafe_rcu, rec->ip))) {
 
@@ -2799,6 +2802,24 @@ ftrace_avail_open(struct inode *inode, struct file *file)
 }
 
 static int
+ftrace_rcu_unsafe_open(struct inode *inode, struct file *file)
+{
+	struct ftrace_iterator *iter;
+
+	if (unlikely(ftrace_disabled))
+		return -ENODEV;
+
+	iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
+	if (iter) {
+		iter->pg = ftrace_pages_start;
+		iter->flags = FTRACE_ITER_UNSAFE_ONLY;
+		iter->ops = &global_ops;
+	}
+
+	return iter ? 0 : -ENOMEM;
+}
+
+static int
 ftrace_enabled_open(struct inode *inode, struct file *file)
 {
 	struct ftrace_iterator *iter;
@@ -3850,6 +3871,13 @@ static const struct file_operations ftrace_avail_fops = {
 	.release = seq_release_private,
 };
 
+static const struct file_operations ftrace_rcu_unsafe_fops = {
+	.open = ftrace_rcu_unsafe_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = seq_release_private,
+};
+
 static const struct file_operations ftrace_enabled_fops = {
 	.open = ftrace_enabled_open,
 	.read = seq_read,
@@ -4086,6 +4114,9 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
 	trace_create_file("available_filter_functions", 0444,
 			d_tracer, NULL, &ftrace_avail_fops);
 
+	trace_create_file("rcu_unsafe_filter_functions", 0444,
+			d_tracer, NULL, &ftrace_rcu_unsafe_fops);
+
 	trace_create_file("enabled_functions", 0444,
 			d_tracer, NULL, &ftrace_enabled_fops);
 
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 10/18] ftrace: Add selftest to check if RCU unsafe functions are filtered properly
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (8 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 09/18] ftrace: Add rcu_unsafe_filter_functions file Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 11/18] ftrace: Create a RCU unsafe checker Steven Rostedt
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, Jiri Olsa

[-- Attachment #1: 0009-ftrace-Add-selftest-to-check-if-RCU-unsafe-functions.patch --]
[-- Type: text/plain, Size: 4534 bytes --]

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

Add a boot time start up test that has a RCU safe ftrace_ops as well
as an unsafe one. Make sure the RCU safe ops can trace RCU unsafe
functions while the unsafe ftrace_ops can not.

Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.h                  |    2 +
 kernel/trace/trace_selftest.c         |   94 +++++++++++++++++++++++++++++++++
 kernel/trace/trace_selftest_dynamic.c |    7 +++
 3 files changed, 103 insertions(+)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 502fed7..3578be6 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -648,6 +648,8 @@ extern unsigned long ftrace_update_tot_cnt;
 extern int DYN_FTRACE_TEST_NAME(void);
 #define DYN_FTRACE_TEST_NAME2 trace_selftest_dynamic_test_func2
 extern int DYN_FTRACE_TEST_NAME2(void);
+#define DYN_FTRACE_TEST_RCU_UNSAFE trace_selftest_dynamic_test_rcu_unsafe
+extern int DYN_FTRACE_TEST_RCU_UNSAFE(void);
 
 extern bool ring_buffer_expanded;
 extern bool tracing_selftest_disabled;
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index a7329b7..eeacb47 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -185,6 +185,97 @@ static void reset_counts(void)
 	trace_selftest_test_dyn_cnt = 0;
 }
 
+static struct ftrace_ops ftrace_rcu_safe_ops = {
+	.func		= trace_selftest_test_probe1_func,
+	.flags		= FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_RCU_SAFE,
+};
+
+static struct ftrace_ops ftrace_rcu_unsafe_ops = {
+	.func		= trace_selftest_test_probe2_func,
+	.flags		= FTRACE_OPS_FL_RECURSION_SAFE,
+};
+
+static int test_rcu_safe_unsafe(void)
+{
+	int save_ftrace_enabled = ftrace_enabled;
+	char *func_name;
+	int len;
+	int ret = 0;
+
+	printk(KERN_CONT "PASSED\n");
+	pr_info("Testing ftrace rcu safe unsafe: ");
+
+	ftrace_enabled = 1;
+
+	trace_selftest_test_probe1_cnt = 0;
+	trace_selftest_test_probe2_cnt = 0;
+
+	func_name = "*" __stringify(DYN_FTRACE_TEST_RCU_UNSAFE);
+	len = strlen(func_name);
+
+	ftrace_set_filter(&ftrace_rcu_safe_ops, func_name, len, 1);
+	ftrace_set_filter(&ftrace_rcu_unsafe_ops, func_name, len, 1);
+
+	/* Do single registrations first */
+	register_ftrace_function(&ftrace_rcu_safe_ops);
+
+	DYN_FTRACE_TEST_RCU_UNSAFE();
+
+	unregister_ftrace_function(&ftrace_rcu_safe_ops);
+
+	if (trace_selftest_test_probe1_cnt != 1) {
+		printk(KERN_CONT "rcu_safe expected 1 call but had %d ",
+		       trace_selftest_test_probe1_cnt);
+		goto out;
+	}
+
+	register_ftrace_function(&ftrace_rcu_unsafe_ops);
+
+	DYN_FTRACE_TEST_RCU_UNSAFE();
+
+	unregister_ftrace_function(&ftrace_rcu_unsafe_ops);
+
+	if (trace_selftest_test_probe2_cnt != 0) {
+		printk(KERN_CONT "rcu_safe expected 0 calls but had %d ",
+		       trace_selftest_test_probe2_cnt);
+		goto out;
+	}
+
+	/* Run both together, which uses the list op */
+
+	trace_selftest_test_probe1_cnt = 0;
+	trace_selftest_test_probe2_cnt = 0;
+
+	register_ftrace_function(&ftrace_rcu_safe_ops);
+	register_ftrace_function(&ftrace_rcu_unsafe_ops);
+
+	DYN_FTRACE_TEST_RCU_UNSAFE();
+	DYN_FTRACE_TEST_RCU_UNSAFE();
+	DYN_FTRACE_TEST_RCU_UNSAFE();
+
+	unregister_ftrace_function(&ftrace_rcu_unsafe_ops);
+	unregister_ftrace_function(&ftrace_rcu_safe_ops);
+
+
+	if (trace_selftest_test_probe1_cnt != 3) {
+		printk(KERN_CONT "rcu_safe expected 3 calls but had %d ",
+		       trace_selftest_test_probe1_cnt);
+		goto out;
+	}
+
+	if (trace_selftest_test_probe2_cnt != 0) {
+		printk(KERN_CONT "rcu_safe expected 0 calls but had %d ",
+		       trace_selftest_test_probe2_cnt);
+		goto out;
+	}
+
+	ret = 0;
+ out:
+	ftrace_enabled = save_ftrace_enabled;
+
+	return ret;
+}
+
 static int trace_selftest_ops(int cnt)
 {
 	int save_ftrace_enabled = ftrace_enabled;
@@ -401,6 +492,9 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
 	if (!ret)
 		ret = trace_selftest_ops(2);
 
+	if (!ret)
+		ret = test_rcu_safe_unsafe();
+
 	return ret;
 }
 
diff --git a/kernel/trace/trace_selftest_dynamic.c b/kernel/trace/trace_selftest_dynamic.c
index b4c475a..5eefa56 100644
--- a/kernel/trace/trace_selftest_dynamic.c
+++ b/kernel/trace/trace_selftest_dynamic.c
@@ -11,3 +11,10 @@ int DYN_FTRACE_TEST_NAME2(void)
 	/* used to call mcount */
 	return 0;
 }
+
+int trace_selftest_dynamic_test_rcu_unsafe(void)
+{
+	/* used to call mcount */
+	return 0;
+}
+FTRACE_UNSAFE_RCU(trace_selftest_dynamic_test_rcu_unsafe);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 11/18] ftrace: Create a RCU unsafe checker
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (9 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 10/18] ftrace: Add selftest to check if RCU unsafe functions are filtered properly Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 12/18] ftrace: Add infrastructure to stop RCU unsafe checker from checking Steven Rostedt
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0010-ftrace-Create-a-RCU-unsafe-checker.patch --]
[-- Type: text/plain, Size: 5211 bytes --]

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

Knowing what functions are not safe to be traced by callbacks that use
RCU read locks, is not easy to figure out. By adding a function tracer
callback that is set as a non RCU safe callback that also uses
rcu_read_lock() and enables PROVE_RCU, it can be used to find locations
in the kernel that need to be tagged with FTRACE_UNSAFE_RCU().

On boot up, this callback gets registered so that all functions are
being traced, and there's no way to turn this off. In the future we
can make this enabled or disabled at run time, but for now it's only
used for debugging and should not be enabled by normal users.

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/Kconfig           |   22 ++++++++++++++++++
 kernel/trace/ftrace.c          |   12 ++++++++++
 kernel/trace/trace.h           |    3 +++
 kernel/trace/trace_functions.c |   48 +++++++++++++++++++++++++++++++++++++++-
 4 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 015f85a..907b497 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -489,6 +489,28 @@ config FTRACE_MCOUNT_RECORD
 config FTRACE_SELFTEST
 	bool
 
+config FTRACE_UNSAFE_RCU_CHECKER
+        bool "Trace for unsafe RCU callers"
+	depends on DYNAMIC_FTRACE
+	depends on PROVE_LOCKING
+	select PROVE_RCU
+	help
+	 Some function tracing callbacks use RCU read lock (namely perf).
+	 There are some RCU critical functions that are called out
+	 of scope for RCU. For example, when NO_HZ_FULL is enabled,
+	 and coming out of user space. The CPU is not being tracked by
+	 RCU and all rcu_read_lock()s will be ignored. These functions
+	 need to be tagged as unsafe for RCU so that only function callbacks
+	 that specify that they do not use RCU will be called by them.
+
+	 This option will enable PROVE_RCU and will enable on boot up
+	 a function callback that traces all functions and uses an
+	 rcu_read_lock(). If any function that is not tagged as unsafe
+	 for RCU is called, a debug splat will be shown. This is used
+	 for finding unsafe RCU callers that need to be tagged.
+
+	 If you don't understand any of this, then say N.
+
 config FTRACE_STARTUP_TEST
 	bool "Perform a startup test on ftrace"
 	depends on GENERIC_TRACER
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d78f2cb..9fcf842 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1359,6 +1359,13 @@ alloc_and_copy_ftrace_hash(int size_bits, struct ftrace_hash *hash)
 	return NULL;
 }
 
+#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+bool ftrace_rcu_unsafe(unsigned long addr)
+{
+	return ftrace_lookup_ip(ftrace_unsafe_rcu, addr) != NULL;
+}
+#endif
+
 static void
 ftrace_hash_rec_disable(struct ftrace_ops *ops, int filter_hash);
 static void
@@ -4391,6 +4398,11 @@ static void __init create_unsafe_rcu_hash(void)
 		if (WARN_ON_ONCE(strcmp(str, finder->name) != 0))
 			continue;
 
+#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+		/* When checker is enabled, show what was marked unsafe */
+		pr_info("add ftrace rcu unsafe %p (%s)\n",
+			(void *)ip, finder->name);
+#endif
 		add_hash_entry(ftrace_unsafe_rcu, ip);
 	}
 }
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 3578be6..e551316 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -760,6 +760,9 @@ static inline int ftrace_graph_addr(unsigned long addr)
 
 	return 0;
 }
+#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+extern bool ftrace_rcu_unsafe(unsigned long addr);
+#endif
 #else
 static inline int ftrace_graph_addr(unsigned long addr)
 {
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 38fe148..79641bb 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -559,9 +559,55 @@ static inline int init_func_cmd_traceon(void)
 }
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
+#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+static DEFINE_PER_CPU(int, ftrace_rcu_running);
+
+static void
+ftrace_unsafe_callback(unsigned long ip, unsigned long parent_ip,
+		       struct ftrace_ops *op, struct pt_regs *pt_regs)
+{
+	preempt_disable_notrace();
+
+	if (this_cpu_read(ftrace_rcu_running))
+		goto out;
+
+	if (WARN_ONCE(ftrace_rcu_unsafe(ip),
+		      "UNSAFE RCU function called %pS",
+		      (void *)ip))
+		goto out;
+
+	this_cpu_write(ftrace_rcu_running, 1);
+
+	/* Should trigger a RCU splat if called from unsafe RCU function */
+	rcu_read_lock();
+	rcu_read_unlock();
+
+	this_cpu_write(ftrace_rcu_running, 0);
+ out:
+	preempt_enable_notrace();
+}
+
+static struct ftrace_ops ftrace_unsafe_ops = {
+	.func			= ftrace_unsafe_callback,
+	.flags			= FTRACE_OPS_FL_RECURSION_SAFE
+};
+
+static __init void ftrace_start_unsafe_rcu(void)
+{
+	register_ftrace_function(&ftrace_unsafe_ops);
+}
+#else
+static inline void ftrace_start_unsafe_rcu(void) { }
+#endif
+
 static __init int init_function_trace(void)
 {
+	int ret;
+
 	init_func_cmd_traceon();
-	return register_tracer(&function_trace);
+	ret = register_tracer(&function_trace);
+	if (!ret)
+		ftrace_start_unsafe_rcu();
+	return ret;
 }
 core_initcall(init_function_trace);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 12/18] ftrace: Add infrastructure to stop RCU unsafe checker from checking
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (10 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 11/18] ftrace: Create a RCU unsafe checker Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 13/18] ftrace: Disable RCU unsafe checker when function graph is enabled Steven Rostedt
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0011-ftrace-Add-infrastructure-to-stop-RCU-unsafe-checker.patch --]
[-- Type: text/plain, Size: 3391 bytes --]

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

This is a light weight way to keep the rcu checker from checking
RCU safety. It adds a ftrace_unsafe_rcu_checker_disable/enable()
that increments or decrements a counter respectively. When the
counter is set, the RCU unsafe checker callback does not run the
tests to see if RCU is safe or not. But the callback still gets called.
It just does not call rcu_read_(un)lock().

This is required by the graph tracer because the checks can cause
the graph tracer to live lock the system by its own calls. That is,
the graph tracer will still trace rcu and the rcu debugging, and this
will slow down the checker, which is still calling all other functions
(in interrupts and faults), which can cause the timer interrupt to
take oven a millisecond to complete, and it will then trigger once
it finishes, live locking the system.

It's also needed by the irqsoff tracer, because it may be called
in RCU unsafe regions and if its internal functions get traced
then the RCU unsafe checker may have some false positives.

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.h           |   12 +++++++++---
 kernel/trace/trace_functions.c |   22 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index e551316..58e4c37 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -760,9 +760,6 @@ static inline int ftrace_graph_addr(unsigned long addr)
 
 	return 0;
 }
-#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
-extern bool ftrace_rcu_unsafe(unsigned long addr);
-#endif
 #else
 static inline int ftrace_graph_addr(unsigned long addr)
 {
@@ -1061,4 +1058,13 @@ int perf_ftrace_event_register(struct ftrace_event_call *call,
 #define perf_ftrace_event_register NULL
 #endif
 
+#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+extern bool ftrace_rcu_unsafe(unsigned long addr);
+extern void ftrace_unsafe_rcu_checker_disable(void);
+extern void ftrace_unsafe_rcu_checker_enable(void);
+#else
+static inline void ftrace_unsafe_rcu_checker_disable(void) { }
+static inline void ftrace_unsafe_rcu_checker_enable(void) { }
+#endif
+
 #endif /* _LINUX_KERNEL_TRACE_H */
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 79641bb..9e6902a 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -560,12 +560,34 @@ static inline int init_func_cmd_traceon(void)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 #ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+
 static DEFINE_PER_CPU(int, ftrace_rcu_running);
 
+static atomic_t ftrace_unsafe_rcu_disabled;
+
+void ftrace_unsafe_rcu_checker_disable(void)
+{
+	atomic_inc(&ftrace_unsafe_rcu_disabled);
+	/* Make sure the update is seen immediately */
+	smp_mb__after_atomic_inc();
+}
+
+void ftrace_unsafe_rcu_checker_enable(void)
+{
+	atomic_dec(&ftrace_unsafe_rcu_disabled);
+	/* Make sure the update is seen immediately */
+	smp_mb__after_atomic_dec();
+}
+
 static void
 ftrace_unsafe_callback(unsigned long ip, unsigned long parent_ip,
 		       struct ftrace_ops *op, struct pt_regs *pt_regs)
 {
+	/* Make sure we see disabled or not first */
+	smp_rmb();
+	if (atomic_read(&ftrace_unsafe_rcu_disabled))
+		return;
+
 	preempt_disable_notrace();
 
 	if (this_cpu_read(ftrace_rcu_running))
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 13/18] ftrace: Disable RCU unsafe checker when function graph is enabled
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (11 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 12/18] ftrace: Add infrastructure to stop RCU unsafe checker from checking Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 14/18] ftrace: Disable the RCU unsafe checker when irqsoff " Steven Rostedt
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0012-ftrace-Disable-RCU-unsafe-checker-when-function-grap.patch --]
[-- Type: text/plain, Size: 1468 bytes --]

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

Having the RCU unsafe checker running when function graph is enabled
can cause a live lock. That's because the RCU unsafe checker enables
full lockdep debugging on RCU which does a lot of internal calls that
may be traced by the function graph tracer. This adds quite a bit of
overhead and can possibly live lock the system by causing the timer
interrupt to take longer than 1 HZ.

Just do not do the RCU unsafe checks when function graph tracer is
enabled.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 9fcf842..899c8c1 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5118,6 +5118,12 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 		goto out;
 	}
 
+	/*
+	 * The Unsafe RCU checker can live lock function graph tracing.
+	 * It's best to just disable it while doing the fgraph tracing.
+	 */
+	ftrace_unsafe_rcu_checker_disable();
+
 	ftrace_graph_return = retfunc;
 	ftrace_graph_entry = entryfunc;
 
@@ -5141,6 +5147,7 @@ void unregister_ftrace_graph(void)
 	ftrace_shutdown(&global_ops, FTRACE_STOP_FUNC_RET);
 	unregister_pm_notifier(&ftrace_suspend_notifier);
 	unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
+	ftrace_unsafe_rcu_checker_enable();
 
  out:
 	mutex_unlock(&ftrace_lock);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 14/18] ftrace: Disable the RCU unsafe checker when irqsoff is enabled
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (12 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 13/18] ftrace: Disable RCU unsafe checker when function graph is enabled Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 15/18] ftrace/lockdep: Have the RCU lockdep splat show what function triggered Steven Rostedt
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0013-ftrace-Disable-the-RCU-unsafe-checker-when-irqsoff-i.patch --]
[-- Type: text/plain, Size: 1985 bytes --]

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

The irqsoff tracer can be called during some of the RCU unsafe
regions. The problem is that some of the internal calls that it
makes may also be traced. For example, it uses spin locks. But if
the spin lock gets traced and the RCU unsafe checker runs, it will
trigger that RCU is not safe to use. But the only reason a spin lock
is being used in an RCU unsafe region is because the irqsoff trace
uses it, and causes a false positive.

Disable the unsafe RCU checker when irqsoff is enabled.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_irqsoff.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 2aefbee..62d603c 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -584,9 +584,14 @@ static int start_irqsoff_tracer(struct trace_array *tr, int graph)
 
 	ret = register_irqsoff_function(graph, 0);
 
-	if (!ret && tracing_is_enabled())
+	if (!ret && tracing_is_enabled()) {
+		/*
+		 * irqsoff tracer can cause unsafe rcu checker
+		 * to have false positives.
+		 */
+		ftrace_unsafe_rcu_checker_disable();
 		tracer_enabled = 1;
-	else
+	} else
 		tracer_enabled = 0;
 
 	return ret;
@@ -594,6 +599,9 @@ static int start_irqsoff_tracer(struct trace_array *tr, int graph)
 
 static void stop_irqsoff_tracer(struct trace_array *tr, int graph)
 {
+	if (tracer_enabled)
+		ftrace_unsafe_rcu_checker_enable();
+
 	tracer_enabled = 0;
 
 	unregister_irqsoff_function(graph);
@@ -630,11 +638,15 @@ static void irqsoff_tracer_reset(struct trace_array *tr)
 
 static void irqsoff_tracer_start(struct trace_array *tr)
 {
+	if (!tracer_enabled)
+		ftrace_unsafe_rcu_checker_disable();
 	tracer_enabled = 1;
 }
 
 static void irqsoff_tracer_stop(struct trace_array *tr)
 {
+	if (tracer_enabled)
+		ftrace_unsafe_rcu_checker_enable();
 	tracer_enabled = 0;
 }
 
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 15/18] ftrace/lockdep: Have the RCU lockdep splat show what function triggered
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (13 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 14/18] ftrace: Disable the RCU unsafe checker when irqsoff " Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 16/18] ftrace/rcu: Mark functions that are RCU unsafe Steven Rostedt
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0014-ftrace-lockdep-Have-the-RCU-lockdep-splat-show-what-.patch --]
[-- Type: text/plain, Size: 3009 bytes --]

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

When the RCU lockdep splat hits because of the unsafe RCU checker,
the backtrace does not always show the culprit. But the culprit was
passed to the unsafe RCU checker.

Save the ip of the function being traced in a per_cpu variable, and
when the RCU lockdep detects a problem, it can also print out what
function was being traced if it was caused by the unsafe RCU checker.

Cc:  Peter Zijlstra <peterz@infradead.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/ftrace.h         |    6 ++++++
 kernel/lockdep.c               |    2 ++
 kernel/trace/trace_functions.c |   14 +++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 4752764..3dbb946 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -885,4 +885,10 @@ unsigned long arch_syscall_addr(int nr);
 
 #endif /* CONFIG_FTRACE_SYSCALLS */
 
+#ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
+extern void print_ftrace_rcu_func(int cpu);
+#else
+static inline void print_ftrace_rcu_func(int cpu) { }
+#endif
+
 #endif /* _LINUX_FTRACE_H */
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index e16c45b..74272ed 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -4229,6 +4229,8 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
 				: "",
 	       rcu_scheduler_active, debug_locks);
 
+	print_ftrace_rcu_func(raw_smp_processor_id());
+
 	/*
 	 * If a CPU is in the RCU-free window in idle (ie: in the section
 	 * between rcu_idle_enter() and rcu_idle_exit(), then RCU
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 9e6902a..1dec979 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -562,7 +562,6 @@ static inline int init_func_cmd_traceon(void)
 #ifdef CONFIG_FTRACE_UNSAFE_RCU_CHECKER
 
 static DEFINE_PER_CPU(int, ftrace_rcu_running);
-
 static atomic_t ftrace_unsafe_rcu_disabled;
 
 void ftrace_unsafe_rcu_checker_disable(void)
@@ -579,6 +578,17 @@ void ftrace_unsafe_rcu_checker_enable(void)
 	smp_mb__after_atomic_dec();
 }
 
+static DEFINE_PER_CPU(unsigned long, ftrace_rcu_func);
+
+void print_ftrace_rcu_func(int cpu)
+{
+	unsigned long ip = per_cpu(ftrace_rcu_func, cpu);
+
+	if (ip)
+		printk("ftrace_rcu_func: %pS\n",
+		       (void *)per_cpu(ftrace_rcu_func, cpu));
+}
+
 static void
 ftrace_unsafe_callback(unsigned long ip, unsigned long parent_ip,
 		       struct ftrace_ops *op, struct pt_regs *pt_regs)
@@ -599,10 +609,12 @@ ftrace_unsafe_callback(unsigned long ip, unsigned long parent_ip,
 		goto out;
 
 	this_cpu_write(ftrace_rcu_running, 1);
+	this_cpu_write(ftrace_rcu_func, ip);
 
 	/* Should trigger a RCU splat if called from unsafe RCU function */
 	rcu_read_lock();
 	rcu_read_unlock();
+	this_cpu_write(ftrace_rcu_func, 0);
 
 	this_cpu_write(ftrace_rcu_running, 0);
  out:
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 16/18] ftrace/rcu: Mark functions that are RCU unsafe
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (14 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 15/18] ftrace/lockdep: Have the RCU lockdep splat show what function triggered Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 16:43   ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 17/18] ftrace/cpuidle/x86: " Steven Rostedt
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0015-ftrace-rcu-Mark-functions-that-are-RCU-unsafe.patch --]
[-- Type: text/plain, Size: 2670 bytes --]

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

Some callbacks of the function tracer use rcu_read_lock(). This means that
there's places that can not be traced because RCU is not tracking the CPU
for various reasons (like NO_HZ_FULL and coming back from userspace).

These functions need to be marked so that callbacks that use RCU do not
trace them.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/rcutiny.c |    1 +
 kernel/rcutree.c |    7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index aa34411..911a61c 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -173,6 +173,7 @@ void rcu_irq_enter(void)
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_irq_enter);
+FTRACE_UNSAFE_RCU(rcu_irq_enter);
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 068de3a..ca53562 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -53,6 +53,7 @@
 #include <linux/delay.h>
 #include <linux/stop_machine.h>
 #include <linux/random.h>
+#include <linux/ftrace.h>
 
 #include "rcutree.h"
 #include <trace/events/rcu.h>
@@ -373,6 +374,7 @@ static void rcu_eqs_enter_common(struct rcu_dynticks *rdtp, long long oldval,
 	rcu_lockdep_assert(!lock_is_held(&rcu_sched_lock_map),
 			   "Illegal idle entry in RCU-sched read-side critical section.");
 }
+FTRACE_UNSAFE_RCU(rcu_eqs_enter_common);
 
 /*
  * Enter an RCU extended quiescent state, which can be either the
@@ -392,6 +394,7 @@ static void rcu_eqs_enter(bool user)
 		rdtp->dynticks_nesting -= DYNTICK_TASK_NEST_VALUE;
 	rcu_eqs_enter_common(rdtp, oldval, user);
 }
+FTRACE_UNSAFE_RCU(rcu_eqs_enter);
 
 /**
  * rcu_idle_enter - inform RCU that current CPU is entering idle
@@ -513,6 +516,7 @@ static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval,
 			  idle->pid, idle->comm); /* must be idle task! */
 	}
 }
+FTRACE_UNSAFE_RCU(rcu_eqs_exit_common);
 
 /*
  * Exit an RCU extended quiescent state, which can be either the
@@ -553,6 +557,7 @@ void rcu_idle_exit(void)
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_idle_exit);
+FTRACE_UNSAFE_RCU(rcu_idle_exit);
 
 #ifdef CONFIG_RCU_USER_QS
 /**
@@ -565,6 +570,7 @@ void rcu_user_exit(void)
 {
 	rcu_eqs_exit(1);
 }
+FTRACE_UNSAFE_RCU(rcu_user_exit);
 
 /**
  * rcu_user_exit_after_irq - inform RCU that we won't resume to userspace
@@ -625,6 +631,7 @@ void rcu_irq_enter(void)
 		rcu_eqs_exit_common(rdtp, oldval, true);
 	local_irq_restore(flags);
 }
+FTRACE_UNSAFE_RCU(rcu_irq_enter);
 
 /**
  * rcu_nmi_enter - inform RCU of entry to NMI context
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 17/18] ftrace/cpuidle/x86: Mark functions that are RCU unsafe
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (15 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 16/18] ftrace/rcu: Mark functions that are RCU unsafe Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 14:36 ` [for-next][PATCH 18/18] ftrace: Print a message when the rcu checker is disabled Steven Rostedt
  2013-09-04 18:27 ` [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney, H. Peter Anvin,
	Rafael J. Wysocki

[-- Attachment #1: 0016-ftrace-cpuidle-x86-Mark-functions-that-are-RCU-unsaf.patch --]
[-- Type: text/plain, Size: 2323 bytes --]

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

Some callbacks of the function tracer use rcu_read_lock(). This means that
there's places that can not be traced because RCU is not tracking the CPU
for various reasons (like NO_HZ_FULL and coming back from userspace).

These functions need to be marked so that callbacks that use RCU do not
trace them.

Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/process.c |    2 ++
 drivers/cpuidle/cpuidle.c |    2 ++
 kernel/cpu/idle.c         |    2 ++
 3 files changed, 6 insertions(+)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 83369e5..18739cd 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -17,6 +17,7 @@
 #include <linux/stackprotector.h>
 #include <linux/tick.h>
 #include <linux/cpuidle.h>
+#include <linux/ftrace.h>
 #include <trace/events/power.h>
 #include <linux/hw_breakpoint.h>
 #include <asm/cpu.h>
@@ -316,6 +317,7 @@ void default_idle(void)
 #ifdef CONFIG_APM_MODULE
 EXPORT_SYMBOL(default_idle);
 #endif
+FTRACE_UNSAFE_RCU(default_idle);
 
 #ifdef CONFIG_XEN
 bool xen_set_default_idle(void)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index fdc432f..9515457 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -19,6 +19,7 @@
 #include <linux/ktime.h>
 #include <linux/hrtimer.h>
 #include <linux/module.h>
+#include <linux/ftrace.h>
 #include <trace/events/power.h>
 
 #include "cpuidle.h"
@@ -168,6 +169,7 @@ int cpuidle_idle_call(void)
 
 	return 0;
 }
+FTRACE_UNSAFE_RCU(cpuidle_idle_call);
 
 /**
  * cpuidle_install_idle_handler - installs the cpuidle idle loop handler
diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
index e695c0a..d9d290f 100644
--- a/kernel/cpu/idle.c
+++ b/kernel/cpu/idle.c
@@ -5,6 +5,7 @@
 #include <linux/cpu.h>
 #include <linux/tick.h>
 #include <linux/mm.h>
+#include <linux/ftrace.h>
 #include <linux/stackprotector.h>
 
 #include <asm/tlb.h>
@@ -61,6 +62,7 @@ void __weak arch_cpu_idle(void)
 	cpu_idle_force_poll = 1;
 	local_irq_enable();
 }
+FTRACE_UNSAFE_RCU(arch_cpu_idle);
 
 /*
  * Generic idle loop implementation
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [for-next][PATCH 18/18] ftrace: Print a message when the rcu checker is disabled
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (16 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 17/18] ftrace/cpuidle/x86: " Steven Rostedt
@ 2013-09-04 14:36 ` Steven Rostedt
  2013-09-04 18:27 ` [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Peter Zijlstra,
	Thomas Gleixner, Paul E. McKenney

[-- Attachment #1: 0017-ftrace-Print-a-message-when-the-rcu-checker-is-disab.patch --]
[-- Type: text/plain, Size: 1890 bytes --]

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

Let the user know that the RCU safety checker for function tracing
has been disabled. The checker only runs when the user specifically
configures it in the kernel, and this is done to search for locations
in the kernel that may be unsafe for a function trace callback to
use rcu_read_lock()s. But if things like function graph tracing is
started, which can live lock the machine when the checker is running,
it is disabled. It would be nice if the kernel let the user know that
the checker is disabled, and when it is re-enabled again.

As the checker only gets disabled and re-enabled by user actions
(starting and stoping the function graph tracer or the irqsoff tracer)
it is fine to have a printk display that it is disabled or not.

Suggested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_functions.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 1dec979..57e32e6 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -569,6 +569,8 @@ void ftrace_unsafe_rcu_checker_disable(void)
 	atomic_inc(&ftrace_unsafe_rcu_disabled);
 	/* Make sure the update is seen immediately */
 	smp_mb__after_atomic_inc();
+	pr_info("Disabled FTRACE RCU checker (%pS)\n",
+		__builtin_return_address(0));
 }
 
 void ftrace_unsafe_rcu_checker_enable(void)
@@ -576,6 +578,8 @@ void ftrace_unsafe_rcu_checker_enable(void)
 	atomic_dec(&ftrace_unsafe_rcu_disabled);
 	/* Make sure the update is seen immediately */
 	smp_mb__after_atomic_dec();
+	pr_info("Enabled FTRACE RCU checker (%pS)\n",
+		__builtin_return_address(0));
 }
 
 static DEFINE_PER_CPU(unsigned long, ftrace_rcu_func);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [for-next][PATCH 16/18] ftrace/rcu: Mark functions that are RCU unsafe
  2013-09-04 14:36 ` [for-next][PATCH 16/18] ftrace/rcu: Mark functions that are RCU unsafe Steven Rostedt
@ 2013-09-04 16:43   ` Steven Rostedt
  0 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 16:43 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Ingo Molnar, Frederic Weisbecker, Andrew Morton,
	Peter Zijlstra, Thomas Gleixner, Paul E. McKenney

On Wed, 04 Sep 2013 10:36:08 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> 
> diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
> index aa34411..911a61c 100644
> --- a/kernel/rcutiny.c
> +++ b/kernel/rcutiny.c

Wu's bot discovered that rcutiny.c is missing an include to ftrace.h.

Here's the change I made to this, and will rebase linux-next again to
have this. (Hopefully, Stephen hasn't pulled this branch in yet).

diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 911a61c..abdfe28 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -28,6 +28,7 @@
 #include <linux/rcupdate.h>
 #include <linux/kernel.h>
 #include <linux/export.h>
+#include <linux/ftrace.h>
 #include <linux/mutex.h>
 #include <linux/sched.h>
 #include <linux/types.h>

-- Steve


> @@ -173,6 +173,7 @@ void rcu_irq_enter(void)
>  	local_irq_restore(flags);
>  }
>  EXPORT_SYMBOL_GPL(rcu_irq_enter);
> +FTRACE_UNSAFE_RCU(rcu_irq_enter);
>  
>  #ifdef CONFIG_DEBUG_LOCK_ALLOC
>  
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 068de3a..ca53562 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -53,6 +53,7 @@
>  #include <linux/delay.h>
>  #include <linux/stop_machine.h>
>  #include <linux/random.h>
> +#include <linux/ftrace.h>
>  
>  #include "rcutree.h"
>  #include <trace/events/rcu.h>

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks
  2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
                   ` (17 preceding siblings ...)
  2013-09-04 14:36 ` [for-next][PATCH 18/18] ftrace: Print a message when the rcu checker is disabled Steven Rostedt
@ 2013-09-04 18:27 ` Steven Rostedt
  18 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2013-09-04 18:27 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Ingo Molnar, Frederic Weisbecker, Andrew Morton,
	Peter Zijlstra, Thomas Gleixner, Paul E. McKenney

On Wed, 04 Sep 2013 10:35:52 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> This is the latest patches to be queued for 3.12.
> 
> A little late, but as Dave Jones has been stumbling over this for a
> while, I thought it would be good to get it in now. It's not that
> complex to resolve any issues that may pop up.
> 
> I'll keep it in linux-next for a while to make sure it really is clean.
> 
> Note, the checker will stumble over a few functions in irq and scheduler
> code if enabled. This is because those patches have not received Acks
> from Thomas Gleixner and Peter Zijlstra. When I get those acks, I'll
> add the changes to silent those too.
> 
> Thanks to Paul McKenney for reviewing the patches.
> 
> Enjoy,
> 
> -- Steve
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
> for-next
> 
> Head SHA1: 7fb3a66134ed5a40448131cf4195823d22f70aa3
> 

Wu's autobot has found a few stupid mistakes (nothing big, but should
be cleaned up before pushing to Linus). I reverted this change from my
for-next tree, and I'm pushing to another branch. If I don't get more
updates from Wu's checks by tomorrow, I'll push the updated branch to
for-next again.

-- Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2013-09-04 18:27 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04 14:35 [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 01/18] tracing: Make tracing_cpumask available for all instances Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 02/18] ftrace: Fix a slight race in modifying what function callback gets traced Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 03/18] ftrace/rcu: Do not trace debug_lockdep_rcu_enabled() Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 04/18] ftrace: Add hash list to save RCU unsafe functions Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 05/18] ftrace: Do not set ftrace records for unsafe RCU when not allowed Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 06/18] ftrace: Set ftrace internal function tracing RCU safe Steven Rostedt
2013-09-04 14:35 ` [for-next][PATCH 07/18] ftrace: Add test for ops against unsafe RCU functions in callback Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 08/18] ftrace: Do not display non safe RCU functions in available_filter_functions Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 09/18] ftrace: Add rcu_unsafe_filter_functions file Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 10/18] ftrace: Add selftest to check if RCU unsafe functions are filtered properly Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 11/18] ftrace: Create a RCU unsafe checker Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 12/18] ftrace: Add infrastructure to stop RCU unsafe checker from checking Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 13/18] ftrace: Disable RCU unsafe checker when function graph is enabled Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 14/18] ftrace: Disable the RCU unsafe checker when irqsoff " Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 15/18] ftrace/lockdep: Have the RCU lockdep splat show what function triggered Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 16/18] ftrace/rcu: Mark functions that are RCU unsafe Steven Rostedt
2013-09-04 16:43   ` Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 17/18] ftrace/cpuidle/x86: " Steven Rostedt
2013-09-04 14:36 ` [for-next][PATCH 18/18] ftrace: Print a message when the rcu checker is disabled Steven Rostedt
2013-09-04 18:27 ` [for-next][PATCH 00/18] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).