diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-11-23 05:37:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-23 05:49:57 -0500 |
commit | 4ed7c92d68a5387ba5f7030dc76eab03558e27f5 (patch) | |
tree | 38d758819c41261275c2dbd6f64976f824c5fd27 /kernel/trace/trace_kprobe.c | |
parent | f67218c3e93abaf0f480bb94b53d234853ffe4de (diff) |
perf_events: Undo some recursion damage
Make perf_swevent_get_recursion_context return a context number
and disable preemption.
This could be used to remove the IRQ disable from the trace bit
and index the per-cpu buffer with.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20091123103819.993226816@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 22e6f68b05b3..79ce6a2bd74f 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -1213,7 +1213,7 @@ static __kprobes int kprobe_profile_func(struct kprobe *kp, | |||
1213 | unsigned long irq_flags; | 1213 | unsigned long irq_flags; |
1214 | char *trace_buf; | 1214 | char *trace_buf; |
1215 | char *raw_data; | 1215 | char *raw_data; |
1216 | int *recursion; | 1216 | int rctx; |
1217 | 1217 | ||
1218 | pc = preempt_count(); | 1218 | pc = preempt_count(); |
1219 | __size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args); | 1219 | __size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args); |
@@ -1229,7 +1229,8 @@ static __kprobes int kprobe_profile_func(struct kprobe *kp, | |||
1229 | */ | 1229 | */ |
1230 | local_irq_save(irq_flags); | 1230 | local_irq_save(irq_flags); |
1231 | 1231 | ||
1232 | if (perf_swevent_get_recursion_context(&recursion)) | 1232 | rctx = perf_swevent_get_recursion_context(); |
1233 | if (rctx < 0) | ||
1233 | goto end_recursion; | 1234 | goto end_recursion; |
1234 | 1235 | ||
1235 | __cpu = smp_processor_id(); | 1236 | __cpu = smp_processor_id(); |
@@ -1258,7 +1259,7 @@ static __kprobes int kprobe_profile_func(struct kprobe *kp, | |||
1258 | perf_tp_event(call->id, entry->ip, 1, entry, size); | 1259 | perf_tp_event(call->id, entry->ip, 1, entry, size); |
1259 | 1260 | ||
1260 | end: | 1261 | end: |
1261 | perf_swevent_put_recursion_context(recursion); | 1262 | perf_swevent_put_recursion_context(rctx); |
1262 | end_recursion: | 1263 | end_recursion: |
1263 | local_irq_restore(irq_flags); | 1264 | local_irq_restore(irq_flags); |
1264 | 1265 | ||
@@ -1276,8 +1277,8 @@ static __kprobes int kretprobe_profile_func(struct kretprobe_instance *ri, | |||
1276 | int size, __size, i, pc, __cpu; | 1277 | int size, __size, i, pc, __cpu; |
1277 | unsigned long irq_flags; | 1278 | unsigned long irq_flags; |
1278 | char *trace_buf; | 1279 | char *trace_buf; |
1279 | int *recursion; | ||
1280 | char *raw_data; | 1280 | char *raw_data; |
1281 | int rctx; | ||
1281 | 1282 | ||
1282 | pc = preempt_count(); | 1283 | pc = preempt_count(); |
1283 | __size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args); | 1284 | __size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args); |
@@ -1293,7 +1294,8 @@ static __kprobes int kretprobe_profile_func(struct kretprobe_instance *ri, | |||
1293 | */ | 1294 | */ |
1294 | local_irq_save(irq_flags); | 1295 | local_irq_save(irq_flags); |
1295 | 1296 | ||
1296 | if (perf_swevent_get_recursion_context(&recursion)) | 1297 | rctx = perf_swevent_get_recursion_context(); |
1298 | if (rctx < 0) | ||
1297 | goto end_recursion; | 1299 | goto end_recursion; |
1298 | 1300 | ||
1299 | __cpu = smp_processor_id(); | 1301 | __cpu = smp_processor_id(); |
@@ -1323,7 +1325,7 @@ static __kprobes int kretprobe_profile_func(struct kretprobe_instance *ri, | |||
1323 | perf_tp_event(call->id, entry->ret_ip, 1, entry, size); | 1325 | perf_tp_event(call->id, entry->ret_ip, 1, entry, size); |
1324 | 1326 | ||
1325 | end: | 1327 | end: |
1326 | perf_swevent_put_recursion_context(recursion); | 1328 | perf_swevent_put_recursion_context(rctx); |
1327 | end_recursion: | 1329 | end_recursion: |
1328 | local_irq_restore(irq_flags); | 1330 | local_irq_restore(irq_flags); |
1329 | 1331 | ||