This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC PATCH] Kernel Tracepoints (update)
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- Cc: KOSAKI Motohiro <kosaki dot motohiro at jp dot fujitsu dot com>, Takashi Nishiie <t-nishiie at np dot css dot fujitsu dot com>, "'Alexey Dobriyan'" <adobriyan at gmail dot com>, "'Peter Zijlstra'" <peterz at infradead dot org>, "'Steven Rostedt'" <rostedt at goodmis dot org>, "'Frank Ch. Eigler'" <fche at redhat dot com>, "'Ingo Molnar'" <mingo at elte dot hu>, "'LKML'" <linux-kernel at vger dot kernel dot org>, "'systemtap-ml'" <systemtap at sources dot redhat dot com>, "'Hideo AOKI'" <haoki at redhat dot com>
- Date: Thu, 03 Jul 2008 11:27:23 -0400
- Subject: Re: [RFC PATCH] Kernel Tracepoints (update)
- References: <007601c8d5ca$18fa0e10$4aee2a30$@css.fujitsu.com> <48611B03.1000003@redhat.com> <20080625011951.D83E.KOSAKI.MOTOHIRO@jp.fujitsu.com> <48612879.5090809@redhat.com> <20080625235214.GA14249@Krystal> <486403F0.4020801@redhat.com> <20080627133622.GA15210@Krystal>
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@redhat.com