public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Jiri Olsa <jolsa@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [RFC][PATCH 16/18 v2] rcu/irq/x86: Mark functions that are RCU unsafe
Date: Sat, 31 Aug 2013 01:11:33 -0400	[thread overview]
Message-ID: <20130831051703.080790826@goodmis.org> (raw)
In-Reply-To: 20130831051117.884125230@goodmis.org

[-- Attachment #1: 0016-rcu-irq-x86-Mark-functions-that-are-RCU-unsafe.patch --]
[-- Type: text/plain, Size: 5035 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).

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

Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/apic/apic.c |    2 ++
 arch/x86/kernel/irq.c       |    1 +
 arch/x86/kernel/irq_work.c  |    3 +++
 arch/x86/kernel/smp.c       |    8 ++++++++
 kernel/softirq.c            |    2 ++
 5 files changed, 16 insertions(+)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index eca89c5..91af16b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -931,6 +931,7 @@ void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
 
 	set_irq_regs(old_regs);
 }
+FTRACE_UNSAFE_RCU(smp_apic_timer_interrupt);
 
 void __irq_entry smp_trace_apic_timer_interrupt(struct pt_regs *regs)
 {
@@ -952,6 +953,7 @@ void __irq_entry smp_trace_apic_timer_interrupt(struct pt_regs *regs)
 
 	set_irq_regs(old_regs);
 }
+FTRACE_UNSAFE_RCU(smp_trace_apic_timer_interrupt);
 
 int setup_profiling_timer(unsigned int multiplier)
 {
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 3a8185c..fccd0d1 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -203,6 +203,7 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
 	set_irq_regs(old_regs);
 	return 1;
 }
+FTRACE_UNSAFE_RCU(do_IRQ);
 
 /*
  * Handler for X86_PLATFORM_IPI_VECTOR.
diff --git a/arch/x86/kernel/irq_work.c b/arch/x86/kernel/irq_work.c
index 636a55e..a2199c2 100644
--- a/arch/x86/kernel/irq_work.c
+++ b/arch/x86/kernel/irq_work.c
@@ -7,6 +7,7 @@
 #include <linux/kernel.h>
 #include <linux/irq_work.h>
 #include <linux/hardirq.h>
+#include <linux/ftrace.h>
 #include <asm/apic.h>
 #include <asm/trace/irq_vectors.h>
 
@@ -28,6 +29,7 @@ void smp_irq_work_interrupt(struct pt_regs *regs)
 	__smp_irq_work_interrupt();
 	exiting_irq();
 }
+FTRACE_UNSAFE_RCU(smp_irq_work_interrupt);
 
 void smp_trace_irq_work_interrupt(struct pt_regs *regs)
 {
@@ -37,6 +39,7 @@ void smp_trace_irq_work_interrupt(struct pt_regs *regs)
 	trace_irq_work_exit(IRQ_WORK_VECTOR);
 	exiting_irq();
 }
+FTRACE_UNSAFE_RCU(smp_trace_irq_work_interrupt);
 
 void arch_irq_work_raise(void)
 {
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index cdaa347..3d702ef 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -23,6 +23,7 @@
 #include <linux/interrupt.h>
 #include <linux/cpu.h>
 #include <linux/gfp.h>
+#include <linux/ftrace.h>
 
 #include <asm/mtrr.h>
 #include <asm/tlbflush.h>
@@ -175,6 +176,7 @@ asmlinkage void smp_reboot_interrupt(void)
 	stop_this_cpu(NULL);
 	irq_exit();
 }
+FTRACE_UNSAFE_RCU(smp_reboot_interrupt);
 
 static void native_stop_other_cpus(int wait)
 {
@@ -264,6 +266,7 @@ void smp_reschedule_interrupt(struct pt_regs *regs)
 	 * KVM uses this interrupt to force a cpu out of guest mode
 	 */
 }
+FTRACE_UNSAFE_RCU(smp_reschedule_interrupt);
 
 static inline void smp_entering_irq(void)
 {
@@ -288,6 +291,7 @@ void smp_trace_reschedule_interrupt(struct pt_regs *regs)
 	 * KVM uses this interrupt to force a cpu out of guest mode
 	 */
 }
+FTRACE_UNSAFE_RCU(smp_trace_reschedule_interrupt);
 
 static inline void __smp_call_function_interrupt(void)
 {
@@ -301,6 +305,7 @@ void smp_call_function_interrupt(struct pt_regs *regs)
 	__smp_call_function_interrupt();
 	exiting_irq();
 }
+FTRACE_UNSAFE_RCU(smp_call_function_interrupt);
 
 void smp_trace_call_function_interrupt(struct pt_regs *regs)
 {
@@ -310,6 +315,7 @@ void smp_trace_call_function_interrupt(struct pt_regs *regs)
 	trace_call_function_exit(CALL_FUNCTION_VECTOR);
 	exiting_irq();
 }
+FTRACE_UNSAFE_RCU(smp_trace_call_function_interrupt);
 
 static inline void __smp_call_function_single_interrupt(void)
 {
@@ -323,6 +329,7 @@ void smp_call_function_single_interrupt(struct pt_regs *regs)
 	__smp_call_function_single_interrupt();
 	exiting_irq();
 }
+FTRACE_UNSAFE_RCU(smp_call_function_single_interrupt);
 
 void smp_trace_call_function_single_interrupt(struct pt_regs *regs)
 {
@@ -332,6 +339,7 @@ void smp_trace_call_function_single_interrupt(struct pt_regs *regs)
 	trace_call_function_single_exit(CALL_FUNCTION_SINGLE_VECTOR);
 	exiting_irq();
 }
+FTRACE_UNSAFE_RCU(smp_trace_call_function_single_interrupt);
 
 static int __init nonmi_ipi_setup(char *str)
 {
diff --git a/kernel/softirq.c b/kernel/softirq.c
index be3d351..7960e70 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -325,6 +325,7 @@ void irq_enter(void)
 
 	__irq_enter();
 }
+FTRACE_UNSAFE_RCU(irq_enter);
 
 static inline void invoke_softirq(void)
 {
@@ -367,6 +368,7 @@ void irq_exit(void)
 	tick_irq_exit();
 	rcu_irq_exit();
 }
