Switch from classic RCU to preemptible RCU.

This requires to change the guard in the __do_trace_ macro and account
for it in trace_event_buffer_reserve() where the preemption counter is
substracted. This is then no longer needed.

Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
 include/linux/tracepoint.h  | 2 +-
 kernel/trace/trace_events.c | 8 +-------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 826ce3f8e1f85..15f851a1de55d 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -271,7 +271,7 @@ static inline struct tracepoint 
*tracepoint_ptr_deref(tracepoint_ptr_t *p)
        static inline void __do_trace_##name(proto)                     \
        {                                                               \
                if (cond) {                                             \
-                       guard(preempt_notrace)();                       \
+                       guard(rcu_notrace)();                           \
                        __DO_TRACE_CALL(name, TP_ARGS(args));           \
                }                                                       \
        }                                                               \
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 120531268abff..76ea1cf9f4d65 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -659,13 +659,7 @@ void *trace_event_buffer_reserve(struct trace_event_buffer 
*fbuffer,
            trace_event_ignore_this_pid(trace_file))
                return NULL;
 
-       /*
-        * If CONFIG_PREEMPTION is enabled, then the tracepoint itself disables
-        * preemption (adding one to the preempt_count). Since we are
-        * interested in the preempt_count at the time the tracepoint was
-        * hit, we need to subtract one to offset the increment.
-        */
-       fbuffer->trace_ctx = tracing_gen_ctx_dec();
+       fbuffer->trace_ctx = tracing_gen_ctx();
        fbuffer->trace_file = trace_file;
 
        fbuffer->event =
-- 
2.49.0


Reply via email to