Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo-4.15-20171117' of git://git.kernel.org…
Browse files Browse the repository at this point in the history
…/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

- Optimize sample parsing for ordering events, where we don't need to parse
  all the PERF_SAMPLE_ bits, just the ones leading to the timestamp needed
  to reorder events (Jiri Olsa)

- Use a dummy event to ask for PERF_RECORD_{MMAP,COMM,EXEC} with
  'perf record --delay', when the events asked by the user will only be
  enabled after the workload is started and the requested delay passes,
  so we need to add the dummy event and have it .enabled_on_exec. This
  then allows us to resolve symbols for the DSO executable MMAPs setup
  while we wait for the delay (Arnaldo Carvalho de Melo)

- Synchronize kcmp.h and prctl.h ABI headers wrt SPDX tags (Arnaldo Carvalho de Melo)

- Generalize the annotation code to support other source information
  besides objdump/DWARF obtained ones, starting with python scripts,
  that will is slated to be merged soon (Jiri Olsa)

- Advance the source code lines to right after the column with the
  address in asm lines (Jiri Olsa)

- Fix terminal dimensions resizing signal handling in 'perf top --stdio' (Jiri Olsa)

- Improve error messages for PMU events (Kim Phillips)

- Fix 'perf record' -c/-F options for cpu event aliases (Andi Kleen)

- Enable type checking for perf_evsel_config_term types (Andi Kleen)

- Call machine__exit() at 'perf trace' exit, so as to remove temporary
  files related to VDSO (Andrei Vagin)

- Add "reject" option to parse-events.l, fixing the build with newer
  flex releases. Noticed with flex 2.6.4 on Alpine Linux 3.6 and Edge (Jiri Olsa)

- Document some missing perf.data headers (Andi Kleen)

- Allow printing period for non freq mod groups (Andi Kleen)

- Do not warn the user about kernel.kptr_restrict when not sampling the
  kernel (Arnaldo Carvalho de Melo)

- Fix bug in 'perf help' introduced during conversion to strstart() (Namhyung Kim)

- Do not truncate ASM instruction mnemonics at 6 characters in the annotation
  output, PowerPC has long ones (Ravi Bangoria)

- Document some missing command line options (Sihyeon Jang)

- Update POWER9 vendor event tables (Sukadev Bhattiprolu)

- Fix 'perf test' shell entries on s390x, where the 'openat' syscall
  is used instead of 'open' in one of the tests and

- No need to use overwrite mmap mode in 'perf test', those tests
  do not generate massive amount of events to fill the ring buffer (Wang Nan)

