Commit dd3190ee 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:
 "Tooling changes only: it includes the ARM tooling fixlets, various
  other fixes, smaller updates, minor cleanups"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf record: Add an option to force per-cpu mmaps
  perf probe: Add '--demangle'/'--no-demangle'
  perf ui browser: Fix segfault caused by off by one handling END key
  perf symbols: Limit max callchain using max_stack on DWARF unwinding too
  perf evsel: Introduce perf_evsel__prev() method
  perf tools: Use perf_evlist__{first,last}, perf_evsel__next
  perf tools: Synthesize anon MMAP records again
  perf top: Add missing newline if the 'uid' is invalid
  perf tools: Remove trivial extra semincolon
  perf trace: Tweak summary output
  tools/perf/build: Fix feature-libunwind-debug-frame handling
  tools/perf/build: Fix timerfd feature check
parents b29c8306 89b4be14
...@@ -201,6 +201,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. ...@@ -201,6 +201,12 @@ abort events and some memory events in precise mode on modern Intel CPUs.
--transaction:: --transaction::
Record transaction flags for transaction related events. Record transaction flags for transaction related events.
--force-per-cpu::
Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p,
-t or -u options) per-thread mmaps are created. This option overrides that and
forces per-cpu mmaps. A side-effect of that is that inheritance is
automatically enabled. Add the -i option also to disable inheritance.
SEE ALSO SEE ALSO
-------- --------
linkperf:perf-stat[1], linkperf:perf-list[1] linkperf:perf-stat[1], linkperf:perf-list[1]
...@@ -325,6 +325,8 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -325,6 +325,8 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
opt_set_filter), opt_set_filter),
OPT_CALLBACK('x', "exec", NULL, "executable|path", OPT_CALLBACK('x', "exec", NULL, "executable|path",
"target executable name or path", opt_set_target), "target executable name or path", opt_set_target),
OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
"Disable symbol demangling"),
OPT_END() OPT_END()
}; };
int ret; int ret;
......
...@@ -888,6 +888,8 @@ const struct option record_options[] = { ...@@ -888,6 +888,8 @@ const struct option record_options[] = {
"sample by weight (on special events only)"), "sample by weight (on special events only)"),
OPT_BOOLEAN(0, "transaction", &record.opts.sample_transaction, OPT_BOOLEAN(0, "transaction", &record.opts.sample_transaction,
"sample transaction flags (special events only)"), "sample transaction flags (special events only)"),
OPT_BOOLEAN(0, "force-per-cpu", &record.opts.target.force_per_cpu,
"force the use of per-cpu mmaps"),
OPT_END() OPT_END()
}; };
......
...@@ -1172,7 +1172,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1172,7 +1172,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
status = target__validate(target); status = target__validate(target);
if (status) { if (status) {
target__strerror(target, status, errbuf, BUFSIZ); target__strerror(target, status, errbuf, BUFSIZ);
ui__warning("%s", errbuf); ui__warning("%s\n", errbuf);
} }
status = target__parse_uid(target); status = target__parse_uid(target);
...@@ -1180,7 +1180,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1180,7 +1180,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
int saved_errno = errno; int saved_errno = errno;
target__strerror(target, status, errbuf, BUFSIZ); target__strerror(target, status, errbuf, BUFSIZ);
ui__error("%s", errbuf); ui__error("%s\n", errbuf);
status = -saved_errno; status = -saved_errno;
goto out_delete_evlist; goto out_delete_evlist;
......
...@@ -2112,9 +2112,9 @@ static size_t thread__dump_stats(struct thread_trace *ttrace, ...@@ -2112,9 +2112,9 @@ static size_t thread__dump_stats(struct thread_trace *ttrace,
printed += fprintf(fp, "\n"); printed += fprintf(fp, "\n");
printed += fprintf(fp, " msec/call\n"); printed += fprintf(fp, " syscall calls min avg max stddev\n");
printed += fprintf(fp, " syscall calls min avg max stddev\n"); printed += fprintf(fp, " (msec) (msec) (msec) (%%)\n");
printed += fprintf(fp, " --------------- -------- -------- -------- -------- ------\n"); printed += fprintf(fp, " --------------- -------- --------- --------- --------- ------\n");
/* each int_node is a syscall */ /* each int_node is a syscall */
while (inode) { while (inode) {
...@@ -2131,9 +2131,9 @@ static size_t thread__dump_stats(struct thread_trace *ttrace, ...@@ -2131,9 +2131,9 @@ static size_t thread__dump_stats(struct thread_trace *ttrace,
sc = &trace->syscalls.table[inode->i]; sc = &trace->syscalls.table[inode->i];
printed += fprintf(fp, " %-15s", sc->name); printed += fprintf(fp, " %-15s", sc->name);
printed += fprintf(fp, " %8" PRIu64 " %8.3f %8.3f", printed += fprintf(fp, " %8" PRIu64 " %9.3f %9.3f",
n, min, avg); n, min, avg);
printed += fprintf(fp, " %8.3f %6.2f\n", max, pct); printed += fprintf(fp, " %9.3f %9.2f%%\n", max, pct);
} }
inode = intlist__next(inode); inode = intlist__next(inode);
......
...@@ -142,7 +142,8 @@ CORE_FEATURE_TESTS = \ ...@@ -142,7 +142,8 @@ CORE_FEATURE_TESTS = \
libunwind \ libunwind \
on-exit \ on-exit \
stackprotector \ stackprotector \
stackprotector-all stackprotector-all \
timerfd
# #
# So here we detect whether test-all was rebuilt, to be able # So here we detect whether test-all was rebuilt, to be able
...@@ -328,8 +329,14 @@ ifndef NO_LIBUNWIND ...@@ -328,8 +329,14 @@ ifndef NO_LIBUNWIND
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1); msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
NO_LIBUNWIND := 1 NO_LIBUNWIND := 1
else else
ifneq ($(feature-libunwind-debug-frame), 1) ifeq ($(ARCH),arm)
msg := $(warning No debug_frame support found in libunwind); $(call feature_check,libunwind-debug-frame)
ifneq ($(feature-libunwind-debug-frame), 1)
msg := $(warning No debug_frame support found in libunwind);
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
endif
else
# non-ARM has no dwarf_find_debug_frame() function:
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
endif endif
endif endif
...@@ -405,7 +412,6 @@ else ...@@ -405,7 +412,6 @@ else
endif endif
endif endif
$(call feature_check,timerfd)
ifeq ($(feature-timerfd), 1) ifeq ($(feature-timerfd), 1)
CFLAGS += -DHAVE_TIMERFD_SUPPORT CFLAGS += -DHAVE_TIMERFD_SUPPORT
else else
......
...@@ -76,6 +76,9 @@ test-libnuma: ...@@ -76,6 +76,9 @@ test-libnuma:
test-libunwind: test-libunwind:
$(BUILD) $(LIBUNWIND_LIBS) -lelf $(BUILD) $(LIBUNWIND_LIBS) -lelf
test-libunwind-debug-frame:
$(BUILD) $(LIBUNWIND_LIBS) -lelf
test-libaudit: test-libaudit:
$(BUILD) -laudit $(BUILD) -laudit
......
...@@ -49,10 +49,6 @@ ...@@ -49,10 +49,6 @@
# include "test-libunwind.c" # include "test-libunwind.c"
#undef main #undef main
#define main main_test_libunwind_debug_frame
# include "test-libunwind-debug-frame.c"
#undef main
#define main main_test_libaudit #define main main_test_libaudit
# include "test-libaudit.c" # include "test-libaudit.c"
#undef main #undef main
......
...@@ -441,9 +441,8 @@ static int test__checkevent_pmu_name(struct perf_evlist *evlist) ...@@ -441,9 +441,8 @@ static int test__checkevent_pmu_name(struct perf_evlist *evlist)
static int test__checkevent_pmu_events(struct perf_evlist *evlist) static int test__checkevent_pmu_events(struct perf_evlist *evlist)
{ {
struct perf_evsel *evsel; struct perf_evsel *evsel = perf_evlist__first(evlist);
evsel = list_entry(evlist->entries.next, struct perf_evsel, node);
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
TEST_ASSERT_VAL("wrong exclude_user", TEST_ASSERT_VAL("wrong exclude_user",
......
...@@ -569,7 +569,7 @@ void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence) ...@@ -569,7 +569,7 @@ void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence)
browser->top = browser->top + browser->top_idx + offset; browser->top = browser->top + browser->top_idx + offset;
break; break;
case SEEK_END: case SEEK_END:
browser->top = browser->top + browser->nr_entries + offset; browser->top = browser->top + browser->nr_entries - 1 + offset;
break; break;
default: default:
return; return;
...@@ -680,7 +680,7 @@ static void __ui_browser__line_arrow_down(struct ui_browser *browser, ...@@ -680,7 +680,7 @@ static void __ui_browser__line_arrow_down(struct ui_browser *browser,
if (end >= browser->top_idx + browser->height) if (end >= browser->top_idx + browser->height)
end_row = browser->height - 1; end_row = browser->height - 1;
else else
end_row = end - browser->top_idx;; end_row = end - browser->top_idx;
ui_browser__gotorc(browser, row, column); ui_browser__gotorc(browser, row, column);
SLsmg_draw_vline(end_row - row + 1); SLsmg_draw_vline(end_row - row + 1);
......
...@@ -1847,15 +1847,15 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -1847,15 +1847,15 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
switch (key) { switch (key) {
case K_TAB: case K_TAB:
if (pos->node.next == &evlist->entries) if (pos->node.next == &evlist->entries)
pos = list_entry(evlist->entries.next, struct perf_evsel, node); pos = perf_evlist__first(evlist);
else else
pos = list_entry(pos->node.next, struct perf_evsel, node); pos = perf_evsel__next(pos);
goto browse_hists; goto browse_hists;
case K_UNTAB: case K_UNTAB:
if (pos->node.prev == &evlist->entries) if (pos->node.prev == &evlist->entries)
pos = list_entry(evlist->entries.prev, struct perf_evsel, node); pos = perf_evlist__last(evlist);
else else
pos = list_entry(pos->node.prev, struct perf_evsel, node); pos = perf_evsel__prev(pos);
goto browse_hists; goto browse_hists;
case K_ESC: case K_ESC:
if (!ui_browser__dialog_yesno(&menu->b, if (!ui_browser__dialog_yesno(&menu->b,
...@@ -1943,8 +1943,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, ...@@ -1943,8 +1943,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
single_entry: single_entry:
if (nr_entries == 1) { if (nr_entries == 1) {
struct perf_evsel *first = list_entry(evlist->entries.next, struct perf_evsel *first = perf_evlist__first(evlist);
struct perf_evsel, node);
const char *ev_name = perf_evsel__name(first); const char *ev_name = perf_evsel__name(first);
return perf_evsel__hists_browse(first, nr_entries, help, return perf_evsel__hists_browse(first, nr_entries, help,
......
...@@ -209,8 +209,10 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, ...@@ -209,8 +209,10 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
&event->mmap.start, &event->mmap.len, prot, &event->mmap.start, &event->mmap.len, prot,
&event->mmap.pgoff, &event->mmap.pgoff,
execname); execname);
/*
if (n != 5) * Anon maps don't have the execname.
*/
if (n < 4)
continue; continue;
/* /*
* Just like the kernel, see __perf_event_mmap in kernel/perf_event.c * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c
......
...@@ -819,7 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) ...@@ -819,7 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
if (evlist->threads == NULL) if (evlist->threads == NULL)
return -1; return -1;
if (target__has_task(target)) if (target->force_per_cpu)
evlist->cpus = cpu_map__new(target->cpu_list);
else if (target__has_task(target))
evlist->cpus = cpu_map__dummy_new(); evlist->cpus = cpu_map__dummy_new();
else if (!target__has_cpu(target) && !target->uses_mmap) else if (!target__has_cpu(target) && !target->uses_mmap)
evlist->cpus = cpu_map__dummy_new(); evlist->cpus = cpu_map__dummy_new();
...@@ -1148,7 +1150,7 @@ size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp) ...@@ -1148,7 +1150,7 @@ size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp)
perf_evsel__name(evsel)); perf_evsel__name(evsel));
} }
return printed + fprintf(fp, "\n");; return printed + fprintf(fp, "\n");
} }
int perf_evlist__strerror_tp(struct perf_evlist *evlist __maybe_unused, int perf_evlist__strerror_tp(struct perf_evlist *evlist __maybe_unused,
......
...@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel, ...@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
} }
} }
if (target__has_cpu(&opts->target)) if (target__has_cpu(&opts->target) || opts->target.force_per_cpu)
perf_evsel__set_sample_bit(evsel, CPU); perf_evsel__set_sample_bit(evsel, CPU);
if (opts->period) if (opts->period)
...@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel, ...@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
if (!perf_missing_features.sample_id_all && if (!perf_missing_features.sample_id_all &&
(opts->sample_time || !opts->no_inherit || (opts->sample_time || !opts->no_inherit ||
target__has_cpu(&opts->target))) target__has_cpu(&opts->target) || opts->target.force_per_cpu))
perf_evsel__set_sample_bit(evsel, TIME); perf_evsel__set_sample_bit(evsel, TIME);
if (opts->raw_samples) { if (opts->raw_samples) {
......
...@@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) ...@@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel)
return list_entry(evsel->node.next, struct perf_evsel, node); return list_entry(evsel->node.next, struct perf_evsel, node);
} }
static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel)
{
return list_entry(evsel->node.prev, struct perf_evsel, node);
}
/** /**
* perf_evsel__is_group_leader - Return whether given evsel is a leader event * perf_evsel__is_group_leader - Return whether given evsel is a leader event
* *
......
...@@ -1368,7 +1368,7 @@ int machine__resolve_callchain(struct machine *machine, ...@@ -1368,7 +1368,7 @@ int machine__resolve_callchain(struct machine *machine,
return unwind__get_entries(unwind_entry, &callchain_cursor, machine, return unwind__get_entries(unwind_entry, &callchain_cursor, machine,
thread, evsel->attr.sample_regs_user, thread, evsel->attr.sample_regs_user,
sample); sample, max_stack);
} }
......
...@@ -12,6 +12,7 @@ struct target { ...@@ -12,6 +12,7 @@ struct target {
uid_t uid; uid_t uid;
bool system_wide; bool system_wide;
bool uses_mmap; bool uses_mmap;
bool force_per_cpu;
}; };
enum target_errno { enum target_errno {
......
...@@ -559,7 +559,7 @@ static unw_accessors_t accessors = { ...@@ -559,7 +559,7 @@ static unw_accessors_t accessors = {
}; };
static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
void *arg) void *arg, int max_stack)
{ {
unw_addr_space_t addr_space; unw_addr_space_t addr_space;
unw_cursor_t c; unw_cursor_t c;
...@@ -575,7 +575,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, ...@@ -575,7 +575,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
if (ret) if (ret)
display_error(ret); display_error(ret);
while (!ret && (unw_step(&c) > 0)) { while (!ret && (unw_step(&c) > 0) && max_stack--) {
unw_word_t ip; unw_word_t ip;
unw_get_reg(&c, UNW_REG_IP, &ip); unw_get_reg(&c, UNW_REG_IP, &ip);
...@@ -588,7 +588,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, ...@@ -588,7 +588,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
int unwind__get_entries(unwind_entry_cb_t cb, void *arg, int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine, struct thread *thread, struct machine *machine, struct thread *thread,
u64 sample_uregs, struct perf_sample *data) u64 sample_uregs, struct perf_sample *data,
int max_stack)
{ {
unw_word_t ip; unw_word_t ip;
struct unwind_info ui = { struct unwind_info ui = {
...@@ -610,5 +611,5 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, ...@@ -610,5 +611,5 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
if (ret) if (ret)
return -ENOMEM; return -ENOMEM;
return get_entries(&ui, cb, arg); return get_entries(&ui, cb, arg, max_stack);
} }
...@@ -18,7 +18,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, ...@@ -18,7 +18,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine, struct machine *machine,
struct thread *thread, struct thread *thread,
u64 sample_uregs, u64 sample_uregs,
struct perf_sample *data); struct perf_sample *data, int max_stack);
int unwind__arch_reg_id(int regnum); int unwind__arch_reg_id(int regnum);
#else #else
static inline int static inline int
...@@ -27,7 +27,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, ...@@ -27,7 +27,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
struct machine *machine __maybe_unused, struct machine *machine __maybe_unused,
struct thread *thread __maybe_unused, struct thread *thread __maybe_unused,
u64 sample_uregs __maybe_unused, u64 sample_uregs __maybe_unused,
struct perf_sample *data __maybe_unused) struct perf_sample *data __maybe_unused,
int max_stack __maybe_unused)
{ {
return 0; return 0;
} }
......
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