Skip to content

Commit 48bcda6

Browse files
committed
tracing: Remove definition of trace_*_rcuidle()
The trace_*_rcuidle() variant of a tracepoint was to handle places where a tracepoint was located but RCU was not "watching". All those locations have been removed, and RCU should be watching where all tracepoints are located. We can now remove the trace_*_rcuidle() variant. Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Joel Fernandes <[email protected]> Link: https://lore.kernel.org/[email protected] Acked-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 4a8840a commit 48bcda6

File tree

4 files changed

+8
-78
lines changed

4 files changed

+8
-78
lines changed

include/linux/tracepoint.h

+2-48
Original file line numberDiff line numberDiff line change
@@ -196,67 +196,25 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
196196
#define __DO_TRACE_CALL(name, args) __traceiter_##name(NULL, args)
197197
#endif /* CONFIG_HAVE_STATIC_CALL */
198198

199-
/*
200-
* ARCH_WANTS_NO_INSTR archs are expected to have sanitized entry and idle
201-
* code that disallow any/all tracing/instrumentation when RCU isn't watching.
202-
*/
203-
#ifdef CONFIG_ARCH_WANTS_NO_INSTR
204-
#define RCUIDLE_COND(rcuidle) (rcuidle)
205-
#else
206-
/* srcu can't be used from NMI */
207-
#define RCUIDLE_COND(rcuidle) (rcuidle && in_nmi())
208-
#endif
209-
210199
/*
211200
* it_func[0] is never NULL because there is at least one element in the array
212201
* when the array itself is non NULL.
213202
*/
214-
#define __DO_TRACE(name, args, cond, rcuidle) \
203+
#define __DO_TRACE(name, args, cond) \
215204
do { \
216205
int __maybe_unused __idx = 0; \
217206
\
218207
if (!(cond)) \
219208
return; \
220209
\
221-
if (WARN_ONCE(RCUIDLE_COND(rcuidle), \
222-
"Bad RCU usage for tracepoint")) \
223-
return; \
224-
\
225210
/* keep srcu and sched-rcu usage consistent */ \
226211
preempt_disable_notrace(); \
227212
\
228-
/* \
229-
* For rcuidle callers, use srcu since sched-rcu \
230-
* doesn't work from the idle path. \
231-
*/ \
232-
if (rcuidle) { \
233-
__idx = srcu_read_lock_notrace(&tracepoint_srcu);\
234-
ct_irq_enter_irqson(); \
235-
} \
236-
\
237213
__DO_TRACE_CALL(name, TP_ARGS(args)); \
238214
\
239-
if (rcuidle) { \
240-
ct_irq_exit_irqson(); \
241-
srcu_read_unlock_notrace(&tracepoint_srcu, __idx);\
242-
} \
243-
\
244215
preempt_enable_notrace(); \
245216
} while (0)
246217

