Re: [PATCH bpf v1 1/2] bpf: Fix grace period wait for tracepoint bpf_link

Steven Rostedt
2026-03-30T15:06:20Z

On Mon, 30 Mar 2026 05:21:22 +0200
Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote:

> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -113,6 +113,10 @@ void for_each_tracepoint_in_module(struct module *mod,
> */
> #ifdef CONFIG_TRACEPOINTS
> extern struct srcu_struct tracepoint_srcu;
> +static inline struct srcu_struct *tracepoint_srcu_ptr(void)
> +{
> + return &tracepoint_srcu;
> +}
> static inline void tracepoint_synchronize_unregister(void)
> {
> synchronize_rcu_tasks_trace();
> @@ -123,6 +127,10 @@ static inline bool tracepoint_is_faultable(struct tracepoint *tp)
> return tp->ext && tp->ext->faultable;
> }
> #else
> +static inline struct srcu_struct *tracepoint_srcu_ptr(void)
> +{
> + return NULL;
> +}

I rather not export the internal workings of tracepoints like this. We do
have a tracepoint_synchronize_unregister().

Either you can add a workqueue that calls this and then frees the
data. Or possibly we can create some kind of:

void call_tracepoint_synchronize_unregister(struct rcu_head *head, rcu_callback_t func)

helper function.

But let's not make tracepoints being protected by SRCU an exposed API.

-- Steve