Re: [PATCH 02/10] perf, trace: Use per-tracepoint-per-cpu hlist totrack events

From: Peter Zijlstra
Date: Fri May 21 2010 - 10:25:22 EST


On Fri, 2010-05-21 at 16:18 +0200, Peter Zijlstra wrote:
>
> > That tp_event->perf_refcount is global to the event not to the perf
> > event.
>
> Oh, bugger, yes. I seem to have lost it on destroy..


---
Subject: perf, trace: Fix perf_trace_destroy(), mutex went missing
From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Date: Fri May 21 16:22:33 CEST 2010

Steve spotted I forgot to do the destroy under event_mutex.

Reported-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
LKML-Reference: <new-submission>
---
kernel/trace/trace_event_perf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6/kernel/trace/trace_event_perf.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace_event_perf.c
+++ linux-2.6/kernel/trace/trace_event_perf.c
@@ -125,8 +125,9 @@ void perf_trace_destroy(struct perf_even
struct ftrace_event_call *tp_event = p_event->tp_event;
int i;

+ mutex_lock(&event_mutex);
if (--tp_event->perf_refcount > 0)
- return;
+ goto out;

tp_event->perf_event_disable(tp_event);

@@ -145,6 +146,8 @@ void perf_trace_destroy(struct perf_even
perf_trace_buf[i] = NULL;
}
}
+out:
+ mutex_unlock(&event_mutex);
}

__kprobes void *perf_trace_buf_prepare(int size, unsigned short type,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/