diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-11-15 23:59:52 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-16 01:55:59 -0500 |
commit | 072b40a15616fe6bea68466e6bffcfcbf5c8f26f (patch) | |
tree | 0efdcf29a712e8f381a56e57f6a89cb7ca7be901 /kernel | |
parent | c91add5fa68ea9b1f2923b3788c5dae0e60e1f6b (diff) |
tracing/branch-tracer: fix a trace recursion on branch tracer
Impact: fix crash when enabling the branch-tracer
When the branch tracer inserts an event through
probe_likely_condition(), it calls local_irq_save() and then results
in a trace recursion.
local_irq_save() -> trace_hardirqs_off() -> trace_hardirqs_off_caller()
-> unlikely()
The trace_branch.c file is protected by DISABLE_BRANCH_PROFILING but
that doesn't prevent from external call to functions that use
unlikely().
My box crashed each time I tried to set this tracer (sudden and hard
reboot).
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_branch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c index 85265553918f..2511e32572ca 100644 --- a/kernel/trace/trace_branch.c +++ b/kernel/trace/trace_branch.c | |||
@@ -41,7 +41,7 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) | |||
41 | if (unlikely(!tr)) | 41 | if (unlikely(!tr)) |
42 | return; | 42 | return; |
43 | 43 | ||
44 | local_irq_save(flags); | 44 | raw_local_irq_save(flags); |
45 | cpu = raw_smp_processor_id(); | 45 | cpu = raw_smp_processor_id(); |
46 | if (atomic_inc_return(&tr->data[cpu]->disabled) != 1) | 46 | if (atomic_inc_return(&tr->data[cpu]->disabled) != 1) |
47 | goto out; | 47 | goto out; |
@@ -73,7 +73,7 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) | |||
73 | 73 | ||
74 | out: | 74 | out: |
75 | atomic_dec(&tr->data[cpu]->disabled); | 75 | atomic_dec(&tr->data[cpu]->disabled); |
76 | local_irq_restore(flags); | 76 | raw_local_irq_restore(flags); |
77 | } | 77 | } |
78 | 78 | ||
79 | static inline | 79 | static inline |