]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'tracing/ftrace' into auto-ftrace-next
authorIngo Molnar <mingo@elte.hu>
Mon, 14 Jul 2008 13:58:35 +0000 (15:58 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 14 Jul 2008 13:58:35 +0000 (15:58 +0200)
1  2 
kernel/trace/trace.c
kernel/trace/trace.h

diff --combined kernel/trace/trace.c
index e46de641ea44e03ff7646f070fe7f594f0596559,2e37857f7dfe0f2585e50302ae0ffef9d6fb3c4e..868e121c8e385f36604271ddf93d97bb92f24dd0
@@@ -96,6 -96,9 +96,9 @@@ static DEFINE_PER_CPU(struct trace_arra
  /* 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 +137,7 @@@ static notrace void no_trace_init(struc
  {
        int cpu;
  
+       ftrace_function_enabled = 0;
        if(tr->ctrl)
                for_each_online_cpu(cpu)
                        tracing_reset(tr->data[cpu]);
@@@ -848,48 -852,6 +852,48 @@@ ftrace(struct trace_array *tr, struct t
                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,
@@@ -1027,7 -989,7 +1031,7 @@@ function_trace_call(unsigned long ip, u
        long disabled;
        int cpu;
  
-       if (unlikely(!tracer_enabled))
+       if (unlikely(!ftrace_function_enabled))
                return;
  
        if (skip_trace(ip))
@@@ -1052,11 -1014,15 +1056,15 @@@ static struct ftrace_ops trace_ops __re
  
  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
@@@ -1383,7 -1349,7 +1391,7 @@@ print_trace_header(struct seq_file *m, 
                   "server",
  #elif defined(CONFIG_PREEMPT_VOLUNTARY)
                   "desktop",
- #elif defined(CONFIG_PREEMPT_DESKTOP)
+ #elif defined(CONFIG_PREEMPT)
                   "preempt",
  #else
                   "unknown",
@@@ -1892,8 -1858,10 +1900,10 @@@ __tracing_open(struct inode *inode, str
                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);
@@@ -1926,8 -1894,14 +1936,14 @@@ int tracing_release(struct inode *inode
                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);
@@@ -2913,9 -2887,6 +2929,9 @@@ static __init void tracer_init_debugfs(
                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)
diff --combined kernel/trace/trace.h
index 8cb215b239d50f8fa5b46966e9141d9ca8cdfd33,df840f42be396467e9d055557c7f946d19d9c874..f69f86788c2bd12a2df18e4dabe9e66046a2e71f
@@@ -5,7 -5,6 +5,7 @@@
  #include <asm/atomic.h>
  #include <linux/sched.h>
  #include <linux/clocksource.h>
 +#include <linux/mmiotrace.h>
  
  enum trace_type {
        __TRACE_FIRST_TYPE = 0,
@@@ -15,8 -14,6 +15,8 @@@
        TRACE_WAKE,
        TRACE_STACK,
        TRACE_SPECIAL,
 +      TRACE_MMIO_RW,
 +      TRACE_MMIO_MAP,
  
        __TRACE_LAST_TYPE
  };
@@@ -78,8 -75,6 +78,8 @@@ struct trace_entry 
                struct ctx_switch_entry         ctx;
                struct special_entry            special;
                struct stack_entry              stack;
 +              struct mmiotrace_rw             mmiorw;
 +              struct mmiotrace_map            mmiomap;
        };
  };
  
@@@ -193,8 -188,6 +193,8 @@@ struct trace_iterator 
  void tracing_reset(struct trace_array_cpu *data);
  int tracing_open_generic(struct inode *inode, struct file *filp);
  struct dentry *tracing_init_dentry(void);
 +void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
 +
  void ftrace(struct trace_array *tr,
                            struct trace_array_cpu *data,
                            unsigned long ip,
@@@ -223,8 -216,6 +223,6 @@@ void trace_function(struct trace_array 
                    unsigned long parent_ip,
                    unsigned long flags);
  
- void tracing_start_function_trace(void);
- void tracing_stop_function_trace(void);
  void tracing_start_cmdline_record(void);
  void tracing_stop_cmdline_record(void);
  int register_tracer(struct tracer *type);
@@@ -241,6 -232,14 +239,14 @@@ void update_max_tr_single(struct trace_
  
  extern cycle_t ftrace_now(int cpu);
  
+ #ifdef CONFIG_FTRACE
+ void tracing_start_function_trace(void);
+ void tracing_stop_function_trace(void);
+ #else
+ # define tracing_start_function_trace()               do { } while (0)
+ # define tracing_stop_function_trace()                do { } while (0)
+ #endif
  #ifdef CONFIG_CONTEXT_SWITCH_TRACER
  typedef void
  (*tracer_switch_func_t)(void *private,
@@@ -262,15 -261,6 +268,15 @@@ extern unsigned long ftrace_update_tot_
  extern int DYN_FTRACE_TEST_NAME(void);
  #endif
  
 +#ifdef CONFIG_MMIOTRACE
 +extern void __trace_mmiotrace_rw(struct trace_array *tr,
 +                              struct trace_array_cpu *data,
 +                              struct mmiotrace_rw *rw);
 +extern void __trace_mmiotrace_map(struct trace_array *tr,
 +                              struct trace_array_cpu *data,
 +                              struct mmiotrace_map *map);
 +#endif
 +
  #ifdef CONFIG_FTRACE_STARTUP_TEST
  #ifdef CONFIG_FTRACE
  extern int trace_selftest_startup_function(struct tracer *trace,
@@@ -296,10 -286,6 +302,10 @@@ extern int trace_selftest_startup_wakeu
  extern int trace_selftest_startup_sched_switch(struct tracer *trace,
                                               struct trace_array *tr);
  #endif
 +#ifdef CONFIG_SYSPROF_TRACER
 +extern int trace_selftest_startup_sysprof(struct tracer *trace,
 +                                             struct trace_array *tr);
 +#endif
  #endif /* CONFIG_FTRACE_STARTUP_TEST */
  
  extern void *head_page(struct trace_array_cpu *data);