Merge branch 'perfcounters/urgent' into perfcounters/core
authorIngo Molnar <mingo@elte.hu>
Sat, 15 Aug 2009 10:06:12 +0000 (12:06 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 15 Aug 2009 10:06:12 +0000 (12:06 +0200)
Conflicts:
kernel/perf_counter.c

Merge reason: update to latest upstream (-rc6) and resolve
              the conflict with urgent fixes.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
1  2 
arch/x86/kernel/cpu/perf_counter.c
tools/perf/Makefile
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h

@@@ -97,10 -55,9 +97,11 @@@ struct x86_pmu 
        int             num_counters_fixed;
        int             counter_bits;
        u64             counter_mask;
+       int             apic;
        u64             max_period;
        u64             intel_ctrl;
 +      void            (*enable_bts)(u64 config);
 +      void            (*disable_bts)(void);
  };
  
  static struct x86_pmu x86_pmu __read_mostly;
@@@ -704,106 -663,9 +710,107 @@@ static void release_pmc_hardware(void
  
        if (nmi_watchdog == NMI_LOCAL_APIC)
                enable_lapic_nmi_watchdog();
+ #endif
  }
  
 +static inline bool bts_available(void)
 +{
 +      return x86_pmu.enable_bts != NULL;
 +}
 +
 +static inline void init_debug_store_on_cpu(int cpu)
 +{
 +      struct debug_store *ds = per_cpu(cpu_hw_counters, cpu).ds;
 +
 +      if (!ds)
 +              return;
 +
 +      wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA,
 +                   (u32)((u64)(long)ds), (u32)((u64)(long)ds >> 32));
 +}
 +
 +static inline void fini_debug_store_on_cpu(int cpu)
 +{
 +      if (!per_cpu(cpu_hw_counters, cpu).ds)
 +              return;
 +
 +      wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
 +}
 +
 +static void release_bts_hardware(void)
 +{
 +      int cpu;
 +
 +      if (!bts_available())
 +              return;
 +
 +      get_online_cpus();
 +
 +      for_each_online_cpu(cpu)
 +              fini_debug_store_on_cpu(cpu);
 +
 +      for_each_possible_cpu(cpu) {
 +              struct debug_store *ds = per_cpu(cpu_hw_counters, cpu).ds;
 +
 +              if (!ds)
 +                      continue;
 +
 +              per_cpu(cpu_hw_counters, cpu).ds = NULL;
 +
 +              kfree((void *)(long)ds->bts_buffer_base);
 +              kfree(ds);
 +      }
 +
 +      put_online_cpus();
 +}
 +
 +static int reserve_bts_hardware(void)
 +{
 +      int cpu, err = 0;
 +
 +      if (!bts_available())
 +              return -EOPNOTSUPP;
 +
 +      get_online_cpus();
 +
 +      for_each_possible_cpu(cpu) {
 +              struct debug_store *ds;
 +              void *buffer;
 +
 +              err = -ENOMEM;
 +              buffer = kzalloc(BTS_BUFFER_SIZE, GFP_KERNEL);
 +              if (unlikely(!buffer))
 +                      break;
 +
 +              ds = kzalloc(sizeof(*ds), GFP_KERNEL);
 +              if (unlikely(!ds)) {
 +                      kfree(buffer);
 +                      break;
 +              }
 +
 +              ds->bts_buffer_base = (u64)(long)buffer;
 +              ds->bts_index = ds->bts_buffer_base;
 +              ds->bts_absolute_maximum =
 +                      ds->bts_buffer_base + BTS_BUFFER_SIZE;
 +              ds->bts_interrupt_threshold =
 +                      ds->bts_absolute_maximum - BTS_OVFL_TH;
 +
 +              per_cpu(cpu_hw_counters, cpu).ds = ds;
 +              err = 0;
 +      }
 +
 +      if (err)
 +              release_bts_hardware();
 +      else {
 +              for_each_online_cpu(cpu)
 +                      init_debug_store_on_cpu(cpu);
 +      }
 +
 +      put_online_cpus();
 +
 +      return err;
 +}
 +
  static void hw_perf_counter_destroy(struct perf_counter *counter)
  {
        if (atomic_dec_and_mutex_lock(&active_counters, &pmc_reserve_mutex)) {
Simple merge
Simple merge
@@@ -1360,9 -1611,9 +1361,9 @@@ static in
  process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
  {
        struct thread *thread = threads__findnew(event->mmap.pid);
 -      struct map *map = map__new(&event->mmap);
 +      struct map *map = map__new(&event->mmap, cwd, cwdlen);
  
-       dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n",
+       dprintf("%p [%p]: PERF_EVENT_MMAP %d/%d: [%p(%p) @ %p]: %s\n",
                (void *)(offset + head),
                (void *)(long)(event->header.size),
                event->mmap.pid,
Simple merge
@@@ -6,8 -6,31 +6,32 @@@
  #include <linux/list.h>
  #include <linux/rbtree.h>
  #include "module.h"
 +#include "event.h"
  
+ #ifdef HAVE_CPLUS_DEMANGLE
+ extern char *cplus_demangle(const char *, int);
+ static inline char *bfd_demangle(void __used *v, const char *c, int i)
+ {
+       return cplus_demangle(c, i);
+ }
+ #else
+ #ifdef NO_DEMANGLE
+ static inline char *bfd_demangle(void __used *v, const char __used *c,
+                                int __used i)
+ {
+       return NULL;
+ }
+ #else
+ #include <bfd.h>
+ #endif
+ #endif
+ #ifndef DMGL_PARAMS
+ #define DMGL_PARAMS      (1 << 0)       /* Include function args */
+ #define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
+ #endif
  struct symbol {
        struct rb_node  rb_node;
        u64             start;