Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 28 Feb 2010 18:20:25 +0000 (10:20 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 28 Feb 2010 18:20:25 +0000 (10:20 -0800)
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (172 commits)
  perf_event, amd: Fix spinlock initialization
  perf_event: Fix preempt warning in perf_clock()
  perf tools: Flush maps on COMM events
  perf_events, x86: Split PMU definitions into separate files
  perf annotate: Handle samples not at objdump output addr boundaries
  perf_events, x86: Remove superflous MSR writes
  perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in()
  perf_events, x86: AMD event scheduling
  perf_events: Add new start/stop PMU callbacks
  perf_events: Report the MMAP pgoff value in bytes
  perf annotate: Defer allocating sym_priv->hist array
  perf symbols: Improve debugging information about symtab origins
  perf top: Use a macro instead of a constant variable
  perf symbols: Check the right return variable
  perf/scripts: Tag syscall_name helper as not yet available
  perf/scripts: Add perf-trace-python Documentation
  perf/scripts: Remove unnecessary PyTuple resizes
  perf/scripts: Add syscall tracing scripts
  perf/scripts: Add Python scripting engine
  perf/scripts: Remove check-perf-trace from listed scripts
  ...

Fix trivial conflict in tools/perf/util/probe-event.c

18 files changed:
1  2 
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/hw_breakpoint.c
arch/x86/kernel/ptrace.c
include/linux/ftrace.h
include/linux/ftrace_event.h
include/linux/perf_event.h
include/linux/syscalls.h
include/trace/ftrace.h
include/trace/syscall.h
init/Kconfig
kernel/perf_event.c
kernel/sched.c
kernel/trace/ftrace.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_syscalls.c
tools/perf/builtin-top.c
tools/perf/util/event.c
tools/perf/util/probe-event.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -736,18 -835,8 +736,18 @@@ __attribute__((section("_ftrace_events"
   * }
   */
  
- #ifdef CONFIG_EVENT_PROFILE
+ #ifdef CONFIG_PERF_EVENTS
  
 +#undef __entry
 +#define __entry entry
 +
 +#undef __get_dynamic_array
 +#define __get_dynamic_array(field)    \
 +              ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
 +
 +#undef __get_str
 +#define __get_str(field) (char *)__get_dynamic_array(field)
 +
  #undef __perf_addr
  #define __perf_addr(a) __addr = (a)
  
Simple merge
diff --cc init/Kconfig
Simple merge
Simple merge
diff --cc kernel/sched.c
Simple merge
Simple merge
@@@ -1174,66 -1155,86 +1155,66 @@@ static int kretprobe_event_define_field
        return 0;
  }
  
 -static int __probe_event_show_format(struct trace_seq *s,
 -                                   struct trace_probe *tp, const char *fmt,
 -                                   const char *arg)
 +static int __set_print_fmt(struct trace_probe *tp, char *buf, int len)
  {
        int i;
 +      int pos = 0;
  
 -      /* Show format */
 -      if (!trace_seq_printf(s, "\nprint fmt: \"%s", fmt))
 -              return 0;
 +      const char *fmt, *arg;
  
 -      for (i = 0; i < tp->nr_args; i++)
 -              if (!trace_seq_printf(s, " %s=%%lx", tp->args[i].name))
 -                      return 0;
 +      if (!probe_is_return(tp)) {
 +              fmt = "(%lx)";
 +              arg = "REC->" FIELD_STRING_IP;
 +      } else {
 +              fmt = "(%lx <- %lx)";
 +              arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
 +      }
  
 -      if (!trace_seq_printf(s, "\", %s", arg))
 -              return 0;
 +      /* When len=0, we just calculate the needed length */
 +#define LEN_OR_ZERO (len ? len - pos : 0)
  
 -      for (i = 0; i < tp->nr_args; i++)
 -              if (!trace_seq_printf(s, ", REC->%s", tp->args[i].name))
 -                      return 0;
 +      pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
  
 -      return trace_seq_puts(s, "\n");
 -}
 +      for (i = 0; i < tp->nr_args; i++) {
 +              pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%%lx",
 +                              tp->args[i].name);
 +      }
  
 -#undef SHOW_FIELD
 -#define SHOW_FIELD(type, item, name)                                  \
 -      do {                                                            \
 -              ret = trace_seq_printf(s, "\tfield:" #type " %s;\t"     \
 -                              "offset:%u;\tsize:%u;\tsigned:%d;\n", name,\
 -                              (unsigned int)offsetof(typeof(field), item),\
 -                              (unsigned int)sizeof(type),             \
 -                              is_signed_type(type));                  \
 -              if (!ret)                                               \
 -                      return 0;                                       \
 -      } while (0)
 +      pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
  
 -static int kprobe_event_show_format(struct ftrace_event_call *call,
 -                                  struct trace_seq *s)
 -{
 -      struct kprobe_trace_entry field __attribute__((unused));
 -      int ret, i;
 -      struct trace_probe *tp = (struct trace_probe *)call->data;
 -
 -      SHOW_FIELD(unsigned long, ip, FIELD_STRING_IP);
 -      SHOW_FIELD(int, nargs, FIELD_STRING_NARGS);
 +      for (i = 0; i < tp->nr_args; i++) {
 +              pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s",
 +                              tp->args[i].name);
 +      }
  
 -      /* Show fields */
 -      for (i = 0; i < tp->nr_args; i++)
 -              SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
 -      trace_seq_puts(s, "\n");
 +#undef LEN_OR_ZERO
  
 -      return __probe_event_show_format(s, tp, "(%lx)",
 -                                       "REC->" FIELD_STRING_IP);
 +      /* return the length of print_fmt */
 +      return pos;
  }
  
 -static int kretprobe_event_show_format(struct ftrace_event_call *call,
 -                                     struct trace_seq *s)
 +static int set_print_fmt(struct trace_probe *tp)
  {
 -      struct kretprobe_trace_entry field __attribute__((unused));
 -      int ret, i;
 -      struct trace_probe *tp = (struct trace_probe *)call->data;
 +      int len;
 +      char *print_fmt;
  
 -      SHOW_FIELD(unsigned long, func, FIELD_STRING_FUNC);
 -      SHOW_FIELD(unsigned long, ret_ip, FIELD_STRING_RETIP);
 -      SHOW_FIELD(int, nargs, FIELD_STRING_NARGS);
 +      /* First: called with 0 length to calculate the needed length */
 +      len = __set_print_fmt(tp, NULL, 0);
 +      print_fmt = kmalloc(len + 1, GFP_KERNEL);
 +      if (!print_fmt)
 +              return -ENOMEM;
  
 -      /* Show fields */
 -      for (i = 0; i < tp->nr_args; i++)
 -              SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
 -      trace_seq_puts(s, "\n");
 +      /* Second: actually write the @print_fmt */
 +      __set_print_fmt(tp, print_fmt, len + 1);
 +      tp->call.print_fmt = print_fmt;
  
 -      return __probe_event_show_format(s, tp, "(%lx <- %lx)",
 -                                       "REC->" FIELD_STRING_FUNC
 -                                       ", REC->" FIELD_STRING_RETIP);
 +      return 0;
  }
  
- #ifdef CONFIG_EVENT_PROFILE
+ #ifdef CONFIG_PERF_EVENTS
  
  /* Kprobe profile handler */
- static __kprobes int kprobe_profile_func(struct kprobe *kp,
+ static __kprobes void kprobe_profile_func(struct kprobe *kp,
                                         struct pt_regs *regs)
  {
        struct trace_probe *tp = container_of(kp, struct trace_probe, rp.kp);
Simple merge
Simple merge
Simple merge
@@@ -457,7 -493,8 +495,9 @@@ void show_perf_probe_events(void
        struct strlist *rawlist;
        struct str_node *ent;
  
+       setup_pager();
 +      memset(&pp, 0, sizeof(pp));
        fd = open_kprobe_events(O_RDONLY, 0);
        rawlist = get_trace_kprobe_event_rawlist(fd);
        close(fd);