Merge branch 'tip/tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorIngo Molnar <mingo@elte.hu>
Thu, 11 Mar 2010 12:39:33 +0000 (13:39 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 11 Mar 2010 12:39:33 +0000 (13:39 +0100)
1  2 
kernel/trace/ftrace.c
kernel/trace/trace.c

diff --combined kernel/trace/ftrace.c
index 83783579378f3a19b0a13ac3a4ea1b3bd6f4a0b6,d0407c9f368cf7af5651b544144a05ba78593243..d4d1238b096bb1c54b2e35a0d3c564ad0b00f1b3
@@@ -22,6 -22,7 +22,6 @@@
  #include <linux/hardirq.h>
  #include <linux/kthread.h>
  #include <linux/uaccess.h>
 -#include <linux/kprobes.h>
  #include <linux/ftrace.h>
  #include <linux/sysctl.h>
  #include <linux/ctype.h>
@@@ -84,10 -85,6 +84,6 @@@ ftrace_func_t ftrace_trace_function __r
  ftrace_func_t __ftrace_trace_function __read_mostly = ftrace_stub;
  ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub;
  
- #ifdef CONFIG_FUNCTION_GRAPH_TRACER
- static int ftrace_set_func(unsigned long *array, int *idx, char *buffer);
- #endif
  static void ftrace_list_func(unsigned long ip, unsigned long parent_ip)
  {
        struct ftrace_ops *op = ftrace_list;
@@@ -897,6 -894,36 +893,6 @@@ static struct dyn_ftrace *ftrace_free_r
                }                               \
        }
  
 -#ifdef CONFIG_KPROBES
 -
 -static int frozen_record_count;
 -
 -static inline void freeze_record(struct dyn_ftrace *rec)
 -{
 -      if (!(rec->flags & FTRACE_FL_FROZEN)) {
 -              rec->flags |= FTRACE_FL_FROZEN;
 -              frozen_record_count++;
 -      }
 -}
 -
 -static inline void unfreeze_record(struct dyn_ftrace *rec)
 -{
 -      if (rec->flags & FTRACE_FL_FROZEN) {
 -              rec->flags &= ~FTRACE_FL_FROZEN;
 -              frozen_record_count--;
 -      }
 -}
 -
 -static inline int record_frozen(struct dyn_ftrace *rec)
 -{
 -      return rec->flags & FTRACE_FL_FROZEN;
 -}
 -#else
 -# define freeze_record(rec)                   ({ 0; })
 -# define unfreeze_record(rec)                 ({ 0; })
 -# define record_frozen(rec)                   ({ 0; })
 -#endif /* CONFIG_KPROBES */
 -
  static void ftrace_free_rec(struct dyn_ftrace *rec)
  {
        rec->freelist = ftrace_free_records;
@@@ -994,21 -1021,6 +990,21 @@@ static void ftrace_bug(int failed, unsi
  }
  
  
 +/* Return 1 if the address range is reserved for ftrace */
 +int ftrace_text_reserved(void *start, void *end)
 +{
 +      struct dyn_ftrace *rec;
 +      struct ftrace_page *pg;
 +
 +      do_for_each_ftrace_rec(pg, rec) {
 +              if (rec->ip <= (unsigned long)end &&
 +                  rec->ip + MCOUNT_INSN_SIZE > (unsigned long)start)
 +                      return 1;
 +      } while_for_each_ftrace_rec();
 +      return 0;
 +}
 +
 +
  static int
  __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
  {
@@@ -1060,6 -1072,14 +1056,6 @@@ static void ftrace_replace_code(int ena
                    !(rec->flags & FTRACE_FL_CONVERTED))
                        continue;
  
 -              /* ignore updates to this record's mcount site */
 -              if (get_kprobe((void *)rec->ip)) {
 -                      freeze_record(rec);
 -                      continue;
 -              } else {
 -                      unfreeze_record(rec);
 -              }
 -
                failed = __ftrace_replace_code(rec, enable);
                if (failed) {
                        rec->flags |= FTRACE_FL_FAILED;
@@@ -2276,6 -2296,8 +2272,8 @@@ __setup("ftrace_filter=", set_ftrace_fi
  
  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  static char ftrace_graph_buf[FTRACE_FILTER_SIZE] __initdata;
+ static int ftrace_set_func(unsigned long *array, int *idx, char *buffer);
  static int __init set_graph_function(char *str)
  {
        strlcpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE);
diff --combined kernel/trace/trace.c
index 5edf410bc54051e6f919274da0040f912c1fcda4,ababedb4e87fff254e55877a8298ba5b14958e66..6af8d7bc953be4fa45cf59f7a9cdc4546649ba95
@@@ -374,6 -374,21 +374,21 @@@ static int __init set_buf_size(char *st
  }
  __setup("trace_buf_size=", set_buf_size);
  
+ static int __init set_tracing_thresh(char *str)
+ {
+       unsigned long threshhold;
+       int ret;
+       if (!str)
+               return 0;
+       ret = strict_strtoul(str, 0, &threshhold);
+       if (ret < 0)
+               return 0;
+       tracing_thresh = threshhold * 1000;
+       return 1;
+ }
+ __setup("tracing_thresh=", set_tracing_thresh);
  unsigned long nsecs_to_usecs(unsigned long nsecs)
  {
        return nsecs / 1000;
@@@ -579,9 -594,10 +594,10 @@@ static ssize_t trace_seq_to_buffer(stru
  static arch_spinlock_t ftrace_max_lock =
        (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
  
+ unsigned long __read_mostly   tracing_thresh;
  #ifdef CONFIG_TRACER_MAX_TRACE
  unsigned long __read_mostly   tracing_max_latency;
- unsigned long __read_mostly   tracing_thresh;
  
  /*
   * Copy the new maximum trace into the separate maximum-trace
@@@ -592,7 -608,7 +608,7 @@@ static voi
  __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
  {
        struct trace_array_cpu *data = tr->data[cpu];
-       struct trace_array_cpu *max_data = tr->data[cpu];
+       struct trace_array_cpu *max_data;
  
        max_tr.cpu = cpu;
        max_tr.time_start = data->preempt_timestamp;
        max_data->critical_start = data->critical_start;
        max_data->critical_end = data->critical_end;
  
-       memcpy(data->comm, tsk->comm, TASK_COMM_LEN);
+       memcpy(max_data->comm, tsk->comm, TASK_COMM_LEN);
        max_data->pid = tsk->pid;
        max_data->uid = task_uid(tsk);
        max_data->nice = tsk->static_prio - 20 - MAX_RT_PRIO;
@@@ -1703,7 -1719,6 +1719,7 @@@ static void *s_start(struct seq_file *m
  
                ftrace_enable_cpu();
  
 +              iter->leftover = 0;
                for (p = iter; p && l < *pos; p = s_next(m, p, &l))
                        ;
  
@@@ -4249,10 -4264,10 +4265,10 @@@ static __init int tracer_init_debugfs(v
  #ifdef CONFIG_TRACER_MAX_TRACE
        trace_create_file("tracing_max_latency", 0644, d_tracer,
                        &tracing_max_latency, &tracing_max_lat_fops);
+ #endif
  
        trace_create_file("tracing_thresh", 0644, d_tracer,
                        &tracing_thresh, &tracing_max_lat_fops);
- #endif
  
        trace_create_file("README", 0444, d_tracer,
                        NULL, &tracing_readme_fops);