Re: [RFC][PATCH 16/18 v2] rcu/irq/x86: Mark functions that are RCUunsafe
From: Paul E. McKenney
Date: Sat Aug 31 2013 - 16:01:42 EST
On Sat, Aug 31, 2013 at 01:11:33AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
>
> 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@xxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> ---
> 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
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/