[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A95DAF9.9070400@cn.fujitsu.com>
Date: Thu, 27 Aug 2009 09:01:45 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
CC: Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing/profile: Fix profile_disable vs module_unload
Mathieu Desnoyers wrote:
> * Steven Rostedt (rostedt@...dmis.org) wrote:
>> This patch solves the problem that Li originally reported. If something
>> registers a trace point belonging to a module, then it ups the ref count
>> of the module. This prevents a process from registering a probe to a
>> tracepoint belonging to a module and then having the module disappear.
>>
>> Doing the example with perf in Li's original post, now errors on the
>> rmmod, with "ERROR: Module trace_events_sample is in use".
>>
>> Mathieu, can I have your acked-by on this?
>>
>
> Sorry, it looks buggy.
>
And the patch itself is buggy.
> It does not deal with the fact that tracepoints with the same name and
> arguments can be present in more than one module, or in a combination of
> kernel core and modules.
>
> The struct tracepoint_entry is specific to a a tracepoint name, used for
> registration, but is eventually tied to all tracepoint instrumentation
> instances for this tracepoint name.
>
> Mathieu
>
...
>> -tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end)
>> +tracepoint_update_probe_range(struct module *mod,
>> + struct tracepoint *begin, struct tracepoint *end)
>> {
>> struct tracepoint *iter;
>> struct tracepoint_entry *mark_entry;
>> @@ -286,9 +291,15 @@ tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end)
>> for (iter = begin; iter < end; iter++) {
>> mark_entry = get_tracepoint(iter->name);
>> if (mark_entry) {
>> + if (mod && !mark_entry->mod) {
>> + if (!try_module_get(mod))
>> + goto disable;
You can hit this code-path even when you unregister a probe,
so the right way is:
module_get() when iter->state changed from 0 from 1
module_put() when iter->state changed from 1 to 0
But still has some other problems. You don't fail the registration,
profile_enable() will return success even when the module is
being destructed.
>> + mark_entry->mod = mod;
>> + }
>> set_tracepoint(&mark_entry, iter,
>> !!mark_entry->refcount);
>> } else {
>> + disable:
>> disable_tracepoint(iter);
>> }
>> }
--
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