LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] tracepoint: introduce *_noupdate APIs.
Date: Fri, 31 Oct 2008 00:14:19 +0100	[thread overview]
Message-ID: <20081030231419.GA1985@elte.hu> (raw)
In-Reply-To: <20081030053949.GC27381@Krystal>


* Mathieu Desnoyers <compudj@krystal.dyndns.org> wrote:

> * Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) wrote:
> > * Lai Jiangshan (laijs@cn.fujitsu.com) wrote:
> > > 
> > > new APIs separate tracepoint_probe_register(),
> > > tracepoint_probe_unregister() into 2 steps. The first step of them
> > > is just update tracepoint_entry, not connect or disconnect.
> > > 
> > > this patch introduce tracepoint_probe_update_all() for update all.
> > > 
> > > these APIs are very useful for registering a lots of probes
> > > but just update once only. and a very important thing is that
> > > *_noupdate APIs do not require module_mutex.
> > > 
> > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > 
> > [...]
> > 
> > > +/**
> > > + * tracepoint_probe_update_all -  update tracepoints
> > > + */
> > > +void tracepoint_probe_update_all(void)
> > > +{
> > > +	LIST_HEAD(release_probes);
> > > +	struct tp_probes *pos, *next;
> > > +
> > > +	mutex_lock(&tracepoints_mutex);
> > > +	if (!need_update) {
> > > +		mutex_unlock(&tracepoints_mutex);
> > > +		return;
> > > +	}
> > > +	if (!list_empty(&old_probes))
> > > +		list_replace_init(&old_probes, &release_probes);
> > > +	need_update = 0;
> > > +	mutex_unlock(&tracepoints_mutex);
> > > +
> > > +	tracepoint_update_probes();
> > 
> > I think the read-side of this release_probes list should be protected by
> > the tracepoints_mutex too. Two concurrent tracepoint_probe_update_all()
> > could cause havoc here :
> > 
> > 
> > mutex_lock(&tracepoints_mutex);
> > 
> > > +	list_for_each_entry_safe(pos, next, &release_probes, u.list) {
> > > +		list_del(&pos->u.list);
> > > +		call_rcu_sched(&pos->u.rcu, rcu_free_old_probes);
> > > +	}
> > 
> > mutex_unlock(&tracepoints_mutex);
> > 
> > ?
> > 
> > The rest looks good.
> > 
> 
> Argh, forget it. LIST_HEAD(release_probes); is local to the function,
> there is nothing to protect here. My eyes thought they saw a "static"
> here for some reason. Night shift....
> 
> The patch is good as-is.
> 
> Thanks !
> 
> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

ok, i've applied both patches to tip/tracing/tracepoints:

 57bc8ea: tracepoint: introduce *_noupdate APIs.
 bbec237: tracepoint: simplification for tracepoints using RCU

thanks!

(Note, i had to resolve conflicts, hopefully i got the end result 
right. Please double-check tip/master.)

	Ingo

  reply	other threads:[~2008-10-30 23:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28  2:51 Lai Jiangshan
2008-10-30  5:34 ` Mathieu Desnoyers
2008-10-30  5:39   ` Mathieu Desnoyers
2008-10-30 23:14     ` Ingo Molnar [this message]
2008-10-30 23:26       ` Ingo Molnar
2008-10-31  0:44         ` Lai Jiangshan

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=20081030231419.GA1985@elte.hu \
    --to=mingo@elte.hu \
    --cc=compudj@krystal.dyndns.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 2/2] tracepoint: introduce *_noupdate APIs.' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).