[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090511212602.GA5965@nowhere>
Date: Mon, 11 May 2009 23:26:04 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Masami Hiramatsu <mhiramat@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
lkml <linux-kernel@...r.kernel.org>,
systemtap <systemtap@...rces.redhat.com>,
kvm <kvm@...r.kernel.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>
Subject: Re: [PATCH -tip v5 4/7] tracing: add kprobe-based event tracer
On Sat, May 09, 2009 at 01:33:53PM -0400, Masami Hiramatsu wrote:
> Frédéric Weisbecker wrote:
> > Hi,
> >
> > 2009/5/9 Masami Hiramatsu <mhiramat@...hat.com>:
> [...]
> >> +
> >> +/* event recording functions */
> >> +static void kprobe_trace_record(unsigned long ip, struct trace_probe *tp,
> >> + struct pt_regs *regs)
> >> +{
> >> + __trace_bprintk(ip, "%s%s%+ld\n",
> >> + probe_is_return(tp) ? "<-" : "@",
> >> + probe_symbol(tp), probe_offset(tp));
> >> +}
> >
> >
> >
> > What happens here if you have:
> >
> > kprobe_trace_record() {
> > probe_symbol() {
> > .... probes_open() {
> > cleanup_all_probes() {
> > free_trace_probe();
> > return tp->symbol ? ....; //crack!
> >
> > I wonder if you shouldn't use a per_cpu list of probes,
> > spinlocked/irqsaved accessed
> > and also a kind of prevention against nmi.
>
> Sure, cleanup_all_probes() invokes unregister_kprobe() via
> unregister_trace_probe(), which waits running probe-handlers by
> using synchronize_sched()(because kprobes disables preemption
> around its handlers), before free_trace_probe().
>
> So you don't need any locks there :-)
>
> Thank you,
>
>
Aah, ok :)
So this patch looks sane.
Thanks.
--
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