From: Ingo Molnar Date: Sat, 15 Aug 2009 10:06:12 +0000 (+0200) Subject: Merge branch 'perfcounters/urgent' into perfcounters/core X-Git-Tag: Ubuntu-5.10.0-12.13~31701^2~43 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=be750231ce1599b86fbba213e3da8344ece262e2;p=mirror_ubuntu-hirsute-kernel.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 b237c181aa41,900332b800f8..396e35db7058 --- 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 93945ecdac86,b53a60fc12de..6321951fe1bf --- 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 50f723571241,b53bf0125c1b..48b8e5759af9 --- 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;