]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - kernel/trace/trace_irqsoff.c
Merge branch 'for-2.6.27' of git://git.marvell.com/mv643xx_eth into upstream-fixes
[mv-sheeva.git] / kernel / trace / trace_irqsoff.c
index d0c1748b1e2cdabec64a66270189e4f8e2d85908..ece6cfb649fa52823f33988fd6792dad2d0d1fae 100644 (file)
@@ -165,22 +165,6 @@ check_critical_timing(struct trace_array *tr,
 
        update_max_tr_single(tr, current, cpu);
 
-       if (!runqueue_is_locked()) {
-               if (tracing_thresh) {
-                       printk(KERN_INFO "(%16s-%-5d|#%d): %lu us critical"
-                              " section violates %lu us threshold.\n",
-                              current->comm, current->pid,
-                              raw_smp_processor_id(),
-                              latency, nsecs_to_usecs(tracing_thresh));
-               } else {
-                       printk(KERN_INFO "(%16s-%-5d|#%d): new %lu us"
-                              " maximum-latency critical section.\n",
-                              current->comm, current->pid,
-                              raw_smp_processor_id(),
-                              latency);
-               }
-       }
-
        max_sequence++;
 
 out_unlock:
@@ -204,14 +188,14 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip)
        if (likely(!tracer_enabled))
                return;
 
-       if (__get_cpu_var(tracing_cpu))
+       cpu = raw_smp_processor_id();
+
+       if (per_cpu(tracing_cpu, cpu))
                return;
 
-       cpu = raw_smp_processor_id();
        data = tr->data[cpu];
 
-       if (unlikely(!data) || unlikely(!head_page(data)) ||
-           atomic_read(&data->disabled))
+       if (unlikely(!data) || atomic_read(&data->disabled))
                return;
 
        atomic_inc(&data->disabled);
@@ -225,7 +209,7 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip)
 
        trace_function(tr, data, ip, parent_ip, flags);
 
-       __get_cpu_var(tracing_cpu) = 1;
+       per_cpu(tracing_cpu, cpu) = 1;
 
        atomic_dec(&data->disabled);
 }
@@ -238,16 +222,16 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
        struct trace_array_cpu *data;
        unsigned long flags;
 
+       cpu = raw_smp_processor_id();
        /* Always clear the tracing cpu on stopping the trace */
-       if (unlikely(__get_cpu_var(tracing_cpu)))
-               __get_cpu_var(tracing_cpu) = 0;
+       if (unlikely(per_cpu(tracing_cpu, cpu)))
+               per_cpu(tracing_cpu, cpu) = 0;
        else
                return;
 
        if (!tracer_enabled)
                return;
 
-       cpu = raw_smp_processor_id();
        data = tr->data[cpu];
 
        if (unlikely(!data) || unlikely(!head_page(data)) ||
@@ -255,6 +239,7 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
                return;
 
        atomic_inc(&data->disabled);
+
        local_save_flags(flags);
        trace_function(tr, data, ip, parent_ip, flags);
        check_critical_timing(tr, data, parent_ip ? : ip, cpu);
@@ -268,12 +253,14 @@ void start_critical_timings(void)
        if (preempt_trace() || irq_trace())
                start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
+EXPORT_SYMBOL_GPL(start_critical_timings);
 
 void stop_critical_timings(void)
 {
        if (preempt_trace() || irq_trace())
                stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
+EXPORT_SYMBOL_GPL(stop_critical_timings);
 
 #ifdef CONFIG_IRQSOFF_TRACER
 #ifdef CONFIG_PROVE_LOCKING
@@ -352,12 +339,14 @@ EXPORT_SYMBOL(trace_hardirqs_off_caller);
 #ifdef CONFIG_PREEMPT_TRACER
 void trace_preempt_on(unsigned long a0, unsigned long a1)
 {
-       stop_critical_timing(a0, a1);
+       if (preempt_trace())
+               stop_critical_timing(a0, a1);
 }
 
 void trace_preempt_off(unsigned long a0, unsigned long a1)
 {
-       start_critical_timing(a0, a1);
+       if (preempt_trace())
+               start_critical_timing(a0, a1);
 }
 #endif /* CONFIG_PREEMPT_TRACER */
 
@@ -376,7 +365,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr)
 static void __irqsoff_tracer_init(struct trace_array *tr)
 {
        irqsoff_trace = tr;
-       /* make sure that the tracer is visibel */
+       /* make sure that the tracer is visible */
        smp_wmb();
 
        if (tr->ctrl)