aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0c22fe2d43a7..216bbe7547a4 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -960,6 +960,7 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
960{ 960{
961 struct trace_array *tr = &global_trace; 961 struct trace_array *tr = &global_trace;
962 struct trace_array_cpu *data; 962 struct trace_array_cpu *data;
963 unsigned long flags;
963 int cpu; 964 int cpu;
964 int pc; 965 int pc;
965 966
@@ -967,14 +968,15 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
967 return; 968 return;
968 969
969 pc = preempt_count(); 970 pc = preempt_count();
970 preempt_disable_notrace(); 971 local_irq_save(flags);
971 cpu = raw_smp_processor_id(); 972 cpu = raw_smp_processor_id();
972 data = tr->data[cpu]; 973 data = tr->data[cpu];
973 974
974 if (likely(!atomic_read(&data->disabled))) 975 if (likely(atomic_inc_return(&data->disabled) == 1))
975 ftrace_trace_special(tr, data, arg1, arg2, arg3, pc); 976 ftrace_trace_special(tr, data, arg1, arg2, arg3, pc);
976 977
977 preempt_enable_notrace(); 978 atomic_dec(&data->disabled);
979 local_irq_restore(flags);
978} 980}
979 981
980#ifdef CONFIG_FUNCTION_TRACER 982#ifdef CONFIG_FUNCTION_TRACER