Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Crystal Wood <crwood@redhat.com>
Cc: linux-trace-kernel@vger.kernel.org,
	John Kacur <jkacur@redhat.com>, Tomas Glozar <tglozar@redhat.com>,
	Costa Shulyupin <costa.shul@redhat.com>,
	Wander Lairson Costa	 <wander@redhat.com>,
	sashiko-bot@kernel.org, sashiko-reviews@lists.linux.dev
Subject: Re: [PATCH v2] tracing/osnoise: Array printk init and cleanup
Date: Sat, 30 May 2026 10:51:35 -0400	[thread overview]
Message-ID: <20260530105135.7129cba7@gandalf.local.home> (raw)
In-Reply-To: <b555e6ba6f723c244edc88afbc6383022d51ed3c.camel@redhat.com>

On Fri, 29 May 2026 22:33:37 -0500
Crystal Wood <crwood@redhat.com> 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

      reply	other threads:[~2026-05-30 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 22:30 [PATCH v2] tracing/osnoise: Array printk init and cleanup Crystal Wood
2026-05-20 20:28 ` Steven Rostedt
2026-05-21 23:48   ` Crystal Wood
2026-05-30  3:33     ` Crystal Wood
2026-05-30 14:51       ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260530105135.7129cba7@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=costa.shul@redhat.com \
    --cc=crwood@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tglozar@redhat.com \
    --cc=wander@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox