Skip to content

Commit e53244e

Browse files
committed
tracepoint: Remove SRCU protection
With the removal of the trace_*_rcuidle() tracepoints, there is no reason to protect tracepoints with SRCU. The reason the SRCU protection was added, was because it can protect tracepoints when RCU is not "watching". Now that tracepoints are only used when RCU is watching, remove the SRCU protection. It just made things more complex and confusing anyway. Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[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 48bcda6 commit e53244e

File tree

2 files changed

+1
-54
lines changed

2 files changed

+1
-54
lines changed

include/linux/tracepoint.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ struct trace_eval_map {
3232

3333
#define TRACEPOINT_DEFAULT_PRIO 10
3434

35-
extern struct srcu_struct tracepoint_srcu;
36-
3735
extern int
3836
tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
3937
extern int
@@ -109,7 +107,6 @@ void for_each_tracepoint_in_module(struct module *mod,
109107
#ifdef CONFIG_TRACEPOINTS
110108
static inline void tracepoint_synchronize_unregister(void)
111109
{
112-
synchronize_srcu(&tracepoint_srcu);
113110
synchronize_rcu();
114111
}
115112
#else
@@ -207,7 +204,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
207204
if (!(cond)) \
208205
return; \
209206
\
210-
/* keep srcu and sched-rcu usage consistent */ \
211207
preempt_disable_notrace(); \
212208
\
213209
__DO_TRACE_CALL(name, TP_ARGS(args)); \

kernel/tracepoint.c

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ enum tp_func_state {
2525
extern tracepoint_ptr_t __start___tracepoints_ptrs[];
2626
extern tracepoint_ptr_t __stop___tracepoints_ptrs[];
2727

28-
DEFINE_SRCU(tracepoint_srcu);
29-
EXPORT_SYMBOL_GPL(tracepoint_srcu);
30-
3128
enum tp_transition_sync {
3229
TP_TRANSITION_SYNC_1_0_1,
3330
TP_TRANSITION_SYNC_N_2_1,
@@ -37,7 +34,6 @@ enum tp_transition_sync {
3734

3835
struct tp_transition_snapshot {
3936
unsigned long rcu;
40-
unsigned long srcu;
4137
bool ongoing;
4238
};
4339

@@ -50,7 +46,6 @@ static void tp_rcu_get_state(enum tp_transition_sync sync)
5046

5147
/* Keep the latest get_state snapshot. */
5248
snapshot->rcu = get_state_synchronize_rcu();
53-
snapshot->srcu = start_poll_synchronize_srcu(&tracepoint_srcu);
5449
snapshot->ongoing = true;
5550
}
5651

@@ -61,8 +56,6 @@ static void tp_rcu_cond_sync(enum tp_transition_sync sync)
6156
if (!snapshot->ongoing)
6257
return;
6358
cond_synchronize_rcu(snapshot->rcu);
64-
if (!poll_state_synchronize_srcu(&tracepoint_srcu, snapshot->srcu))
65-
synchronize_srcu(&tracepoint_srcu);
6659
snapshot->ongoing = false;
6760
}
6861

@@ -85,9 +78,6 @@ static LIST_HEAD(tracepoint_module_list);
8578
*/
8679
static DEFINE_MUTEX(tracepoints_mutex);
8780

88-
static struct rcu_head *early_probes;
89-
static bool ok_to_free_tracepoints;
90-
9181
/*
9282
* Note about RCU :
9383
* It is used to delay the free of multiple probes array until a quiescent
@@ -111,56 +101,17 @@ static inline void *allocate_probes(int count)
111101
return p == NULL ? NULL : p->probes;
112102
}
113103

114-
static void srcu_free_old_probes(struct rcu_head *head)
115-
{
116-
kfree(container_of(head, struct tp_probes, rcu));
117-
}
118-
119104
static void rcu_free_old_probes(struct rcu_head *head)
120105
{
121-
call_srcu(&tracepoint_srcu, head, srcu_free_old_probes);
122-
}
123-
124-
static __init int release_early_probes(void)
125-
{
126-
struct rcu_head *tmp;
127-
128-
ok_to_free_tracepoints = true;
129-
130-
while (early_probes) {
131-
tmp = early_probes;
132-
early_probes = tmp->next;
133-
call_rcu(tmp, rcu_free_old_probes);
134-
}
135-
136-
return 0;
106+
kfree(container_of(head, struct tp_probes, rcu));
137107
}
138108

139-
/* SRCU is initialized at core_initcall */
140-
postcore_initcall(release_early_probes);
141-
142109
static inline void release_probes(struct tracepoint_func *old)
143110
{
144111
if (old) {
145112
struct tp_probes *tp_probes = container_of(old,
146113
struct tp_probes, probes[0]);
147114

148-
/*
149-
* We can't free probes if SRCU is not initialized yet.
150-
* Postpone the freeing till after SRCU is initialized.
151-
*/
152-
if (unlikely(!ok_to_free_tracepoints)) {
153-
tp_probes->rcu.next = early_probes;
154-
early_probes = &tp_probes->rcu;
155-
return;
156-
}
157-
158-
/*
159-
* Tracepoint probes are protected by both sched RCU and SRCU,
160-
* by calling the SRCU callback in the sched RCU callback we
161-
* cover both cases. So let us chain the SRCU and sched RCU
162-
* callbacks to wait for both grace periods.
163-
*/
164115
call_rcu(&tp_probes->rcu, rcu_free_old_probes);
165116
}
166117
}

0 commit comments

Comments
 (0)