]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nmi, tracing: Make hardware latency tracing noinstr safe
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 May 2020 20:05:14 +0000 (22:05 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 11 Jun 2020 13:15:04 +0000 (15:15 +0200)
The hardware latency tracer calls into instrumentable functions. Move the
calls into the RCU watching sections and annotate them.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20200521202116.904176298@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/hardirq.h

index e07cf853aa161aac5a23b79d645e15d1ca1d2f63..29b862aba740db52c647dc12758bcef844bc5b1d 100644 (file)
@@ -87,20 +87,24 @@ extern void rcu_nmi_exit(void);
                arch_nmi_enter();                               \
                printk_nmi_enter();                             \
                lockdep_off();                                  \
-               ftrace_nmi_enter();                             \
                BUG_ON(in_nmi() == NMI_MASK);                   \
                __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET);       \
                rcu_nmi_enter();                                \
                lockdep_hardirq_enter();                        \
+               instrumentation_begin();                        \
+               ftrace_nmi_enter();                             \
+               instrumentation_end();                          \
        } while (0)
 
 #define nmi_exit()                                             \
        do {                                                    \
+               instrumentation_begin();                        \
+               ftrace_nmi_exit();                              \
+               instrumentation_end();                          \
                lockdep_hardirq_exit();                         \
                rcu_nmi_exit();                                 \
                BUG_ON(!in_nmi());                              \
                __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET);       \
-               ftrace_nmi_exit();                              \
                lockdep_on();                                   \
                printk_nmi_exit();                              \
                arch_nmi_exit();                                \