- Add missing command line options (mostly --force/-f) to the man pages (Sihyeon Jang)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Nov 18, 2017
2 parents b29c6ef + 05d3f1a commit 754fe00
Show file tree
Hide file tree
Showing 52 changed files with 1,028 additions and 920 deletions.
5 changes: 4 additions & 1 deletion kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -6640,6 +6640,7 @@ static void perf_event_namespaces_output(struct perf_event *event,
struct perf_namespaces_event *namespaces_event = data;
struct perf_output_handle handle;
struct perf_sample_data sample;
u16 header_size = namespaces_event->event_id.header.size;
int ret;

if (!perf_event_namespaces_match(event))
Expand All @@ -6650,7 +6651,7 @@ static void perf_event_namespaces_output(struct perf_event *event,
ret = perf_output_begin(&handle, event,
namespaces_event->event_id.header.size);
if (ret)
return;
goto out;

namespaces_event->event_id.pid = perf_event_pid(event,
namespaces_event->task);
Expand All @@ -6662,6 +6663,8 @@ static void perf_event_namespaces_output(struct perf_event *event,
perf_event__output_id_sample(event, &handle, &sample);

perf_output_end(&handle);
out:
namespaces_event->event_id.header.size = header_size;
}

static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
Expand Down
1 change: 1 addition & 0 deletions tools/include/uapi/linux/kcmp.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_KCMP_H
#define _UAPI_LINUX_KCMP_H

Expand Down
1 change: 1 addition & 0 deletions tools/include/uapi/linux/prctl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_PRCTL_H
#define _LINUX_PRCTL_H

Expand Down
3 changes: 3 additions & 0 deletions tools/perf/Documentation/perf-buildid-cache.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ OPTIONS
-a::
--add=::
Add specified file to the cache.
-f::
--force::
Don't complain, do it.
-k::
--kcore::
Add specified kcore file to the cache. For the current host that is
Expand Down
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-evlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ OPTIONS
--input=::
Input file name. (default: perf.data unless stdin is a fifo)

-f::
--force::
Don't complain, do it.

-F::
--freq=::
Show just the sample frequency used for each event.
Expand Down
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-inject.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ include::itrace.txt[]
found in the jitdumps files captured in the input perf.data file. Use this option
if you are monitoring environment using JIT runtimes, such as Java, DART or V8.

-f::
--force::
Don't complain, do it.

SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-archive[1]
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ COMMON OPTIONS
--dump-raw-trace::
Dump raw trace in ASCII.

-f::
--force::
Don't complan, do it.

REPORT OPTIONS
--------------

Expand Down
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-sched.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ OPTIONS
--dump-raw-trace=::
Display verbose dump of the sched data.

-f::
--force::
Don't complain, do it.

OPTIONS for 'perf sched map'
----------------------------

Expand Down
4 changes: 3 additions & 1 deletion tools/perf/Documentation/perf-timechart.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ TIMECHART OPTIONS
-p::
--process::
Select the processes to display, by name or PID

-f::
--force::
Don't complain, do it.
--symfs=<directory>::
Look for files with symbols relative to this directory.
-n::
Expand Down
6 changes: 6 additions & 0 deletions tools/perf/Documentation/perf-top.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ INTERACTIVE PROMPTING KEYS
[S]::
Stop annotation, return to full profile display.

[K]::
Hide kernel symbols.

[U]::
Hide user symbols.

[z]::
Toggle event count zeroing across display updates.

Expand Down
16 changes: 10 additions & 6 deletions tools/perf/Documentation/perf-trace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-
In per-thread mode with inheritance mode on (default), Events are captured only when
the thread executes on the designated CPUs. Default is to monitor all CPUs.

--duration:
--duration::
Show only events that had a duration greater than N.M ms.

--sched:
--sched::
Accrue thread runtime and provide a summary at the end of the session.

-i
--input
-i::
--input::
Process events from a given perf data file.

-T
--time
-T::
--time::
Print full timestamp rather time relative to first sample.

--comm::
Expand All @@ -117,6 +117,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
Show tool stats such as number of times fd->pathname was discovered thru
hooking the open syscall return + vfs_getname or via reading /proc/pid/fd, etc.

-f::
--force::
Don't complain, do it.

-F=[all|min|maj]::
--pf=[all|min|maj]::
Trace pagefaults. Optionally, you can specify whether you want minor,
Expand Down
23 changes: 23 additions & 0 deletions tools/perf/Documentation/perf.data-file-format.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,29 @@ struct auxtrace_index {
struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
};

HEADER_STAT = 19,

This is merely a flag signifying that the data section contains data
recorded from perf stat record.

HEADER_CACHE = 20,

Description of the cache hierarchy. Based on the Linux sysfs format
in /sys/devices/system/cpu/cpu*/cache/

u32 version Currently always 1
u32 number_of_cache_levels

struct {
u32 level;
u32 line_size;
u32 sets;
u32 ways;
struct perf_header_string type;
struct perf_header_string size;
struct perf_header_string map;
}[number_of_cache_levels];

other bits are reserved and should ignored for now
HEADER_FEAT_BITS = 256,

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ else
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)

ifneq ($(feature-libperl), 1)
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-buildid-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ int cmd_buildid_cache(int argc, const char **argv)
"file", "kcore file to add"),
OPT_STRING('r', "remove", &remove_name_list_str, "file list",
"file(s) to remove"),
OPT_STRING('p', "purge", &purge_name_list_str, "path list",
"path(s) to remove (remove old caches too)"),
OPT_STRING('p', "purge", &purge_name_list_str, "file list",
"file(s) to remove (remove old caches too)"),
OPT_STRING('M', "missing", &missing_filename, "file",
"to find missing build ids in the cache"),
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
Expand Down
8 changes: 4 additions & 4 deletions tools/perf/builtin-c2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -2224,9 +2224,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
struct hist_browser *browser;
int key = -1;
const char help[] =
" ENTER Togle callchains (if present) \n"
" n Togle Node details info \n"
" s Togle full lenght of symbol and source line columns \n"
" ENTER Toggle callchains (if present) \n"
" n Toggle Node details info \n"
" s Toggle full length of symbol and source line columns \n"
" q Return back to cacheline list \n";

/* Display compact version first. */
Expand Down Expand Up @@ -2303,7 +2303,7 @@ static int perf_c2c__hists_browse(struct hists *hists)
int key = -1;
const char help[] =
" d Display cacheline details \n"
" ENTER Togle callchains (if present) \n"
" ENTER Toggle callchains (if present) \n"
" q Quit \n";

