On Fri, 29 May 2026 22:33:37 -0500
Crystal Wood <[email protected]> wrote:
> > > diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> > > index 75678053b21c..bda1e0e0d2e1 100644
> > > --- a/kernel/trace/trace_osnoise.c
> > > +++ b/kernel/trace/trace_osnoise.c
> > > @@ -476,8 +476,11 @@ static void print_osnoise_headers(struct seq_file *s)
> > >
> > > \
> > > rcu_read_lock();
> > > \
> > > list_for_each_entry_rcu(inst, &osnoise_instances, list) {
> > > \
> > > + if (trace_array_get(inst->tr) < 0)
> > > \
> > > + continue;
> > > \
> > > buffer = inst->tr->array_buffer.buffer;
> > > \
> > > trace_array_printk_buf(buffer, _THIS_IP_, msg);
> > > \
> > > + trace_array_put(inst->tr);
> > > \
> > > }
> > > \
> > > rcu_read_unlock();
> > > \
> > > osnoise_data.tainted = true;
> > > \
> >
> > OK, I'll prepare a v3.
>
> Many osnoise_taint() callers, as well as timerlat_dump_stack(), can have
> preemption disabled, so the mutex in trace_array_get() won't work.
Right. OK, so another solution is to simply call synchronize_rcu() instead
of the kvfree_rcu_mightsleep(inst);
synchronize_rcu();
kvfree(inst);
Then there should not be any race, because the rmdir will have to wait for
the synchronization before finishing. This isn't something people should be
running a lot of, so I don't think it would cause too much pain in waiting
to unregister the osnoise tracer.
-- Steve