The following commit has been merged into the x86/entry branch of tip:

Commit-ID:     1e826b1d2265d1e8ba5f51827a8dba2aa0295f6c
Gitweb:        
https://git.kernel.org/tip/1e826b1d2265d1e8ba5f51827a8dba2aa0295f6c
Author:        Thomas Gleixner <[email protected]>
AuthorDate:    Thu, 21 May 2020 22:05:14 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Tue, 26 May 2020 19:06:27 +02:00

nmi, tracing: Make hardware latency tracing noinstr safe

The hardware latency tracer calls into instrumentable functions. Move the
calls into the RCU watching sections and annotate them.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Acked-by: Andy Lutomirski <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
 include/linux/hardirq.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index e07cf85..29b862a 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -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();                                \

Reply via email to