browser = perf_c2c_browser__new(hists);
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-help.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static int perf_help_config(const char *var, const char *value, void *cb)
add_man_viewer(value);
return 0;
}
if (!strstarts(var, "man."))
if (strstarts(var, "man."))
return add_man_viewer_info(var, value);

return 0;
Expand Down Expand Up @@ -314,7 +314,7 @@ static const char *cmd_to_page(const char *perf_cmd)

if (!perf_cmd)
return "perf";
else if (!strstarts(perf_cmd, "perf"))
else if (strstarts(perf_cmd, "perf"))
return perf_cmd;

return asprintf(&s, "perf-%s", perf_cmd) < 0 ? NULL : s;
Expand Down
8 changes: 4 additions & 4 deletions tools/perf/builtin-kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,20 +741,20 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
u64 *mmap_time)
{
union perf_event *event;
struct perf_sample sample;
u64 timestamp;
s64 n = 0;
int err;

*mmap_time = ULLONG_MAX;
while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) {
err = perf_evlist__parse_sample(kvm->evlist, event, &sample);
err = perf_evlist__parse_sample_timestamp(kvm->evlist, event, &timestamp);
if (err) {
perf_evlist__mmap_consume(kvm->evlist, idx);
pr_err("Failed to parse sample\n");
return -1;
}

err = perf_session__queue_event(kvm->session, event, &sample, 0);
err = perf_session__queue_event(kvm->session, event, timestamp, 0);
/*
* FIXME: Here we can't consume the event, as perf_session__queue_event will
* point to it, and it'll get possibly overwritten by the kernel.
Expand All @@ -768,7 +768,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,

/* save time stamp of our first sample for this mmap */
if (n == 0)
*mmap_time = sample.time;
*mmap_time = timestamp;

/* limit events per mmap handled all at once */
n++;
Expand Down
42 changes: 30 additions & 12 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,22 @@ static int record__open(struct record *rec)
struct perf_evsel_config_term *err_term;
int rc = 0;

/*
* For initial_delay we need to add a dummy event so that we can track
* PERF_RECORD_MMAP while we wait for the initial delay to enable the
* real events, the ones asked by the user.
*/
if (opts->initial_delay) {
if (perf_evlist__add_dummy(evlist))
return -ENOMEM;

pos = perf_evlist__first(evlist);
pos->tracking = 0;
pos = perf_evlist__last(evlist);
pos->tracking = 1;
pos->attr.enable_on_exec = 1;
}

perf_evlist__config(evlist, opts, &callchain_param);

evlist__for_each_entry(evlist, pos) {
Expand Down Expand Up @@ -749,17 +765,19 @@ static int record__synthesize(struct record *rec, bool tail)
goto out;
}

err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
machine);
WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n"
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
"Check /proc/kallsyms permission or run as root.\n");

err = perf_event__synthesize_modules(tool, process_synthesized_event,
machine);
WARN_ONCE(err < 0, "Couldn't record kernel module information.\n"
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
"Check /proc/modules permission or run as root.\n");
if (!perf_evlist__exclude_kernel(rec->evlist)) {
err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
machine);
WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n"
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
"Check /proc/kallsyms permission or run as root.\n");

err = perf_event__synthesize_modules(tool, process_synthesized_event,
machine);
WARN_ONCE(err < 0, "Couldn't record kernel module information.\n"
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
"Check /proc/modules permission or run as root.\n");
}

if (perf_guest) {
machines__process_guests(&session->machines,
Expand Down Expand Up @@ -1693,7 +1711,7 @@ int cmd_record(int argc, const char **argv)

err = -ENOMEM;

if (symbol_conf.kptr_restrict)
if (symbol_conf.kptr_restrict && !perf_evlist__exclude_kernel(rec->evlist))
pr_warning(
"WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,\n"
"check /proc/sys/kernel/kptr_restrict.\n\n"
Expand Down
3 changes: 3 additions & 0 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ static void report__warn_kptr_restrict(const struct report *rep)
struct map *kernel_map = machine__kernel_map(&rep->session->machines.host);
struct kmap *kernel_kmap = kernel_map ? map__kmap(kernel_map) : NULL;

if (perf_evlist__exclude_kernel(rep->session->evlist))
return;

if (kernel_map == NULL ||
(kernel_map->dso->hit &&
(kernel_kmap->ref_reloc_sym == NULL ||
Expand Down
Loading

0 comments on commit 754fe00

Please sign in to comment.