From: Ingo Molnar Date: Sat, 15 Aug 2009 10:06:12 +0000 (+0200) Subject: Merge branch 'perfcounters/urgent' into perfcounters/core X-Git-Tag: v2.6.32-rc1~720^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be750231ce1599b86fbba213e3da8344ece262e2;p=profile%2Fivi%2Fkernel-x86-ivi.git Merge branch 'perfcounters/urgent' into perfcounters/core Conflicts: kernel/perf_counter.c Merge reason: update to latest upstream (-rc6) and resolve the conflict with urgent fixes. Signed-off-by: Ingo Molnar --- be750231ce1599b86fbba213e3da8344ece262e2 diff --cc arch/x86/kernel/cpu/perf_counter.c index b237c18,900332b..396e35d --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c @@@ -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)) { diff --cc tools/perf/builtin-report.c index 93945ec,b53a60f..6321951 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@@ -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, diff --cc tools/perf/util/symbol.h index 50f7235,b53bf01..48b8e57 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@@ -6,8 -6,31 +6,32 @@@ #include #include #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 + #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;