[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <486D1E8D.8070503@redhat.com>
Date: Thu, 03 Jul 2008 14:46:37 -0400
From: Masami Hiramatsu <mhiramat@...hat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
CC: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Takashi Nishiie <t-nishiie@...css.fujitsu.com>,
"'Alexey Dobriyan'" <adobriyan@...il.com>,
"'Peter Zijlstra'" <peterz@...radead.org>,
"'Steven Rostedt'" <rostedt@...dmis.org>,
"'Frank Ch. Eigler'" <fche@...hat.com>,
"'Ingo Molnar'" <mingo@...e.hu>,
"'LKML'" <linux-kernel@...r.kernel.org>,
"'systemtap-ml'" <systemtap@...rces.redhat.com>,
"'Hideo AOKI'" <haoki@...hat.com>
Subject: Re: [RFC PATCH] Kernel Tracepoints (update)
Hi Mathieu,
Mathieu Desnoyers wrote:
> Hi Masami,
>
> I am thinking about removing the private_data, because such declaration
> won't work :
>
> DEFINE_TRACE(kernel_irq_exit,
> TPPROTO(void),
> TPARGS());
>
> because the arguments become :
>
> (void *private_data, void)
Oh, you right.
since there is no tracepoint user who uses private_data,
we can remove it.
> Any better idea ?
If you need it, I think you can introduce some macros like below.
#define TPPROTO(args...) (void *private_data, args)
#define __define_trace_register(name, proto) \ /*shared by DEFINE_TRACE/DEFINE_TRACE_NOARG*/
static inline int register_trace_##name(\
void (*probe)proto, \
void *private_data) \
{ \
return tracepoint_probe_register(#name ":" #proto, \
(void *)probe, private_data); \
} \
static inline void unregister_trace_##name( \
void (*probe)proto, \
void *private_data) \
{ \
tracepoint_probe_unregister(#name ":" #proto, \
(void *)probe, private_data); \
}
#define DEFINE_TRACE_NOARG(name) \
static inline void _do_trace_##name(struct tracepoint *tp) \
...
static inline void trace_##name(void) \
...
__define_trace_register(name, (void *private_data))
But I think removing private_data is better...
Thank you,
>
> Mathieu
>
> * Masami Hiramatsu (mhiramat@...hat.com) wrote:
>> Hi Mathieu,
>>
>> I found a bug.
>> Mathieu Desnoyers wrote:
>> [...]
>>
>>> +/*
>>> + * Remove the tracepoint from the tracepoint hash table. Must be called with
>>> + * mutex_lock held.
>>> + */
>>> +static int remove_tracepoint(const char *name)
>>> +{
>>> + struct hlist_head *head;
>>> + struct hlist_node *node;
>>> + struct tracepoint_entry *e;
>>> + int found = 0;
>>> + size_t len = strlen(name) + 1;
>>> + u32 hash = jhash(name, len-1, 0);
>>> +
>>> + head = &tracepoint_table[hash & ((1 << TRACEPOINT_HASH_BITS)-1)];
>>> + hlist_for_each_entry(e, node, head, hlist) {
>>> + if (!strcmp(name, e->name)) {
>>> + found = 1;
>>> + break;
>>> + }
>>> + }
>>> + if (!found)
>>> + return -ENOENT;
>> before removing, you have to ensure refcount == 0. So,
>> if (e->refcount != 0)
>> return -EBUSY;
>>
>>> + hlist_del(&e->hlist);
>>> + /* Make sure the call_rcu has been executed */
>>> + if (e->rcu_pending)
>>> + rcu_barrier();
>>> + kfree(e);
>>> + return 0;
>>> +}
>> Thank you,
>>
>> --
>> Masami Hiramatsu
>>
>> Software Engineer
>> Hitachi Computer Products (America) Inc.
>> Software Solutions Division
>>
>> e-mail: mhiramat@...hat.com
>>
>
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@...hat.com
--
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