Commit 3154da34 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Misc fixes, most of them on the tooling side"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tools: Fix strict alias issue for find_first_bit
  perf tools: fix BFD detection on opensuse
  perf: Fix hotplug splat
  perf/x86: Fix event scheduling
  perf symbols: Destroy unused symsrcs
  perf annotate: Check availability of annotate when processing samples
parents 55de1ed2 af76815a
...@@ -1192,6 +1192,9 @@ static void x86_pmu_del(struct perf_event *event, int flags) ...@@ -1192,6 +1192,9 @@ static void x86_pmu_del(struct perf_event *event, int flags)
for (i = 0; i < cpuc->n_events; i++) { for (i = 0; i < cpuc->n_events; i++) {
if (event == cpuc->event_list[i]) { if (event == cpuc->event_list[i]) {
if (i >= cpuc->n_events - cpuc->n_added)
--cpuc->n_added;
if (x86_pmu.put_event_constraints) if (x86_pmu.put_event_constraints)
x86_pmu.put_event_constraints(cpuc, event); x86_pmu.put_event_constraints(cpuc, event);
......
...@@ -7856,14 +7856,14 @@ static void perf_pmu_rotate_stop(struct pmu *pmu) ...@@ -7856,14 +7856,14 @@ static void perf_pmu_rotate_stop(struct pmu *pmu)
static void __perf_event_exit_context(void *__info) static void __perf_event_exit_context(void *__info)
{ {
struct perf_event_context *ctx = __info; struct perf_event_context *ctx = __info;
struct perf_event *event, *tmp; struct perf_event *event;
perf_pmu_rotate_stop(ctx->pmu); perf_pmu_rotate_stop(ctx->pmu);
list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry) rcu_read_lock();
__perf_remove_from_context(event); list_for_each_entry_rcu(event, &ctx->event_list, event_entry)
list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry)
__perf_remove_from_context(event); __perf_remove_from_context(event);
rcu_read_unlock();
} }
static void perf_event_exit_cpu_context(int cpu) static void perf_event_exit_cpu_context(int cpu)
...@@ -7887,11 +7887,11 @@ static void perf_event_exit_cpu(int cpu) ...@@ -7887,11 +7887,11 @@ static void perf_event_exit_cpu(int cpu)
{ {
struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
perf_event_exit_cpu_context(cpu);
mutex_lock(&swhash->hlist_mutex); mutex_lock(&swhash->hlist_mutex);
swevent_hlist_release(swhash); swevent_hlist_release(swhash);
mutex_unlock(&swhash->hlist_mutex); mutex_unlock(&swhash->hlist_mutex);
perf_event_exit_cpu_context(cpu);
} }
#else #else
static inline void perf_event_exit_cpu(int cpu) { } static inline void perf_event_exit_cpu(int cpu) { }
......
...@@ -113,6 +113,7 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati ...@@ -113,6 +113,7 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati
if (!he) if (!he)
return -ENOMEM; return -ENOMEM;
if (ui__has_annotation()) {
err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
if (err) if (err)
goto out; goto out;
...@@ -121,6 +122,7 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati ...@@ -121,6 +122,7 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati
err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx);
if (err) if (err)
goto out; goto out;
}
evsel->hists.stats.total_period += cost; evsel->hists.stats.total_period += cost;
hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);
...@@ -164,14 +166,18 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc ...@@ -164,14 +166,18 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc
he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL,
1, 1, 0); 1, 1, 0);
if (he) { if (he) {
if (ui__has_annotation()) {
bx = he->branch_info; bx = he->branch_info;
err = addr_map_symbol__inc_samples(&bx->from, evsel->idx); err = addr_map_symbol__inc_samples(&bx->from,
evsel->idx);
if (err) if (err)
goto out; goto out;
err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); err = addr_map_symbol__inc_samples(&bx->to,
evsel->idx);
if (err) if (err)
goto out; goto out;
}
evsel->hists.stats.total_period += 1; evsel->hists.stats.total_period += 1;
hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);
...@@ -205,7 +211,9 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs ...@@ -205,7 +211,9 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs
if (err) if (err)
goto out; goto out;
if (ui__has_annotation())
err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
evsel->hists.stats.total_period += sample->period; evsel->hists.stats.total_period += sample->period;
hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);
out: out:
......
...@@ -176,7 +176,7 @@ static void perf_top__record_precise_ip(struct perf_top *top, ...@@ -176,7 +176,7 @@ static void perf_top__record_precise_ip(struct perf_top *top,
{ {
struct annotation *notes; struct annotation *notes;
struct symbol *sym; struct symbol *sym;
int err; int err = 0;
if (he == NULL || he->ms.sym == NULL || if (he == NULL || he->ms.sym == NULL ||
((top->sym_filter_entry == NULL || ((top->sym_filter_entry == NULL ||
...@@ -190,6 +190,8 @@ static void perf_top__record_precise_ip(struct perf_top *top, ...@@ -190,6 +190,8 @@ static void perf_top__record_precise_ip(struct perf_top *top,
return; return;
ip = he->ms.map->map_ip(he->ms.map, ip); ip = he->ms.map->map_ip(he->ms.map, ip);
if (ui__has_annotation())
err = hist_entry__inc_addr_samples(he, counter, ip); err = hist_entry__inc_addr_samples(he, counter, ip);
pthread_mutex_unlock(&notes->lock); pthread_mutex_unlock(&notes->lock);
......
...@@ -478,7 +478,7 @@ else ...@@ -478,7 +478,7 @@ else
endif endif
ifeq ($(feature-libbfd), 1) ifeq ($(feature-libbfd), 1)
EXTLIBS += -lbfd EXTLIBS += -lbfd -lz -liberty
endif endif
ifdef NO_DEMANGLE ifdef NO_DEMANGLE
......
...@@ -121,7 +121,7 @@ test-libpython-version.bin: ...@@ -121,7 +121,7 @@ test-libpython-version.bin:
$(BUILD) $(FLAGS_PYTHON_EMBED) $(BUILD) $(FLAGS_PYTHON_EMBED)
test-libbfd.bin: test-libbfd.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
test-liberty.bin: test-liberty.bin:
$(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
*/ */
#include "util.h" #include "util.h"
#include "ui/ui.h"
#include "sort.h"
#include "build-id.h" #include "build-id.h"
#include "color.h" #include "color.h"
#include "cache.h" #include "cache.h"
...@@ -489,7 +491,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map, ...@@ -489,7 +491,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
{ {
struct annotation *notes; struct annotation *notes;
if (sym == NULL || use_browser != 1 || !sort__has_sym) if (sym == NULL)
return 0; return 0;
notes = symbol__annotation(sym); notes = symbol__annotation(sym);
...@@ -1399,3 +1401,8 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize) ...@@ -1399,3 +1401,8 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize)
{ {
return symbol__annotate(he->ms.sym, he->ms.map, privsize); return symbol__annotate(he->ms.sym, he->ms.map, privsize);
} }
bool ui__has_annotation(void)
{
return use_browser == 1 && sort__has_sym;
}
...@@ -151,6 +151,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); ...@@ -151,6 +151,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);
void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); void symbol__annotate_decay_histogram(struct symbol *sym, int evidx);
void disasm__purge(struct list_head *head); void disasm__purge(struct list_head *head);
bool ui__has_annotation(void);
int symbol__tty_annotate(struct symbol *sym, struct map *map, int symbol__tty_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, bool print_lines, struct perf_evsel *evsel, bool print_lines,
bool full_paths, int min_pcnt, int max_lines); bool full_paths, int min_pcnt, int max_lines);
......
...@@ -87,13 +87,15 @@ static __always_inline unsigned long __ffs(unsigned long word) ...@@ -87,13 +87,15 @@ static __always_inline unsigned long __ffs(unsigned long word)
return num; return num;
} }
typedef const unsigned long __attribute__((__may_alias__)) long_alias_t;
/* /*
* Find the first set bit in a memory region. * Find the first set bit in a memory region.
*/ */
static inline unsigned long static inline unsigned long
find_first_bit(const unsigned long *addr, unsigned long size) find_first_bit(const unsigned long *addr, unsigned long size)
{ {
const unsigned long *p = addr; long_alias_t *p = (long_alias_t *) addr;
unsigned long result = 0; unsigned long result = 0;
unsigned long tmp; unsigned long tmp;
......
...@@ -1336,6 +1336,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) ...@@ -1336,6 +1336,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
if (syms_ss && runtime_ss) if (syms_ss && runtime_ss)
break; break;
} else {
symsrc__destroy(ss);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment