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>
This commit is contained in:
committed by
Ingo Molnar
parent
c91add5fa6
commit
072b40a156
@@ -41,7 +41,7 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
|
|||||||
if (unlikely(!tr))
|
if (unlikely(!tr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
local_irq_save(flags);
|
raw_local_irq_save(flags);
|
||||||
cpu = raw_smp_processor_id();
|
cpu = raw_smp_processor_id();
|
||||||
if (atomic_inc_return(&tr->data[cpu]->disabled) != 1)
|
if (atomic_inc_return(&tr->data[cpu]->disabled) != 1)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -73,7 +73,7 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
atomic_dec(&tr->data[cpu]->disabled);
|
atomic_dec(&tr->data[cpu]->disabled);
|
||||||
local_irq_restore(flags);
|
raw_local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
|
Reference in New Issue
Block a user