]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/trace/trace.c
mmtimer: Push BKL down into the ioctl handler
[linux-2.6-omap-h63xx.git] / kernel / trace / trace.c
index f8fdb9cedc2445f9753d32f8570751875b24d54b..868e121c8e385f36604271ddf93d97bb92f24dd0 100644 (file)
@@ -96,6 +96,9 @@ static DEFINE_PER_CPU(struct trace_array_cpu, max_data);
 /* tracer_enabled is used to toggle activation of a tracer */
 static int                     tracer_enabled = 1;
 
+/* function tracing enabled */
+int                            ftrace_function_enabled;
+
 /*
  * trace_nr_entries is the number of entries that is allocated
  * for a buffer. Note, the number of entries is always rounded
@@ -134,6 +137,7 @@ static notrace void no_trace_init(struct trace_array *tr)
 {
        int cpu;
 
+       ftrace_function_enabled = 0;
        if(tr->ctrl)
                for_each_online_cpu(cpu)
                        tracing_reset(tr->data[cpu]);
@@ -848,6 +852,48 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data,
                trace_function(tr, data, ip, parent_ip, flags);
 }
 
+#ifdef CONFIG_MMIOTRACE
+void __trace_mmiotrace_rw(struct trace_array *tr, struct trace_array_cpu *data,
+                                               struct mmiotrace_rw *rw)
+{
+       struct trace_entry *entry;
+       unsigned long irq_flags;
+
+       raw_local_irq_save(irq_flags);
+       __raw_spin_lock(&data->lock);
+
+       entry                   = tracing_get_trace_entry(tr, data);
+       tracing_generic_entry_update(entry, 0);
+       entry->type             = TRACE_MMIO_RW;
+       entry->mmiorw           = *rw;
+
+       __raw_spin_unlock(&data->lock);
+       raw_local_irq_restore(irq_flags);
+
+       trace_wake_up();
+}
+
+void __trace_mmiotrace_map(struct trace_array *tr, struct trace_array_cpu *data,
+                                               struct mmiotrace_map *map)
+{
+       struct trace_entry *entry;
+       unsigned long irq_flags;
+
+       raw_local_irq_save(irq_flags);
+       __raw_spin_lock(&data->lock);
+
+       entry                   = tracing_get_trace_entry(tr, data);
+       tracing_generic_entry_update(entry, 0);
+       entry->type             = TRACE_MMIO_MAP;
+       entry->mmiomap          = *map;
+
+       __raw_spin_unlock(&data->lock);
+       raw_local_irq_restore(irq_flags);
+
+       trace_wake_up();
+}
+#endif
+
 void __trace_stack(struct trace_array *tr,
                   struct trace_array_cpu *data,
                   unsigned long flags,
@@ -985,7 +1031,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
        long disabled;
        int cpu;
 
-       if (unlikely(!tracer_enabled))
+       if (unlikely(!ftrace_function_enabled))
                return;
 
        if (skip_trace(ip))
@@ -1010,11 +1056,15 @@ static struct ftrace_ops trace_ops __read_mostly =
 
 void tracing_start_function_trace(void)
 {
+       ftrace_function_enabled = 0;
        register_ftrace_function(&trace_ops);
+       if (tracer_enabled)
+               ftrace_function_enabled = 1;
 }
 
 void tracing_stop_function_trace(void)
 {
+       ftrace_function_enabled = 0;
        unregister_ftrace_function(&trace_ops);
 }
 #endif
@@ -1850,8 +1900,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
                m->private = iter;
 
                /* stop the trace while dumping */
-               if (iter->tr->ctrl)
+               if (iter->tr->ctrl) {
                        tracer_enabled = 0;
+                       ftrace_function_enabled = 0;
+               }
 
                if (iter->trace && iter->trace->open)
                        iter->trace->open(iter);
@@ -1884,8 +1936,14 @@ int tracing_release(struct inode *inode, struct file *file)
                iter->trace->close(iter);
 
        /* reenable tracing if it was previously enabled */
-       if (iter->tr->ctrl)
+       if (iter->tr->ctrl) {
                tracer_enabled = 1;
+               /*
+                * It is safe to enable function tracing even if it
+                * isn't used
+                */
+               ftrace_function_enabled = 1;
+       }
        mutex_unlock(&trace_types_lock);
 
        seq_release(inode, file);
@@ -2871,6 +2929,9 @@ static __init void tracer_init_debugfs(void)
                pr_warning("Could not create debugfs "
                           "'dyn_ftrace_total_info' entry\n");
 #endif
+#ifdef CONFIG_SYSPROF_TRACER
+       init_tracer_sysprof_debugfs(d_tracer);
+#endif
 }
 
 static int trace_alloc_page(void)