diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-11-18 02:07:36 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-11-18 02:07:36 -0500 |
commit | a89d4bd055718d3b4ddb380ee22951a1300b4096 (patch) | |
tree | ca7a040a619f7c1fb6a42e77be7ff9147417aa2b /kernel/trace | |
parent | e53beacd23d9cb47590da6a7a7f6d417b941a994 (diff) | |
parent | 91e86e560d0b3ce4c5fc64fd2bbb99f856a30a4e (diff) |
Merge branch 'tip/perf/urgent-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/urgent
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 82d9b8106cd0..ee6a7339cf0e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1284,6 +1284,8 @@ void trace_dump_stack(void) | |||
1284 | __ftrace_trace_stack(global_trace.buffer, flags, 3, preempt_count()); | 1284 | __ftrace_trace_stack(global_trace.buffer, flags, 3, preempt_count()); |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | static DEFINE_PER_CPU(int, user_stack_count); | ||
1288 | |||
1287 | void | 1289 | void |
1288 | ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) | 1290 | ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) |
1289 | { | 1291 | { |
@@ -1302,6 +1304,18 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) | |||
1302 | if (unlikely(in_nmi())) | 1304 | if (unlikely(in_nmi())) |
1303 | return; | 1305 | return; |
1304 | 1306 | ||
1307 | /* | ||
1308 | * prevent recursion, since the user stack tracing may | ||
1309 | * trigger other kernel events. | ||
1310 | */ | ||
1311 | preempt_disable(); | ||
1312 | if (__this_cpu_read(user_stack_count)) | ||
1313 | goto out; | ||
1314 | |||
1315 | __this_cpu_inc(user_stack_count); | ||
1316 | |||
1317 | |||
1318 | |||
1305 | event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK, | 1319 | event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK, |
1306 | sizeof(*entry), flags, pc); | 1320 | sizeof(*entry), flags, pc); |
1307 | if (!event) | 1321 | if (!event) |
@@ -1319,6 +1333,11 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) | |||
1319 | save_stack_trace_user(&trace); | 1333 | save_stack_trace_user(&trace); |
1320 | if (!filter_check_discard(call, entry, buffer, event)) | 1334 | if (!filter_check_discard(call, entry, buffer, event)) |
1321 | ring_buffer_unlock_commit(buffer, event); | 1335 | ring_buffer_unlock_commit(buffer, event); |
1336 | |||
1337 | __this_cpu_dec(user_stack_count); | ||
1338 | |||
1339 | out: | ||
1340 | preempt_enable(); | ||
1322 | } | 1341 | } |
1323 | 1342 | ||
1324 | #ifdef UNUSED | 1343 | #ifdef UNUSED |