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

* 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>

> Mathieu
> 
> -- 
> Mathieu Desnoyers
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2008-10-30  5:40 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 [this message]
2008-10-30 23:14     ` Ingo Molnar
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=20081030053949.GC27381@Krystal \
    --to=compudj@krystal.dyndns.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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).