247-
#ifndef MODULE
248-
#define __DECLARE_TRACE_RCU(name, proto, args, cond) \
249-
static inline void trace_##name##_rcuidle(proto) \
250-
{ \
251-
if (static_branch_unlikely(&__tracepoint_##name.key)) \
252-
__DO_TRACE(name, \
253-
TP_ARGS(args), \
254-
TP_CONDITION(cond), 1); \
255-
}
256-
#else
257-
#define __DECLARE_TRACE_RCU(name, proto, args, cond)
258-
#endif
259-
260218
/*
261219
* Make sure the alignment of the structure in the __tracepoints section will
262220
* not add unwanted padding between the beginning of the section and the
@@ -277,14 +235,12 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
277235
if (static_branch_unlikely(&__tracepoint_##name.key)) \
278236
__DO_TRACE(name, \
279237
TP_ARGS(args), \
280-
TP_CONDITION(cond), 0); \
238+
TP_CONDITION(cond)); \
281239
if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
282240
WARN_ONCE(!rcu_is_watching(), \
283241
"RCU not watching for tracepoint"); \
284242
} \
285243
} \
286-
__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
287-
PARAMS(cond)) \
288244
static inline int \
289245
register_trace_##name(void (*probe)(data_proto), void *data) \
290246
{ \
@@ -375,8 +331,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
375331
#define __DECLARE_TRACE(name, proto, args, cond, data_proto) \
376332
static inline void trace_##name(proto) \
377333
{ } \
378-
static inline void trace_##name##_rcuidle(proto) \
379-
{ } \
380334
static inline int \
381335
register_trace_##name(void (*probe)(data_proto), \
382336
void *data) \

include/trace/events/preemptirq.h

-8
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ DEFINE_EVENT(preemptirq_template, irq_enable,
4343
#else
4444
#define trace_irq_enable(...)
4545
#define trace_irq_disable(...)
46-
#define trace_irq_enable_rcuidle(...)
47-
#define trace_irq_disable_rcuidle(...)
4846
#endif
4947

5048
#ifdef CONFIG_TRACE_PREEMPT_TOGGLE
@@ -58,8 +56,6 @@ DEFINE_EVENT(preemptirq_template, preempt_enable,
5856
#else
5957
#define trace_preempt_enable(...)
6058
#define trace_preempt_disable(...)
61-
#define trace_preempt_enable_rcuidle(...)
62-
#define trace_preempt_disable_rcuidle(...)
6359
#endif
6460

6561
#endif /* _TRACE_PREEMPTIRQ_H */
@@ -69,10 +65,6 @@ DEFINE_EVENT(preemptirq_template, preempt_enable,
6965
#else /* !CONFIG_PREEMPTIRQ_TRACEPOINTS */
7066
#define trace_irq_enable(...)
7167
#define trace_irq_disable(...)
72-
#define trace_irq_enable_rcuidle(...)
73-
#define trace_irq_disable_rcuidle(...)
7468
#define trace_preempt_enable(...)
7569
#define trace_preempt_disable(...)
76-
#define trace_preempt_enable_rcuidle(...)
77-
#define trace_preempt_disable_rcuidle(...)
7870
#endif

kernel/trace/trace_preemptirq.c

+6-20
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@
1515
#define CREATE_TRACE_POINTS
1616
#include <trace/events/preemptirq.h>
1717

18-
/*
19-
* Use regular trace points on architectures that implement noinstr
20-
* tooling: these calls will only happen with RCU enabled, which can
21-
* use a regular tracepoint.
22-
*
23-
* On older architectures, use the rcuidle tracing methods (which
24-
* aren't NMI-safe - so exclude NMI contexts):
25-
*/
26-
#ifdef CONFIG_ARCH_WANTS_NO_INSTR
27-
#define trace(point) trace_##point
28-
#else
29-
#define trace(point) if (!in_nmi()) trace_##point##_rcuidle
30-
#endif
31-
3218
#ifdef CONFIG_TRACE_IRQFLAGS
3319
/* Per-cpu variable to prevent redundant calls when IRQs already off */
3420
static DEFINE_PER_CPU(int, tracing_irq_cpu);
@@ -42,7 +28,7 @@ static DEFINE_PER_CPU(int, tracing_irq_cpu);
4228
void trace_hardirqs_on_prepare(void)
4329
{
4430
if (this_cpu_read(tracing_irq_cpu)) {
45-
trace(irq_enable)(CALLER_ADDR0, CALLER_ADDR1);
31+
trace_irq_enable(CALLER_ADDR0, CALLER_ADDR1);
4632
tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
4733
this_cpu_write(tracing_irq_cpu, 0);
4834
}
@@ -53,7 +39,7 @@ NOKPROBE_SYMBOL(trace_hardirqs_on_prepare);
5339
void trace_hardirqs_on(void)
5440
{
5541
if (this_cpu_read(tracing_irq_cpu)) {
56-
trace(irq_enable)(CALLER_ADDR0, CALLER_ADDR1);
42+
trace_irq_enable(CALLER_ADDR0, CALLER_ADDR1);
5743
tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
5844
this_cpu_write(tracing_irq_cpu, 0);
5945
}
@@ -75,7 +61,7 @@ void trace_hardirqs_off_finish(void)
7561
if (!this_cpu_read(tracing_irq_cpu)) {
7662
this_cpu_write(tracing_irq_cpu, 1);
7763
tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
78-
trace(irq_disable)(CALLER_ADDR0, CALLER_ADDR1);
64+
trace_irq_disable(CALLER_ADDR0, CALLER_ADDR1);
7965
}
8066

8167
}
@@ -89,7 +75,7 @@ void trace_hardirqs_off(void)
8975
if (!this_cpu_read(tracing_irq_cpu)) {
9076
this_cpu_write(tracing_irq_cpu, 1);
9177
tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
92-
trace(irq_disable)(CALLER_ADDR0, CALLER_ADDR1);
78+
trace_irq_disable(CALLER_ADDR0, CALLER_ADDR1);
9379
}
9480
}
9581
EXPORT_SYMBOL(trace_hardirqs_off);
@@ -100,13 +86,13 @@ NOKPROBE_SYMBOL(trace_hardirqs_off);
10086

10187
void trace_preempt_on(unsigned long a0, unsigned long a1)
10288
{
103-
trace(preempt_enable)(a0, a1);
89+
trace_preempt_enable(a0, a1);
10490
tracer_preempt_on(a0, a1);
10591
}
10692

10793
void trace_preempt_off(unsigned long a0, unsigned long a1)
10894
{
109-
trace(preempt_disable)(a0, a1);
95+
trace_preempt_disable(a0, a1);
11096
tracer_preempt_off(a0, a1);
11197
}
11298
#endif

scripts/tags.sh

-2
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ regex_c=(
152152
'/^BPF_CALL_[0-9]([[:space:]]*\([[:alnum:]_]*\).*/\1/'
153153
'/^COMPAT_SYSCALL_DEFINE[0-9]([[:space:]]*\([[:alnum:]_]*\).*/compat_sys_\1/'
154154
'/^TRACE_EVENT([[:space:]]*\([[:alnum:]_]*\).*/trace_\1/'
155-
'/^TRACE_EVENT([[:space:]]*\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
156155
'/^DEFINE_EVENT([^,)]*,[[:space:]]*\([[:alnum:]_]*\).*/trace_\1/'
157-
'/^DEFINE_EVENT([^,)]*,[[:space:]]*\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
158156
'/^DEFINE_INSN_CACHE_OPS([[:space:]]*\([[:alnum:]_]*\).*/get_\1_slot/'
159157
'/^DEFINE_INSN_CACHE_OPS([[:space:]]*\([[:alnum:]_]*\).*/free_\1_slot/'
160158
'/^PAGEFLAG([[:space:]]*\([[:alnum:]_]*\).*/Page\1/'

0 commit comments

Comments
 (0)