[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081030053949.GC27381@Krystal>
Date: Thu, 30 Oct 2008 01:39:49 -0400
From: Mathieu Desnoyers <compudj@...stal.dyndns.org>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Ingo Molnar <mingo@...e.hu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] tracepoint: introduce *_noupdate APIs.
* Mathieu Desnoyers (mathieu.desnoyers@...ymtl.ca) wrote:
> * Lai Jiangshan (laijs@...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@...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@...ymtl.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists