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

Kumar Kartikeya Dwivedi
2026-03-30T15:27:56Z

On Mon, 30 Mar 2026 at 17:06, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> 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.

This is reasonable, though a slight hiccup is that we don't want both
RCU tasks trace and SRCU grace period waits here, which a generic
unregister API would try to do like tracepoint_synchronize_unregister().

I don't think we can generically chain grace periods on our own at
all. So can we make a non_faultable variant for it, for clarity? The
existing name would be too long though; how about
call_tracepoint_unregister_non_faultable()?

>
> -- Steve
>