Commit c5f888ca authored by Steven Rostedt's avatar Steven Rostedt Committed by Thomas Gleixner

ftrace: irqsoff use raw_smp_processor_id

This patch changes the use of __get_cpu_var to explicitly calling
raw_smp_processor_id and using the per_cpu() macro. On some debug
configurations, the use of __get_cpu_var may cause ftrace to trigger
and this can cause problems with the irqsoff tracing.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4d9493c9
...@@ -204,14 +204,14 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip) ...@@ -204,14 +204,14 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip)
if (likely(!tracer_enabled)) if (likely(!tracer_enabled))
return; return;
if (__get_cpu_var(tracing_cpu)) cpu = raw_smp_processor_id();
if (per_cpu(tracing_cpu, cpu))
return; return;
cpu = raw_smp_processor_id();
data = tr->data[cpu]; data = tr->data[cpu];
if (unlikely(!data) || unlikely(!head_page(data)) || if (unlikely(!data) || atomic_read(&data->disabled))
atomic_read(&data->disabled))
return; return;
atomic_inc(&data->disabled); atomic_inc(&data->disabled);
...@@ -225,7 +225,7 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip) ...@@ -225,7 +225,7 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip)
trace_function(tr, data, ip, parent_ip, flags); trace_function(tr, data, ip, parent_ip, flags);
__get_cpu_var(tracing_cpu) = 1; per_cpu(tracing_cpu, cpu) = 1;
atomic_dec(&data->disabled); atomic_dec(&data->disabled);
} }
...@@ -238,16 +238,16 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip) ...@@ -238,16 +238,16 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
struct trace_array_cpu *data; struct trace_array_cpu *data;
unsigned long flags; unsigned long flags;
cpu = raw_smp_processor_id();
/* Always clear the tracing cpu on stopping the trace */ /* Always clear the tracing cpu on stopping the trace */
if (unlikely(__get_cpu_var(tracing_cpu))) if (unlikely(per_cpu(tracing_cpu, cpu)))
__get_cpu_var(tracing_cpu) = 0; per_cpu(tracing_cpu, cpu) = 0;
else else
return; return;
if (!tracer_enabled) if (!tracer_enabled)
return; return;
cpu = raw_smp_processor_id();
data = tr->data[cpu]; data = tr->data[cpu];
if (unlikely(!data) || unlikely(!head_page(data)) || if (unlikely(!data) || unlikely(!head_page(data)) ||
...@@ -255,6 +255,7 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip) ...@@ -255,6 +255,7 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
return; return;
atomic_inc(&data->disabled); atomic_inc(&data->disabled);
local_save_flags(flags); local_save_flags(flags);
trace_function(tr, data, ip, parent_ip, flags); trace_function(tr, data, ip, parent_ip, flags);
check_critical_timing(tr, data, parent_ip ? : ip, cpu); check_critical_timing(tr, data, parent_ip ? : ip, cpu);
...@@ -376,7 +377,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr) ...@@ -376,7 +377,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr)
static void __irqsoff_tracer_init(struct trace_array *tr) static void __irqsoff_tracer_init(struct trace_array *tr)
{ {
irqsoff_trace = tr; irqsoff_trace = tr;
/* make sure that the tracer is visibel */ /* make sure that the tracer is visible */
smp_wmb(); smp_wmb();
if (tr->ctrl) if (tr->ctrl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment