Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorIngo Molnar <mingo@elte.hu>
Tue, 17 Mar 2009 09:37:37 +0000 (10:37 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 17 Mar 2009 09:37:37 +0000 (10:37 +0100)
1  2 
kernel/trace/trace.c
kernel/trace/trace.h

diff --combined kernel/trace/trace.c
index ae32d3b99b4b07b55509f7145598bc783b8ace41,8f89690230e6516cbca2628fd5d88e99070c5df3..1ce6208fd727205f25850e2ed13aa63265da76f0
@@@ -770,30 -770,34 +770,34 @@@ static void trace_save_cmdline(struct t
        __raw_spin_unlock(&trace_cmdline_lock);
  }
  
char *trace_find_cmdline(int pid)
void trace_find_cmdline(int pid, char comm[])
  {
-       char *cmdline = "<...>";
        unsigned map;
  
-       if (!pid)
-               return "<idle>";
+       if (!pid) {
+               strcpy(comm, "<idle>");
+               return;
+       }
  
-       if (pid > PID_MAX_DEFAULT)
-               goto out;
+       if (pid > PID_MAX_DEFAULT) {
+               strcpy(comm, "<...>");
+               return;
+       }
  
+       __raw_spin_lock(&trace_cmdline_lock);
        map = map_pid_to_cmdline[pid];
        if (map >= SAVED_CMDLINES)
                goto out;
  
-       cmdline = saved_cmdlines[map];
+       strcpy(comm, saved_cmdlines[map]);
  
   out:
-       return cmdline;
+       __raw_spin_unlock(&trace_cmdline_lock);
  }
  
  void tracing_record_cmdline(struct task_struct *tsk)
  {
-       if (atomic_read(&trace_record_cmdline_disabled))
+       if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
                return;
  
        trace_save_cmdline(tsk);
@@@ -2494,7 -2498,7 +2498,7 @@@ static int tracing_set_tracer(const cha
        if (!ring_buffer_expanded) {
                ret = tracing_resize_ring_buffer(trace_buf_size);
                if (ret < 0)
 -                      return ret;
 +                      goto out;
                ret = 0;
        }
  
@@@ -4125,8 -4129,7 +4129,8 @@@ __init static int tracer_alloc_buffers(
                                       &trace_panic_notifier);
  
        register_die_notifier(&trace_die_notifier);
 -      ret = 0;
 +
 +      return 0;
  
  out_free_cpumask:
        free_cpumask_var(tracing_reader_cpumask);
diff --combined kernel/trace/trace.h
index f56162806f50d6c8405e70a21684314b851573ad,b0ecad8ecc34b0c968220991913f893f4d399f27..546bcbd92a0c9ef6e79cb6a4209fbb77853999b2
@@@ -202,19 -202,6 +202,19 @@@ struct kmemtrace_free_entry 
        const void *ptr;
  };
  
 +struct syscall_trace_enter {
 +      struct trace_entry      ent;
 +      int                     nr;
 +      unsigned long           args[];
 +};
 +
 +struct syscall_trace_exit {
 +      struct trace_entry      ent;
 +      int                     nr;
 +      unsigned long           ret;
 +};
 +
 +
  /*
   * trace_flag_type is an enumeration that holds different
   * states when a trace occurs. These are:
@@@ -328,10 -315,6 +328,10 @@@ extern void __ftrace_bad_type(void)
                          TRACE_KMEM_ALLOC);    \
                IF_ASSIGN(var, ent, struct kmemtrace_free_entry,        \
                          TRACE_KMEM_FREE);     \
 +              IF_ASSIGN(var, ent, struct syscall_trace_enter,         \
 +                        TRACE_SYSCALL_ENTER);                         \
 +              IF_ASSIGN(var, ent, struct syscall_trace_exit,          \
 +                        TRACE_SYSCALL_EXIT);                          \
                __ftrace_bad_type();                                    \
        } while (0)
  
@@@ -564,7 -547,7 +564,7 @@@ struct tracer_switch_ops 
  };
  #endif /* CONFIG_CONTEXT_SWITCH_TRACER */
  
- extern char *trace_find_cmdline(int pid);
+ extern void trace_find_cmdline(int pid, char comm[]);
  
  #ifdef CONFIG_DYNAMIC_FTRACE
  extern unsigned long ftrace_update_tot_cnt;