+FTRACE_UNSAFE_RCU(irq_exit);
 
 /*
  * This function must run with irqs disabled!
-- 
1.7.10.4



  parent reply	other threads:[~2013-08-31  5:17 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-31  5:11 [RFC][PATCH 00/18 v2] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt
2013-08-31  5:11 ` [RFC][PATCH 01/18 v2] ftrace: Add hash list to save RCU unsafe functions Steven Rostedt
2013-08-31 19:28   ` Paul E. McKenney
2013-09-03 21:15   ` Steven Rostedt
2013-09-03 22:18     ` Paul E. McKenney
2013-09-03 23:57       ` Steven Rostedt
2013-09-04  0:18         ` Steven Rostedt
2013-09-04  1:11           ` [RFC][PATCH 19/18] ftrace: Print a message when the rcu checker is disabled Steven Rostedt
2013-09-04  1:25             ` Paul E. McKenney
2013-09-04  1:24         ` [RFC][PATCH 01/18 v2] ftrace: Add hash list to save RCU unsafe functions Paul E. McKenney
2013-09-04  1:51           ` Steven Rostedt
2013-09-04  1:56             ` Steven Rostedt
2013-09-04  2:01           ` Steven Rostedt
2013-09-04  2:03             ` Steven Rostedt
2013-09-04  4:18               ` Paul E. McKenney
2013-09-04 11:50                 ` Steven Rostedt
2013-09-04  4:12             ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 02/18 v2] ftrace: Do not set ftrace records for unsafe RCU when not allowed Steven Rostedt
2013-08-31 19:29   ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 03/18 v2] ftrace: Set ftrace internal function tracing RCU safe Steven Rostedt
2013-08-31 19:30   ` Paul E. McKenney
2013-08-31 19:44   ` Paul E. McKenney
2013-09-03 13:22     ` Steven Rostedt
2013-09-03 13:54       ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 04/18 v2] ftrace: Add test for ops against unsafe RCU functions in callback Steven Rostedt
2013-08-31 19:45   ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 05/18 v2] ftrace: Do not display non safe RCU functions in available_filter_functions Steven Rostedt
2013-08-31 19:46   ` Paul E. McKenney
2013-08-31 20:35     ` Steven Rostedt
2013-08-31 20:54       ` Paul E. McKenney
2013-09-03 13:26         ` Steven Rostedt
2013-09-03 13:54           ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 06/18 v2] ftrace: Add rcu_unsafe_filter_functions file Steven Rostedt
2013-08-31 19:46   ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 07/18 v2] ftrace: Add selftest to check if RCU unsafe functions are filtered properly Steven Rostedt
2013-08-31 19:47   ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 08/18 v2] ftrace/rcu: Do not trace debug_lockdep_rcu_enabled() Steven Rostedt
2013-08-31 19:21   ` Paul E. McKenney
2013-08-31 20:31     ` Steven Rostedt
2013-08-31  5:11 ` [RFC][PATCH 09/18 v2] ftrace: Fix a slight race in modifying what function callback gets traced Steven Rostedt
2013-08-31  5:11 ` [RFC][PATCH 10/18 v2] ftrace: Create a RCU unsafe checker Steven Rostedt
2013-08-31 19:49   ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 11/18 v2] ftrace: Adde infrastructure to stop RCU unsafe checker from checking Steven Rostedt
2013-08-31 19:52   ` Paul E. McKenney
2013-08-31 20:40     ` Steven Rostedt
2013-09-03 13:43     ` Steven Rostedt
2013-09-03 15:22       ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 12/18 v2] ftrace: Disable RCU unsafe checker when function graph is enabled Steven Rostedt
2013-08-31 19:55   ` Paul E. McKenney
2013-08-31 20:42     ` Steven Rostedt
2013-08-31 20:58       ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 13/18 v2] ftrace: Disable the RCU unsafe checker when irqsoff " Steven Rostedt
2013-08-31 19:58   ` Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 14/18 v2] ftrace/lockdep: Have the RCU lockdep splat show what function triggered Steven Rostedt
2013-08-31 19:59   ` Paul E. McKenney
2013-09-05 19:18   ` Peter Zijlstra
2013-09-05 19:52     ` Steven Rostedt
2013-09-06 12:57       ` Ingo Molnar
2013-09-06 13:16         ` Steven Rostedt
2013-09-05 19:35   ` Peter Zijlstra
2013-09-05 20:27     ` Steven Rostedt
2013-08-31  5:11 ` [RFC][PATCH 15/18 v2] ftrace/rcu: Mark functions that are RCU unsafe Steven Rostedt
2013-08-31 20:00   ` Paul E. McKenney
2013-08-31 20:43     ` Steven Rostedt
2013-08-31 20:54       ` Paul E. McKenney
2013-08-31  5:11 ` Steven Rostedt [this message]
2013-08-31 20:01   ` [RFC][PATCH 16/18 v2] rcu/irq/x86: " Paul E. McKenney
2013-08-31  5:11 ` [RFC][PATCH 17/18 v2] ftrace/cpuidle/x86: " Steven Rostedt
2013-08-31 11:07   ` Wysocki, Rafael J
2013-08-31 20:02   ` Paul E. McKenney
2013-09-04  0:16   ` H. Peter Anvin
2013-08-31  5:11 ` [RFC][PATCH 18/18 v2] ftrace/sched: " Steven Rostedt
2013-08-31 20:01   ` Paul E. McKenney
2013-08-31 15:50 ` [RFC][PATCH 00/18 v2] ftrace/rcu: Handle unsafe RCU functions and ftrace callbacks Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130831051703.080790826@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox