* [GIT PULL 00/40] perf/core improvements and fixes
@ 2017-07-26 14:16 Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 01/40] perf intel-pt: Set no_aux_samples for the tracking event Arnaldo Carvalho de Melo
` (40 more replies)
0 siblings, 41 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, Alexander Shishkin, Andi Kleen,
Arun Kalyanasundaram, Brendan Gregg, Dan Carpenter,
Daniel Borkmann, David Ahern, David Carrillo-Cisneros,
David S . Miller, Elena Reshetova, Hendrik Brueckner, Jiri Olsa,
Josh Poimboeuf, Kan Liang, Kees Cook
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 510457ec9dc259b002879bcfe475f89d4514a0fc:
Merge tag 'perf-core-for-mingo-4.13-20170718' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-07-20 10:31:52 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.14-20170725
for you to fetch changes up to 62e6039f02888efdd824e8c596c4927616a97ce3:
perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST (2017-07-25 22:46:37 -0300)
----------------------------------------------------------------
perf/core improvemends and fixes for v4.14:
New features:
- Filter out 'sshd' in the tracer ancestry in 'perf trace' syswide tracing,
to elliminate tracing loops (Arnaldo Carvalho de Melo)
- Support lookup of symbols in other mount namespaces in 'perf top' (Krister Johansen)
- Initial 'clone' syscall args beautifier in 'perf trace' (Arnaldo Carvalho de Melo)
User visible:
- Ignore 'fd' and 'offset' args for MAP_ANONYMOUS in 'perf trace'
(Arnaldo Carvalho de Melo)
- Process tracing data in 'perf annotate' pipe mode (David Carrillo-Cisneros)
- Make 'perf report --branch-history' work without callgraphs(-g) option
in perf record (Jin Yao)
- Tag branch type/flag on "to" and tag cycles on "from" in 'perf report' (Jin Yao)
Fixes:
- Fix jvmti linker error when libelf config is disabled (Sudeep Holla)
- Fix cgroups refcount usage (Arnaldo Carvalho de Melo)
- Fix kernel symbol adjustment for s390x (Thomas Richter)
- Fix 'perf report --stdio --show-total-period', it was showing the
number of samples, not the total period (Taeung Song)
Infrastructure:
- Add perf_sample dictionary to tracepoint handlers in 'perf script'
python, which were already present for other types of events
(hardware, etc) (Arun Kalyanasundaram)
- Make build fail on vendor events JSON parse error (Andi Kleen)
- Adopt strstarts() from the kernel (Arnaldo Carvalho de Melo)
Arch specific:
- Set no_aux_samples for the tracking event in Intel PT (Kan Liang)
- Always set no branch for Intel PT dummy event (Kan Liang)
Trivial:
- Simplify some error handlers in 'perf script' (Dan Carpenter)
- Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile (David Carrillo-Cisneros)
----------------------------------------------------------------
Andi Kleen (1):
perf jevents: Make build fail on JSON parse error
Arnaldo Carvalho de Melo (16):
perf trace: Add missing ' = ' in the default formatting of syscall returns
perf trace beauty mmap: Ignore 'fd' and 'offset' args for MAP_ANONYMOUS
perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint
perf trace: Use the syscall_fmt formatters without a tracepoint
perf trace: Ditch __syscall__arg_val() variant, not needed anymore
perf trace: Allow specifying number of syscall args for tracepointless syscalls
perf trace: Allow specifying names to syscall arguments formatters
tools include uapi: Grab a copy of linux/sched.h
perf trace beauty clone: Beautify syscall arguments
perf trace beauty clone: Suppress unused args according to 'flags' arg
perf trace: Introduce filter_loop_pids()
perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing
tools include: Adopt strstarts() from the kernel
tools lib: Update copy of strtobool from the kernel sources
perf cgroup: Fix refcount usage
perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST
Arun Kalyanasundaram (5):
perf script python: Allocate memory only if handler exists
perf script python: Refactor creation of perf sample dict
perf script python: Add sample_read to dict
perf script python: Add perf_sample dict to tracepoint handlers
perf script python: Generate hooks with additional argument
Dan Carpenter (1):
perf script: Remove some bogus error handling
David Carrillo-Cisneros (2):
perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile
perf annotate: Process tracing data in pipe mode
Jin Yao (2):
perf report: Make --branch-history work without callgraphs(-g) option in perf record
perf report: Tag branch type/flag on "to" and tag cycles on "from"
Jiri Olsa (1):
perf evsel: Add verbose output for sys_perf_event_open fallback
Kan Liang (2):
perf intel-pt: Set no_aux_samples for the tracking event
perf intel-pt: Always set no branch for dummy event
Krister Johansen (1):
perf top: Support lookup of symbols in other mount namespaces.
Sudeep Holla (1):
perf jvmti: Fix linker error when libelf config is disabled
Taeung Song (7):
perf annotate: Introduce struct sym_hist_entry
perf annotate: Rename 'sum' to 'nr_samples' in struct sym_hist
perf hists: Pass perf_sample to __symbol__inc_addr_samples()
perf annotate: Store the sample period in each histogram bucket
perf annotate: Do not overwrite sample->period
perf annotate stdio: Fix --show-total-period
perf annotate stdio: Fix column header when using --show-total-period
Thomas Richter (1):
perf report: Fix kernel symbol adjustment for s390x
tools/include/linux/string.h | 12 +-
tools/include/uapi/linux/sched.h | 52 +++++
tools/lib/string.c | 41 ++--
tools/lib/subcmd/help.c | 2 +-
tools/lib/subcmd/parse-options.c | 18 +-
tools/perf/Documentation/perf-top.txt | 4 +
tools/perf/MANIFEST | 2 +
tools/perf/Makefile.perf | 10 +-
tools/perf/arch/s390/util/Build | 1 +
tools/perf/arch/s390/util/sym-handling.c | 22 ++
tools/perf/arch/x86/util/intel-pt.c | 3 +
tools/perf/builtin-annotate.c | 4 +-
tools/perf/builtin-config.c | 3 +-
tools/perf/builtin-ftrace.c | 2 +-
tools/perf/builtin-help.c | 6 +-
tools/perf/builtin-report.c | 27 ++-
tools/perf/builtin-script.c | 7 +-
tools/perf/builtin-top.c | 20 +-
tools/perf/builtin-trace.c | 140 ++++++++----
tools/perf/check-headers.sh | 1 +
tools/perf/perf.c | 16 +-
tools/perf/pmu-events/README | 4 -
tools/perf/pmu-events/jevents.c | 21 +-
tools/perf/trace/beauty/Build | 1 +
tools/perf/trace/beauty/beauty.h | 3 +
tools/perf/trace/beauty/clone.c | 75 +++++++
tools/perf/trace/beauty/mmap.c | 3 +
tools/perf/ui/browser.c | 3 +-
tools/perf/ui/browsers/annotate.c | 9 +-
tools/perf/ui/gtk/annotate.c | 4 +-
tools/perf/ui/stdio/hist.c | 3 +-
tools/perf/util/annotate.c | 99 +++++----
tools/perf/util/annotate.h | 18 +-
tools/perf/util/bpf-loader.c | 2 +-
tools/perf/util/branch.h | 11 +-
tools/perf/util/callchain.c | 157 +++++++++----
tools/perf/util/cgroup.c | 8 +-
tools/perf/util/config.c | 13 +-
tools/perf/util/evsel.c | 8 +
tools/perf/util/hist.c | 2 +
tools/perf/util/llvm-utils.c | 2 +-
tools/perf/util/machine.c | 13 +-
.../util/scripting-engines/trace-event-python.c | 246 +++++++++++++++------
43 files changed, 798 insertions(+), 300 deletions(-)
create mode 100644 tools/include/uapi/linux/sched.h
create mode 100644 tools/perf/arch/s390/util/sym-handling.c
create mode 100644 tools/perf/trace/beauty/clone.c
Test results:
The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.
Where clang is available, it is also used to build perf with/without libelf.
Several are cross builds, the ones with -x-ARCH and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.
The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.
Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.
[root@jouet ~]# waitp 7228 ; time dm
1 alpine:3.4: Ok
2 alpine:3.5: Ok
3 alpine:3.6: Ok
4 alpine:edge: Ok
5 android-ndk:r12b-arm: Ok
6 archlinux:latest: Ok
7 centos:5: Ok
8 centos:6: Ok
9 centos:7: Ok
10 debian:7: Ok
11 debian:8: Ok
12 debian:9: Ok
13 debian:experimental: Ok
14 debian:experimental-x-arm64: Ok
15 debian:experimental-x-mips: Ok
16 debian:experimental-x-mips64: Ok
17 debian:experimental-x-mipsel: Ok
18 fedora:20: Ok
19 fedora:21: Ok
20 fedora:22: Ok
21 fedora:23: Ok
22 fedora:24: Ok
23 fedora:24-x-ARC-uClibc: Ok
24 fedora:25: Ok
25 fedora:26: Ok
26 fedora:rawhide: FAIL
/usr/bin/ld: /tmp/build/perf/perf-in.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/build/perf/libperf.a(libperf-in.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.perf:426: /tmp/build/perf/perf] Error 1
make[1]: *** [Makefile.perf:210: sub-make] Error 2
27 mageia:5: Ok
28 opensuse:13.2: Ok
29 opensuse:42.1: Ok
30 opensuse:42.2: Ok
31 opensuse:tumbleweed: Ok
32 oraclelinux:6: Ok
33 oraclelinux:7: Ok
34 ubuntu:12.04.5: Ok
35 ubuntu:14.04.4: Ok
36 ubuntu:14.04.4-x-linaro-arm64: Ok
37 ubuntu:15.10: Ok
38 ubuntu:16.04: Ok
39 ubuntu:16.04-x-arm: Ok
40 ubuntu:16.04-x-arm64: Ok
41 ubuntu:16.04-x-powerpc: Ok
42 ubuntu:16.04-x-powerpc64: Ok
43 ubuntu:16.04-x-powerpc64el: Ok
44 ubuntu:16.04-x-s390: Ok
45 ubuntu:16.10: Ok
46 ubuntu:17.04: Ok
47 ubuntu:17.10: Ok
#
# uname -a
Linux jouet 4.12.0-rc6+ #3 SMP Tue Jun 27 15:12:38 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
# perf test
1: vmlinux symtab matches kallsyms : Ok
2: Detect openat syscall event : Ok
3: Detect openat syscall event on all cpus : Ok
4: Read samples using the mmap interface : Ok
5: Parse event definition strings : Ok
6: Simple expression parser : Ok
7: PERF_RECORD_* events & perf_sample fields : Ok
8: Parse perf pmu format : Ok
9: DSO data read : Ok
10: DSO data cache : Ok
11: DSO data reopen : Ok
12: Roundtrip evsel->name : Ok
13: Parse sched tracepoints fields : Ok
14: syscalls:sys_enter_openat event fields : Ok
15: Setup struct perf_event_attr : Ok
16: Match and link multiple hists : Ok
17: 'import perf' in python : Ok
18: Breakpoint overflow signal handler : Ok
19: Breakpoint overflow sampling : Ok
20: Number of exit events of a simple workload : Ok
21: Software clock events period values : Ok
22: Object code reading : Ok
23: Sample parsing : Ok
24: Use a dummy software event to keep tracking: Ok
25: Parse with no sample_id_all bit set : Ok
26: Filter hist entries : Ok
27: Lookup mmap thread : Ok
28: Share thread mg : Ok
29: Sort output of hist entries : Ok
30: Cumulate child hist entries : Ok
31: Track with sched_switch : Ok
32: Filter fds with revents mask in a fdarray : Ok
33: Add fd to a fdarray, making it autogrow : Ok
34: kmod_path__parse : Ok
35: Thread map : Ok
36: LLVM search and compile :
36.1: Basic BPF llvm compile : Ok
36.2: kbuild searching : Ok
36.3: Compile source for BPF prologue generation: Ok
36.4: Compile source for BPF relocation : Ok
37: Session topology : Ok
38: BPF filter :
38.1: Basic BPF filtering : Ok
38.2: BPF pinning : Ok
38.3: BPF prologue generation : Ok
38.4: BPF relocation checker : Ok
39: Synthesize thread map : Ok
40: Remove thread map : Ok
41: Synthesize cpu map : Ok
42: Synthesize stat config : Ok
43: Synthesize stat : Ok
44: Synthesize stat round : Ok
45: Synthesize attr update : Ok
46: Event times : Ok
47: Read backward ring buffer : Ok
48: Print cpu map : Ok
49: Probe SDT events : Ok
50: is_printable_array : Ok
51: Print bitmap : Ok
52: perf hooks : Ok
53: builtin clang support : Skip (not compiled in)
54: unit_number__scnprintf : Ok
55: x86 rdpmc : Ok
56: Convert perf time to TSC : Ok
57: DWARF unwind : Ok
58: x86 instruction decoder - new instructions : Ok
59: Intel cqm nmi context read : Skip
#
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_no_demangle_O: make NO_DEMANGLE=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_no_libbpf_O: make NO_LIBBPF=1
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_gtk2_O: make NO_GTK2=1
make_no_libperl_O: make NO_LIBPERL=1
make_no_newt_O: make NO_NEWT=1
make_pure_O: make
make_no_auxtrace_O: make NO_AUXTRACE=1
make_util_map_o_O: make util/map.o
make_help_O: make help
make_no_libnuma_O: make NO_LIBNUMA=1
make_install_bin_O: make install-bin
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_install_O: make install
make_no_slang_O: make NO_SLANG=1
make_static_O: make LDFLAGS=-static
make_tags_O: make tags
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_perf_o_O: make perf.o
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_doc_O: make doc
make_no_libunwind_O: make NO_LIBUNWIND=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_libelf_O: make NO_LIBELF=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_clean_all_O: make clean all
make_debug_O: make DEBUG=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_install_prefix_O: make install prefix=/tmp/krava
make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'
$
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 01/40] perf intel-pt: Set no_aux_samples for the tracking event
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 02/40] perf intel-pt: Always set no branch for dummy event Arnaldo Carvalho de Melo
` (39 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Kan Liang, Adrian Hunter,
Alexander Shishkin, Andi Kleen, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Kan Liang <kan.liang@intel.com>
The reason of introducing the tracking event (a dummy software event) is
to collect side-band information. Additional sampling is wasteful.
no_aux_samples should be set for tracking event.
Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170630141656.1626-1-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/util/intel-pt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 9535be57033f..4a461e8ae326 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -752,6 +752,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
tracking_evsel->attr.freq = 0;
tracking_evsel->attr.sample_period = 1;
+ tracking_evsel->no_aux_samples = true;
if (need_immediate)
tracking_evsel->immediate = true;
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 02/40] perf intel-pt: Always set no branch for dummy event
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 01/40] perf intel-pt: Set no_aux_samples for the tracking event Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 03/40] perf trace: Add missing ' = ' in the default formatting of syscall returns Arnaldo Carvalho de Melo
` (38 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Kan Liang, Adrian Hunter,
Alexander Shishkin, Andi Kleen, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Kan Liang <kan.liang@intel.com>
An earlier kernel patch allowed enabling PT and LBR at the same time on
Goldmont.
commit ccbebba4c6bf ("perf/x86/intel/pt: Bypass PT vs. LBR exclusivity
if the core supports it")
However, users still cannot use Intel PT and LBRs simultaneously. $
sudo perf record -e cycles,intel_pt//u -b -- sleep 1 Error: PMU
Hardware doesn't support sampling/overflow-interrupts.
PT implicitly adds dummy event in perf tool. dummy event is software
event which doesn't support LBR.
Always setting no branch for dummy event in Intel PT.
Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170630141656.1626-2-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/util/intel-pt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 4a461e8ae326..db0ba8caf5a2 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -701,6 +701,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
perf_evsel__set_sample_bit(switch_evsel, TID);
perf_evsel__set_sample_bit(switch_evsel, TIME);
perf_evsel__set_sample_bit(switch_evsel, CPU);
+ perf_evsel__reset_sample_bit(switch_evsel, BRANCH_STACK);
opts->record_switch_events = false;
ptr->have_sched_switch = 3;
@@ -762,6 +763,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
/* And the CPU for switch events */
perf_evsel__set_sample_bit(tracking_evsel, CPU);
}
+ perf_evsel__reset_sample_bit(tracking_evsel, BRANCH_STACK);
}
/*
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 03/40] perf trace: Add missing ' = ' in the default formatting of syscall returns
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 01/40] perf intel-pt: Set no_aux_samples for the tracking event Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 02/40] perf intel-pt: Always set no branch for dummy event Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 04/40] perf trace beauty mmap: Ignore 'fd' and 'offset' args for MAP_ANONYMOUS Arnaldo Carvalho de Melo
` (37 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We lost it recently, put it back.
Before:
789.499 ( 0.001 ms): libvirtd/1175 lseek(fd: 22, whence: CUR) 4328
After:
789.499 ( 0.001 ms): libvirtd/1175 lseek(fd: 22, whence: CUR) = 4328
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 1f63139c3f8a ("perf trace beauty: Simplify syscall return formatting")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 1e4c0657b712..4370ce4f28c7 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1660,7 +1660,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
if (ret < 0)
goto errno_print;
signed_print:
- fprintf(trace->output, ") %ld", ret);
+ fprintf(trace->output, ") = %ld", ret);
} else if (ret < 0) {
errno_print: {
char bf[STRERR_BUFSIZE];
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 04/40] perf trace beauty mmap: Ignore 'fd' and 'offset' args for MAP_ANONYMOUS
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 03/40] perf trace: Add missing ' = ' in the default formatting of syscall returns Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 05/40] perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint Arnaldo Carvalho de Melo
` (36 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Just suppress them, not used by the kernel.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-atpt07y2x9a8ttlwja94ow3j@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/mmap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c
index af1cfde6b97b..754558f9009d 100644
--- a/tools/perf/trace/beauty/mmap.c
+++ b/tools/perf/trace/beauty/mmap.c
@@ -34,6 +34,9 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
{
int printed = 0, flags = arg->val;
+ if (flags & MAP_ANONYMOUS)
+ arg->mask |= (1 << 4) | (1 << 5); /* Mask 4th ('fd') and 5th ('offset') args, ignored */
+
#define P_MMAP_FLAG(n) \
if (flags & MAP_##n) { \
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 05/40] perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 04/40] perf trace beauty mmap: Ignore 'fd' and 'offset' args for MAP_ANONYMOUS Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 06/40] perf trace: Use the syscall_fmt formatters without a tracepoint Arnaldo Carvalho de Melo
` (35 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
At least "clone" doesn't have (enter, exit) entries tracefs/events/syscalls/,
but we can provide a syscall_fmt and use it instead, as will be done for
"clone" in the next cset.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-o12kejgcxddyovn2hlg4gbim@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 4370ce4f28c7..1c5238af6d14 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1165,22 +1165,31 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
return err;
}
-static int syscall__set_arg_fmts(struct syscall *sc)
+static int syscall__alloc_arg_fmts(struct syscall *sc, int nr_args)
{
- struct format_field *field;
- int idx = 0, len;
+ int idx;
- sc->arg_fmt = calloc(sc->nr_args, sizeof(*sc->arg_fmt));
+ sc->arg_fmt = calloc(nr_args, sizeof(*sc->arg_fmt));
if (sc->arg_fmt == NULL)
return -1;
- for (field = sc->args; field; field = field->next, ++idx) {
- if (sc->fmt) {
+ for (idx = 0; idx < nr_args; ++idx) {
+ if (sc->fmt)
sc->arg_fmt[idx] = sc->fmt->arg[idx];
+ }
- if (sc->fmt->arg[idx].scnprintf)
- continue;
- }
+ sc->nr_args = nr_args;
+ return 0;
+}
+
+static int syscall__set_arg_fmts(struct syscall *sc)
+{
+ struct format_field *field;
+ int idx = 0, len;
+
+ for (field = sc->args; field; field = field->next, ++idx) {
+ if (sc->fmt && sc->fmt->arg[idx].scnprintf)
+ continue;
if (strcmp(field->type, "const char *") == 0 &&
(strcmp(field->name, "filename") == 0 ||
@@ -1251,11 +1260,13 @@ static int trace__read_syscall_info(struct trace *trace, int id)
sc->tp_format = trace_event__tp_format("syscalls", tp_name);
}
+ if (syscall__alloc_arg_fmts(sc, IS_ERR(sc->tp_format) ? 6 : sc->tp_format->format.nr_fields))
+ return -1;
+
if (IS_ERR(sc->tp_format))
return -1;
sc->args = sc->tp_format->format.fields;
- sc->nr_args = sc->tp_format->format.nr_fields;
/*
* We need to check and discard the first variable '__syscall_nr'
* or 'nr' that mean the syscall number. It is needless here.
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 06/40] perf trace: Use the syscall_fmt formatters without a tracepoint
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 05/40] perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 07/40] perf trace: Ditch __syscall__arg_val() variant, not needed anymore Arnaldo Carvalho de Melo
` (34 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Previously we only used the syscall_fmt when we had sc->tp_format set,
i.e. when we found the (enter, exit) pair in tracefs/events/syscalls/.
But we really only need to use what is in sc->arg_fmt to apply the arg
beautifiers to the syscall argument values, so do it.
With this we will be able to provide formatters to the "clone" syscall,
which doesn't have entries in tracefs/events/syscalls/.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-y41nl41jrayjo5ucnde2peix@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 54 +++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 1c5238af6d14..fc4d33a6aa58 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1350,12 +1350,32 @@ unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx)
return __syscall_arg__val(arg->args, idx);
}
+static size_t syscall__scnprintf_val(struct syscall *sc, char *bf, size_t size,
+ struct syscall_arg *arg, unsigned long val)
+{
+ if (sc->arg_fmt && sc->arg_fmt[arg->idx].scnprintf) {
+ arg->val = val;
+ if (sc->arg_fmt[arg->idx].parm)
+ arg->parm = sc->arg_fmt[arg->idx].parm;
+ return sc->arg_fmt[arg->idx].scnprintf(bf, size, arg);
+ }
+ return scnprintf(bf, size, "%ld", val);
+}
+
static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
unsigned char *args, struct trace *trace,
struct thread *thread)
{
size_t printed = 0;
unsigned long val;
+ u8 bit = 1;
+ struct syscall_arg arg = {
+ .args = args,
+ .idx = 0,
+ .mask = 0,
+ .trace = trace,
+ .thread = thread,
+ };
struct thread_trace *ttrace = thread__priv(thread);
/*
@@ -1367,14 +1387,6 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
if (sc->args != NULL) {
struct format_field *field;
- u8 bit = 1;
- struct syscall_arg arg = {
- .args = args,
- .idx = 0,
- .mask = 0,
- .trace = trace,
- .thread = thread,
- };
for (field = sc->args; field;
field = field->next, ++arg.idx, bit <<= 1) {
@@ -1398,15 +1410,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
printed += scnprintf(bf + printed, size - printed,
"%s%s: ", printed ? ", " : "", field->name);
- if (sc->arg_fmt && sc->arg_fmt[arg.idx].scnprintf) {
- arg.val = val;
- if (sc->arg_fmt[arg.idx].parm)
- arg.parm = sc->arg_fmt[arg.idx].parm;
- printed += sc->arg_fmt[arg.idx].scnprintf(bf + printed, size - printed, &arg);
- } else {
- printed += scnprintf(bf + printed, size - printed,
- "%ld", val);
- }
+ printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val);
}
} else if (IS_ERR(sc->tp_format)) {
/*
@@ -1414,14 +1418,16 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
* may end up not having any args, like with gettid(), so only
* print the raw args when we didn't manage to read it.
*/
- int i = 0;
-
- while (i < 6) {
- val = __syscall_arg__val(args, i);
+ while (arg.idx < 6) {
+ if (arg.mask & bit)
+ goto next_arg;
+ val = syscall_arg__val(&arg, arg.idx);
printed += scnprintf(bf + printed, size - printed,
- "%sarg%d: %ld",
- printed ? ", " : "", i, val);
- ++i;
+ "%sarg%d: ", printed ? ", " : "", arg.idx);
+ printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val);
+next_arg:
+ ++arg.idx;
+ bit <<= 1;
}
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 07/40] perf trace: Ditch __syscall__arg_val() variant, not needed anymore
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 06/40] perf trace: Use the syscall_fmt formatters without a tracepoint Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 08/40] perf trace: Allow specifying number of syscall args for tracepointless syscalls Arnaldo Carvalho de Melo
` (33 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
All callers now can use syscall__arg_val(arg, idx), be it to iterate
thru the syscall arguments while taking into account alignment, or to
get values for other arguments that affect how the current argument
should be formatted (think of fcntl's 'cmd' and 'arg' arguments).
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-wm5b156d8kro1r4y3b33eyta@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index fc4d33a6aa58..f8b7bfdf4ee7 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1336,20 +1336,15 @@ static int trace__validate_ev_qualifier(struct trace *trace)
* variable to read it. Most notably this avoids extended load instructions
* on unaligned addresses
*/
-static unsigned long __syscall_arg__val(unsigned char *args, u8 idx)
+unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx)
{
unsigned long val;
- unsigned char *p = args + sizeof(unsigned long) * idx;
+ unsigned char *p = arg->args + sizeof(unsigned long) * idx;
memcpy(&val, p, sizeof(val));
return val;
}
-unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx)
-{
- return __syscall_arg__val(arg->args, idx);
-}
-
static size_t syscall__scnprintf_val(struct syscall *sc, char *bf, size_t size,
struct syscall_arg *arg, unsigned long val)
{
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 08/40] perf trace: Allow specifying number of syscall args for tracepointless syscalls
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 07/40] perf trace: Ditch __syscall__arg_val() variant, not needed anymore Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 09/40] perf trace: Allow specifying names to syscall arguments formatters Arnaldo Carvalho de Melo
` (32 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
When we don't have syscalls:sys_{enter,exit}_NAME, we had to resort to
dumping all the 6 syscall arguments, fix it by providing that info for
such syscalls, like 'clone'.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-dfq1jtrxj8dqvqoeqqpr3slu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f8b7bfdf4ee7..e1988d08911d 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -611,6 +611,7 @@ static struct syscall_fmt {
const char *name;
const char *alias;
struct syscall_arg_fmt arg[6];
+ u8 nr_args;
bool errpid;
bool timeout;
bool hexret;
@@ -1169,6 +1170,9 @@ static int syscall__alloc_arg_fmts(struct syscall *sc, int nr_args)
{
int idx;
+ if (nr_args == 6 && sc->fmt && sc->fmt->nr_args != 0)
+ nr_args = sc->fmt->nr_args;
+
sc->arg_fmt = calloc(nr_args, sizeof(*sc->arg_fmt));
if (sc->arg_fmt == NULL)
return -1;
@@ -1413,7 +1417,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
* may end up not having any args, like with gettid(), so only
* print the raw args when we didn't manage to read it.
*/
- while (arg.idx < 6) {
+ while (arg.idx < sc->nr_args) {
if (arg.mask & bit)
goto next_arg;
val = syscall_arg__val(&arg, arg.idx);
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 09/40] perf trace: Allow specifying names to syscall arguments formatters
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 08/40] perf trace: Allow specifying number of syscall args for tracepointless syscalls Arnaldo Carvalho de Melo
@ 2017-07-26 14:16 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 10/40] tools include uapi: Grab a copy of linux/sched.h Arnaldo Carvalho de Melo
` (31 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
For tracepointless syscalls, like clone, otherwise get them from the
tracepoint's /format file.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ml5qvv1w5k96ghwhxpzzsmm3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index e1988d08911d..6664293584df 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -604,6 +604,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,
struct syscall_arg_fmt {
size_t (*scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
void *parm;
+ const char *name;
bool show_zero;
};
@@ -1349,6 +1350,15 @@ unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx)
return val;
}
+static size_t syscall__scnprintf_name(struct syscall *sc, char *bf, size_t size,
+ struct syscall_arg *arg)
+{
+ if (sc->arg_fmt && sc->arg_fmt[arg->idx].name)
+ return scnprintf(bf, size, "%s: ", sc->arg_fmt[arg->idx].name);
+
+ return scnprintf(bf, size, "arg%d: ", arg->idx);
+}
+
static size_t syscall__scnprintf_val(struct syscall *sc, char *bf, size_t size,
struct syscall_arg *arg, unsigned long val)
{
@@ -1421,8 +1431,9 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
if (arg.mask & bit)
goto next_arg;
val = syscall_arg__val(&arg, arg.idx);
- printed += scnprintf(bf + printed, size - printed,
- "%sarg%d: ", printed ? ", " : "", arg.idx);
+ if (printed)
+ printed += scnprintf(bf + printed, size - printed, ", ");
+ printed += syscall__scnprintf_name(sc, bf + printed, size - printed, &arg);
printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val);
next_arg:
++arg.idx;
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 10/40] tools include uapi: Grab a copy of linux/sched.h
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2017-07-26 14:16 ` [PATCH 09/40] perf trace: Allow specifying names to syscall arguments formatters Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 11/40] perf trace beauty clone: Beautify syscall arguments Arnaldo Carvalho de Melo
` (30 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
So that we make sure we have recent enough defines for things
such as 'perf trace' system call argument beautifiers.
For instance, the 'clone' syscall argument 'flag' needs to use
CLONE_NEWCGROUP, and that is not available in RHEL7.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-81sln0ng4a2lcxrth14vcov4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/uapi/linux/sched.h | 52 ++++++++++++++++++++++++++++++++++++++++
tools/perf/MANIFEST | 1 +
| 1 +
3 files changed, 54 insertions(+)
create mode 100644 tools/include/uapi/linux/sched.h
diff --git a/tools/include/uapi/linux/sched.h b/tools/include/uapi/linux/sched.h
new file mode 100644
index 000000000000..e2a6c7b3510b
--- /dev/null
+++ b/tools/include/uapi/linux/sched.h
@@ -0,0 +1,52 @@
+#ifndef _UAPI_LINUX_SCHED_H
+#define _UAPI_LINUX_SCHED_H
+
+/*
+ * cloning flags:
+ */
+#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
+#define CLONE_VM 0x00000100 /* set if VM shared between processes */
+#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
+#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
+#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
+#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
+#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
+#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
+#define CLONE_THREAD 0x00010000 /* Same thread group? */
+#define CLONE_NEWNS 0x00020000 /* New mount namespace group */
+#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
+#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
+#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
+#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
+#define CLONE_DETACHED 0x00400000 /* Unused, ignored */
+#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
+#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
+#define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */
+#define CLONE_NEWUTS 0x04000000 /* New utsname namespace */
+#define CLONE_NEWIPC 0x08000000 /* New ipc namespace */
+#define CLONE_NEWUSER 0x10000000 /* New user namespace */
+#define CLONE_NEWPID 0x20000000 /* New pid namespace */
+#define CLONE_NEWNET 0x40000000 /* New network namespace */
+#define CLONE_IO 0x80000000 /* Clone io context */
+
+/*
+ * Scheduling policies
+ */
+#define SCHED_NORMAL 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+#define SCHED_BATCH 3
+/* SCHED_ISO: reserved but not implemented yet */
+#define SCHED_IDLE 5
+#define SCHED_DEADLINE 6
+
+/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
+#define SCHED_RESET_ON_FORK 0x40000000
+
+/*
+ * For the sched_{set,get}attr() calls
+ */
+#define SCHED_FLAG_RESET_ON_FORK 0x01
+#define SCHED_FLAG_RECLAIM 0x02
+
+#endif /* _UAPI_LINUX_SCHED_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index a29da46d180f..9f2267b82eb2 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -78,6 +78,7 @@ tools/include/uapi/linux/fcntl.h
tools/include/uapi/linux/hw_breakpoint.h
tools/include/uapi/linux/mman.h
tools/include/uapi/linux/perf_event.h
+tools/include/uapi/linux/sched.h
tools/include/uapi/linux/stat.h
tools/include/linux/poison.h
tools/include/linux/rbtree.h
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 47abd3325190..9b6295809a3b 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -3,6 +3,7 @@
HEADERS='
include/uapi/linux/fcntl.h
include/uapi/linux/perf_event.h
+include/uapi/linux/sched.h
include/uapi/linux/stat.h
include/linux/hash.h
include/uapi/linux/hw_breakpoint.h
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 11/40] perf trace beauty clone: Beautify syscall arguments
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 10/40] tools include uapi: Grab a copy of linux/sched.h Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 12/40] perf trace beauty clone: Suppress unused args according to 'flags' arg Arnaldo Carvalho de Melo
` (29 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Now, syswide tracing, selected entries:
# trace -e clone
24417.203 ( 0.158 ms): bash/11323 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11325 (bash)
? ( ? ): bash/11325 ... [continued]: clone()) = 0
24419.355 ( 0.093 ms): bash/10586 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11326 (bash)
? ( ? ): bash/11326 ... [continued]: clone()) = 0
24419.744 ( 0.102 ms): bash/11326 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11327 (bash)
? ( ? ): bash/11327 ... [continued]: clone()) = 0
24420.138 ( 0.105 ms): bash/11327 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11328 (bash)
? ( ? ): bash/11328 ... [continued]: clone()) = 0
35747.722 ( 0.044 ms): gpg-agent/18087 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ff0755f6ff0, parent_tidptr: 0x7ff0755f79d0, child_tidptr: 0x7ff0755f79d0, tls: 0x7ff0755f7700) = 11329 (gpg-agent)
? ( ? ): gpg-agent/11329 ... [continued]: clone()) = 0
35748.359 ( 0.022 ms): gpg-agent/18087 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ff075df7ff0, parent_tidptr: 0x7ff075df89d0, child_tidptr: 0x7ff075df89d0, tls: 0x7ff075df8700) = 11330 (gpg-agent)
? ( ? ): gpg-agent/11330 ... [continued]: clone()) = 0
35781.422 ( 0.452 ms): NetworkManager/1112 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7f2f1fffedb0, parent_tidptr: 0x7f2f1ffff9d0, child_tidptr: 0x7f2f1ffff9d0, tls: 0x7f2f1ffff700) = 11331 (NetworkManager)
? ( ? ): NetworkManager/11331 ... [continued]: clone()) = 0
Need to improve the formatting of the second return, to the child, this
cset only focused on the argument formatting.
If we trace just one pid:
# trace -e clone -p 19863
0.349 ( 0.025 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb84eaac70, parent_tidptr: 0x7ffb84eab9d0, child_tidptr: 0x7ffb84eab9d0, tls: 0x7ffb84eab700) = 11637 (Chrome_IOThread)
0.392 ( 0.013 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb664b8c70, parent_tidptr: 0x7ffb664b99d0, child_tidptr: 0x7ffb664b99d0, tls: 0x7ffb664b9700) = 11638 (Chrome_IOThread)
0.573 ( 0.015 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb6046cc70, parent_tidptr: 0x7ffb6046d9d0, child_tidptr: 0x7ffb6046d9d0, tls: 0x7ffb6046d700) = 11639 (Chrome_IOThread)
0.617 ( 0.014 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb730dcc70, parent_tidptr: 0x7ffb730dd9d0, child_tidptr: 0x7ffb730dd9d0, tls: 0x7ffb730dd700) = 11640 (Chrome_IOThread)
4.350 ( 0.065 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb720d9c70, parent_tidptr: 0x7ffb720da9d0, child_tidptr: 0x7ffb720da9d0, tls: 0x7ffb720da700) = 11642 (Chrome_IOThread)
5.642 ( 0.079 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb718d8c70, parent_tidptr: 0x7ffb718d99d0, child_tidptr: 0x7ffb718d99d0, tls: 0x7ffb718d9700) = 11643 (Chrome_IOThread)
^C#
We'll also have to fix the argument ordering in different arches,
probably having multiple syscall_fmt entries with each possible order
and then use perf_evsel__env_arch() (if dealing with a perf.data file)
or the current system info, for live sessions.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-am068uyubgj83snepolwhbfe@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 7 ++++-
tools/perf/trace/beauty/Build | 1 +
tools/perf/trace/beauty/beauty.h | 3 +++
tools/perf/trace/beauty/clone.c | 58 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 1 deletion(-)
create mode 100644 tools/perf/trace/beauty/clone.c
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 6664293584df..9e74e675d7cb 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -626,7 +626,12 @@ static struct syscall_fmt {
.arg = { [0] = { .scnprintf = SCA_HEX, /* brk */ }, }, },
{ .name = "clock_gettime",
.arg = { [0] = STRARRAY(clk_id, clockid), }, },
- { .name = "clone", .errpid = true, },
+ { .name = "clone", .errpid = true, .nr_args = 5,
+ .arg = { [0] = { .name = "flags", .scnprintf = SCA_CLONE_FLAGS, },
+ [1] = { .name = "child_stack", .scnprintf = SCA_HEX, },
+ [2] = { .name = "parent_tidptr", .scnprintf = SCA_HEX, },
+ [3] = { .name = "child_tidptr", .scnprintf = SCA_HEX, },
+ [4] = { .name = "tls", .scnprintf = SCA_HEX, }, }, },
{ .name = "close",
.arg = { [0] = { .scnprintf = SCA_CLOSE_FD, /* fd */ }, }, },
{ .name = "epoll_ctl",
diff --git a/tools/perf/trace/beauty/Build b/tools/perf/trace/beauty/Build
index c9e215b806f1..eaa1e8e8e100 100644
--- a/tools/perf/trace/beauty/Build
+++ b/tools/perf/trace/beauty/Build
@@ -1,2 +1,3 @@
+libperf-y += clone.o
libperf-y += fcntl.o
libperf-y += statx.o
diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h
index f75ef7d0b303..69a5c8a2d420 100644
--- a/tools/perf/trace/beauty/beauty.h
+++ b/tools/perf/trace/beauty/beauty.h
@@ -66,6 +66,9 @@ size_t syscall_arg__scnprintf_long(char *bf, size_t size, struct syscall_arg *ar
size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_PID syscall_arg__scnprintf_pid
+size_t syscall_arg__scnprintf_clone_flags(char *bf, size_t size, struct syscall_arg *arg);
+#define SCA_CLONE_FLAGS syscall_arg__scnprintf_clone_flags
+
size_t syscall_arg__scnprintf_fcntl_cmd(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_FCNTL_CMD syscall_arg__scnprintf_fcntl_cmd
diff --git a/tools/perf/trace/beauty/clone.c b/tools/perf/trace/beauty/clone.c
new file mode 100644
index 000000000000..ab982a7c63bb
--- /dev/null
+++ b/tools/perf/trace/beauty/clone.c
@@ -0,0 +1,58 @@
+/*
+ * trace/beauty/cone.c
+ *
+ * Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
+ *
+ * Released under the GPL v2. (and only v2, not any later version)
+ */
+
+#include "trace/beauty/beauty.h"
+#include <linux/kernel.h>
+#include <sys/types.h>
+#include <uapi/linux/sched.h>
+
+static size_t clone__scnprintf_flags(unsigned long flags, char *bf, size_t size)
+{
+ int printed = 0;
+
+#define P_FLAG(n) \
+ if (flags & CLONE_##n) { \
+ printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
+ flags &= ~CLONE_##n; \
+ }
+
+ P_FLAG(VM);
+ P_FLAG(FS);
+ P_FLAG(FILES);
+ P_FLAG(SIGHAND);
+ P_FLAG(PTRACE);
+ P_FLAG(VFORK);
+ P_FLAG(PARENT);
+ P_FLAG(THREAD);
+ P_FLAG(NEWNS);
+ P_FLAG(SYSVSEM);
+ P_FLAG(SETTLS);
+ P_FLAG(PARENT_SETTID);
+ P_FLAG(CHILD_CLEARTID);
+ P_FLAG(DETACHED);
+ P_FLAG(UNTRACED);
+ P_FLAG(CHILD_SETTID);
+ P_FLAG(NEWCGROUP);
+ P_FLAG(NEWUTS);
+ P_FLAG(NEWIPC);
+ P_FLAG(NEWUSER);
+ P_FLAG(NEWPID);
+ P_FLAG(NEWNET);
+ P_FLAG(IO);
+#undef P_FLAG
+
+ if (flags)
+ printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
+
+ return printed;
+}
+
+size_t syscall_arg__scnprintf_clone_flags(char *bf, size_t size, struct syscall_arg *arg)
+{
+ return clone__scnprintf_flags(arg->val, bf, size);
+}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 12/40] perf trace beauty clone: Suppress unused args according to 'flags' arg
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 11/40] perf trace beauty clone: Beautify syscall arguments Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 13/40] perf trace: Introduce filter_loop_pids() Arnaldo Carvalho de Melo
` (28 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The 'parent_tidptr', 'child_tidptr' and 'tls' arguments to the 'clone'
syscall are only used when certain flags are set in 'flags', suppress
them when those aren't there.
E.g:
9886.919 (0.236 ms): fetchmail/19298 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, child_tidptr: 0x7fe43f468590) = 19608 (fetchmail)
12876.052 (0.249 ms): qemu-system-x8/21238 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7f48117fc770, parent_tidptr: 0x7f48117ff9d0, child_tidptr: 0x7f48117ff9d0, tls: 0x7f48117ff700) = 19611 (qemu-system-x86)
12876.555 (0.048 ms): worker/19611 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7f480f7f8770, parent_tidptr: 0x7f480f7fb9d0, child_tidptr: 0x7f480f7fb9d0, tls: 0x7f480f7fb700) = 19612 (worker)
16575.240 (0.469 ms): fetchmail/19298 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, child_tidptr: 0x7fe43f468590) = 19613 (fetchmail)
20797.270 (0.335 ms): fetchmail/19298 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, child_tidptr: 0x7fe43f468590) = 19614 (fetchmail)
21228.585 (0.501 ms): vim/19519 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, child_tidptr: 0x7fbad6ac27d0) = 19615 (vim)
21232.193 (0.137 ms): bash/19615 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, child_tidptr: 0x7fad8bff49d0) = 19616 (bash)
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-0um93djul9knf239gwa5mpcb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/clone.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/tools/perf/trace/beauty/clone.c b/tools/perf/trace/beauty/clone.c
index ab982a7c63bb..d64d049ab991 100644
--- a/tools/perf/trace/beauty/clone.c
+++ b/tools/perf/trace/beauty/clone.c
@@ -54,5 +54,22 @@ static size_t clone__scnprintf_flags(unsigned long flags, char *bf, size_t size)
size_t syscall_arg__scnprintf_clone_flags(char *bf, size_t size, struct syscall_arg *arg)
{
- return clone__scnprintf_flags(arg->val, bf, size);
+ unsigned long flags = arg->val;
+ enum syscall_clone_args {
+ SCC_FLAGS = (1 << 0),
+ SCC_CHILD_STACK = (1 << 1),
+ SCC_PARENT_TIDPTR = (1 << 2),
+ SCC_CHILD_TIDPTR = (1 << 3),
+ SCC_TLS = (1 << 4),
+ };
+ if (!(flags & CLONE_PARENT_SETTID))
+ arg->mask |= SCC_PARENT_TIDPTR;
+
+ if (!(flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)))
+ arg->mask |= SCC_CHILD_TIDPTR;
+
+ if (!(flags & CLONE_SETTLS))
+ arg->mask |= SCC_TLS;
+
+ return clone__scnprintf_flags(flags, bf, size);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 13/40] perf trace: Introduce filter_loop_pids()
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (11 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 12/40] perf trace beauty clone: Suppress unused args according to 'flags' arg Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 14/40] perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing Arnaldo Carvalho de Melo
` (27 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
No change in functionality, just to make clearer that what we want when
filtering the tracer pid in a system wide tracing session is to avoid a
feedback loop.
This also paves the way for a more interesting loop avoidance algorithm,
one that tries to figure out if we are in a ssh session, xterm, etc.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5fcttc5kdjkcyp9404ezkuy9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9e74e675d7cb..0ba36f08efd8 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2239,6 +2239,16 @@ static int trace__set_ev_qualifier_filter(struct trace *trace)
goto out;
}
+static int trace__set_filter_loop_pids(struct trace *trace)
+{
+ int nr = 1;
+ pid_t pids[32] = {
+ getpid(),
+ };
+
+ return perf_evlist__set_filter_pids(trace->evlist, nr, pids);
+}
+
static int trace__run(struct trace *trace, int argc, const char **argv)
{
struct perf_evlist *evlist = trace->evlist;
@@ -2362,7 +2372,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (trace->filter_pids.nr > 0)
err = perf_evlist__set_filter_pids(evlist, trace->filter_pids.nr, trace->filter_pids.entries);
else if (thread_map__pid(evlist->threads, 0) == -1)
- err = perf_evlist__set_filter_pid(evlist, getpid());
+ err = trace__set_filter_loop_pids(trace);
if (err < 0)
goto out_error_mem;
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 14/40] perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (12 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 13/40] perf trace: Introduce filter_loop_pids() Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 15/40] tools include: Adopt strstarts() from the kernel Arnaldo Carvalho de Melo
` (26 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Avoiding a loop, so now its quite convenient to ssh to a machine and
then simply do:
# perf trace
To trace all syscalls without causing a loop.
This was possible using --filter-pids, i.e. once you noticed the loop,
get the sshd pid and add it to --filter-pids, restarting the 'perf
trace'.
Now to figure out how to do that in a X terminal, the other common
scenario, which is way more involved, as there are multiple processes
communicating to process terminal activity...
Using --filter-pids + '-e \!syscall,names,you,dont,need' may be a good
approximation when having to do syswide tracing on your workstation.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-68rjeao9wnpylla41htk7xps@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 0ba36f08efd8..05d24b6570ee 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2241,10 +2241,24 @@ static int trace__set_ev_qualifier_filter(struct trace *trace)
static int trace__set_filter_loop_pids(struct trace *trace)
{
- int nr = 1;
+ unsigned int nr = 1;
pid_t pids[32] = {
getpid(),
};
+ struct thread *thread = machine__find_thread(trace->host, pids[0], pids[0]);
+
+ while (thread && nr < ARRAY_SIZE(pids)) {
+ struct thread *parent = machine__find_thread(trace->host, thread->ppid, thread->ppid);
+
+ if (parent == NULL)
+ break;
+
+ if (!strcmp(thread__comm_str(parent), "sshd")) {
+ pids[nr++] = parent->tid;
+ break;
+ }
+ thread = parent;
+ }
return perf_evlist__set_filter_pids(trace->evlist, nr, pids);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 15/40] tools include: Adopt strstarts() from the kernel
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (13 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 14/40] perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 16/40] tools lib: Update copy of strtobool from the kernel sources Arnaldo Carvalho de Melo
` (25 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Josh Poimboeuf,
Namhyung Kim, Rusty Russell, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Replacing prefixcmp(), same purpose, inverted result, so standardize on
the kernel variant, to reduce silly differences among tools/ and the
kernel sources, making it easier for people to work in both codebases.
And then doing:
if (strstarts(option, "no-"))
Looks clearer than doing:
if (!prefixcmp(option, "no-"))
To figure out if option starts witn "no-".
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-kaei42gi7lpa8subwtv7eug8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/string.h | 12 ++++++++++--
tools/lib/string.c | 9 ---------
tools/lib/subcmd/help.c | 2 +-
tools/lib/subcmd/parse-options.c | 18 +++++++++---------
tools/perf/builtin-config.c | 3 ++-
tools/perf/builtin-ftrace.c | 2 +-
tools/perf/builtin-help.c | 6 +++---
tools/perf/perf.c | 16 ++++++++--------
tools/perf/ui/browser.c | 3 ++-
tools/perf/ui/browsers/annotate.c | 3 ++-
tools/perf/ui/stdio/hist.c | 3 ++-
tools/perf/util/bpf-loader.c | 2 +-
tools/perf/util/callchain.c | 2 +-
tools/perf/util/config.c | 13 +++++++------
tools/perf/util/llvm-utils.c | 2 +-
15 files changed, 50 insertions(+), 46 deletions(-)
diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
index d62b56cf8c12..a30fad536f52 100644
--- a/tools/include/linux/string.h
+++ b/tools/include/linux/string.h
@@ -1,8 +1,8 @@
#ifndef _TOOLS_LINUX_STRING_H_
#define _TOOLS_LINUX_STRING_H_
-
#include <linux/types.h> /* for size_t */
+#include <string.h>
void *memdup(const void *src, size_t len);
@@ -18,6 +18,14 @@ extern size_t strlcpy(char *dest, const char *src, size_t size);
char *str_error_r(int errnum, char *buf, size_t buflen);
-int prefixcmp(const char *str, const char *prefix);
+/**
+ * strstarts - does @str start with @prefix?
+ * @str: string to examine
+ * @prefix: prefix to look for.
+ */
+static inline bool strstarts(const char *str, const char *prefix)
+{
+ return strncmp(str, prefix, strlen(prefix)) == 0;
+}
#endif /* _LINUX_STRING_H_ */
diff --git a/tools/lib/string.c b/tools/lib/string.c
index 8e678af1c6ee..bd239bc1d557 100644
--- a/tools/lib/string.c
+++ b/tools/lib/string.c
@@ -87,12 +87,3 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
}
return ret;
}
-
-int prefixcmp(const char *str, const char *prefix)
-{
- for (; ; str++, prefix++)
- if (!*prefix)
- return 0;
- else if (*str != *prefix)
- return (unsigned char)*prefix - (unsigned char)*str;
-}
diff --git a/tools/lib/subcmd/help.c b/tools/lib/subcmd/help.c
index ba970a73d053..0310520f918e 100644
--- a/tools/lib/subcmd/help.c
+++ b/tools/lib/subcmd/help.c
@@ -171,7 +171,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
while ((de = readdir(dir)) != NULL) {
int entlen;
- if (prefixcmp(de->d_name, prefix))
+ if (!strstarts(de->d_name, prefix))
continue;
astrcat(&buf, de->d_name);
diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c
index 359bfa77f39c..2bd6fd0c1d40 100644
--- a/tools/lib/subcmd/parse-options.c
+++ b/tools/lib/subcmd/parse-options.c
@@ -368,7 +368,7 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
return 0;
}
if (!rest) {
- if (!prefixcmp(options->long_name, "no-")) {
+ if (strstarts(options->long_name, "no-")) {
/*
* The long name itself starts with "no-", so
* accept the option without "no-" so that users
@@ -381,7 +381,7 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
goto match;
}
/* Abbreviated case */
- if (!prefixcmp(options->long_name + 3, arg)) {
+ if (strstarts(options->long_name + 3, arg)) {
flags |= OPT_UNSET;
goto is_abbreviated;
}
@@ -406,7 +406,7 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
continue;
}
/* negated and abbreviated very much? */
- if (!prefixcmp("no-", arg)) {
+ if (strstarts("no-", arg)) {
flags |= OPT_UNSET;
goto is_abbreviated;
}
@@ -416,7 +416,7 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
flags |= OPT_UNSET;
rest = skip_prefix(arg + 3, options->long_name);
/* abbreviated and negated? */
- if (!rest && !prefixcmp(options->long_name, arg + 3))
+ if (!rest && strstarts(options->long_name, arg + 3))
goto is_abbreviated;
if (!rest)
continue;
@@ -456,7 +456,7 @@ static void check_typos(const char *arg, const struct option *options)
if (strlen(arg) < 3)
return;
- if (!prefixcmp(arg, "no-")) {
+ if (strstarts(arg, "no-")) {
fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)", arg);
exit(129);
}
@@ -464,7 +464,7 @@ static void check_typos(const char *arg, const struct option *options)
for (; options->type != OPTION_END; options++) {
if (!options->long_name)
continue;
- if (!prefixcmp(options->long_name, arg)) {
+ if (strstarts(options->long_name, arg)) {
fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)", arg);
exit(129);
}
@@ -933,10 +933,10 @@ int parse_options_usage(const char * const *usagestr,
if (opts->long_name == NULL)
continue;
- if (!prefixcmp(opts->long_name, optstr))
+ if (strstarts(opts->long_name, optstr))
print_option_help(opts, 0);
- if (!prefixcmp("no-", optstr) &&
- !prefixcmp(opts->long_name, optstr + 3))
+ if (strstarts("no-", optstr) &&
+ strstarts(opts->long_name, optstr + 3))
print_option_help(opts, 0);
}
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index ece45582a48d..3ddcc6e2abeb 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -13,6 +13,7 @@
#include "util/util.h"
#include "util/debug.h"
#include "util/config.h"
+#include <linux/string.h>
static bool use_system_config, use_user_config;
@@ -79,7 +80,7 @@ static int show_spec_config(struct perf_config_set *set, const char *var)
return -1;
perf_config_items__for_each_entry(&set->sections, section) {
- if (prefixcmp(var, section->name) != 0)
+ if (!strstarts(var, section->name))
continue;
perf_config_items__for_each_entry(§ion->items, item) {
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index dd26c62c9893..25a42acabee1 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -381,7 +381,7 @@ static int perf_ftrace_config(const char *var, const char *value, void *cb)
{
struct perf_ftrace *ftrace = cb;
- if (prefixcmp(var, "ftrace."))
+ if (!strstarts(var, "ftrace."))
return 0;
if (strcmp(var, "ftrace.tracer"))
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 530a7f2fa0f3..dbe4e4153bcf 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -90,7 +90,7 @@ static int check_emacsclient_version(void)
*/
finish_command(&ec_process);
- if (prefixcmp(buffer.buf, "emacsclient")) {
+ if (!strstarts(buffer.buf, "emacsclient")) {
fprintf(stderr, "Failed to parse emacsclient version.\n");
goto out;
}
@@ -283,7 +283,7 @@ static int perf_help_config(const char *var, const char *value, void *cb)
add_man_viewer(value);
return 0;
}
- if (!prefixcmp(var, "man."))
+ if (!strstarts(var, "man."))
return add_man_viewer_info(var, value);
return 0;
@@ -313,7 +313,7 @@ static const char *cmd_to_page(const char *perf_cmd)
if (!perf_cmd)
return "perf";
- else if (!prefixcmp(perf_cmd, "perf"))
+ else if (!strstarts(perf_cmd, "perf"))
return perf_cmd;
return asprintf(&s, "perf-%s", perf_cmd) < 0 ? NULL : s;
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 628a5e412cb1..e0279babe0c0 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -89,7 +89,7 @@ struct pager_config {
static int pager_command_config(const char *var, const char *value, void *data)
{
struct pager_config *c = data;
- if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd))
+ if (strstarts(var, "pager.") && !strcmp(var + 6, c->cmd))
c->val = perf_config_bool(var, value);
return 0;
}
@@ -108,9 +108,9 @@ static int check_pager_config(const char *cmd)
static int browser_command_config(const char *var, const char *value, void *data)
{
struct pager_config *c = data;
- if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd))
+ if (strstarts(var, "tui.") && !strcmp(var + 4, c->cmd))
c->val = perf_config_bool(var, value);
- if (!prefixcmp(var, "gtk.") && !strcmp(var + 4, c->cmd))
+ if (strstarts(var, "gtk.") && !strcmp(var + 4, c->cmd))
c->val = perf_config_bool(var, value) ? 2 : 0;
return 0;
}
@@ -192,7 +192,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
/*
* Check remaining flags.
*/
- if (!prefixcmp(cmd, CMD_EXEC_PATH)) {
+ if (strstarts(cmd, CMD_EXEC_PATH)) {
cmd += strlen(CMD_EXEC_PATH);
if (*cmd == '=')
set_argv_exec_path(cmd + 1);
@@ -229,7 +229,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
*envchanged = 1;
(*argv)++;
(*argc)--;
- } else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
+ } else if (strstarts(cmd, CMD_DEBUGFS_DIR)) {
tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
fprintf(stderr, "dir: %s\n", tracing_path);
if (envchanged)
@@ -470,14 +470,14 @@ int main(int argc, const char **argv)
* So we just directly call the internal command handler, and
* die if that one cannot handle it.
*/
- if (!prefixcmp(cmd, "perf-")) {
+ if (strstarts(cmd, "perf-")) {
cmd += 5;
argv[0] = cmd;
handle_internal_command(argc, argv);
fprintf(stderr, "cannot handle %s internally", cmd);
goto out;
}
- if (!prefixcmp(cmd, "trace")) {
+ if (strstarts(cmd, "trace")) {
#ifdef HAVE_LIBAUDIT_SUPPORT
setup_path();
argv[0] = "trace";
@@ -495,7 +495,7 @@ int main(int argc, const char **argv)
commit_pager_choice();
if (argc > 0) {
- if (!prefixcmp(argv[0], "--"))
+ if (strstarts(argv[0], "--"))
argv[0] += 2;
} else {
/* The user didn't specify a command; give them help */
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index f73f3f13e01d..d0c2007c307b 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -8,6 +8,7 @@
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/rbtree.h>
+#include <linux/string.h>
#include <stdlib.h>
#include <sys/ttydefaults.h>
#include "browser.h"
@@ -563,7 +564,7 @@ static int ui_browser__color_config(const char *var, const char *value,
int i;
/* same dir for all commands */
- if (prefixcmp(var, "colors.") != 0)
+ if (!strstarts(var, "colors.") != 0)
return 0;
for (i = 0; ui_browser__colorsets[i].name != NULL; ++i) {
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 8d3f6f53c122..6794a8bec404 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -13,6 +13,7 @@
#include <inttypes.h>
#include <pthread.h>
#include <linux/kernel.h>
+#include <linux/string.h>
#include <sys/ttydefaults.h>
struct disasm_line_samples {
@@ -1198,7 +1199,7 @@ static int annotate__config(const char *var, const char *value,
struct annotate_config *cfg;
const char *name;
- if (prefixcmp(var, "annotate.") != 0)
+ if (!strstarts(var, "annotate."))
return 0;
name = var + 9;
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 2df8eb1ed3c0..5c95b8301c67 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <linux/string.h>
#include "../../util/util.h"
#include "../../util/hist.h"
@@ -292,7 +293,7 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
* displayed twice.
*/
if (!i++ && field_order == NULL &&
- sort_order && !prefixcmp(sort_order, "sym"))
+ sort_order && strstarts(sort_order, "sym"))
continue;
if (!printed) {
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 4bd2d1d882af..4a1264c66101 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -1246,7 +1246,7 @@ int bpf__config_obj(struct bpf_object *obj,
if (!obj || !term || !term->config)
return -EINVAL;
- if (!prefixcmp(term->config, "map:")) {
+ if (strstarts(term->config, "map:")) {
key_scan_pos = sizeof("map:") - 1;
err = bpf__obj_config_map(obj, term, evlist, &key_scan_pos);
goto out;
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 22d413ae6025..02130e2e72c7 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -304,7 +304,7 @@ int perf_callchain_config(const char *var, const char *value)
{
char *endptr;
- if (prefixcmp(var, "call-graph."))
+ if (!strstarts(var, "call-graph."))
return 0;
var += sizeof("call-graph.") - 1;
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 31a7dea248d0..bc75596f9e79 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <linux/string.h>
#include "sane_ctype.h"
@@ -433,22 +434,22 @@ static int perf_ui_config(const char *var, const char *value)
int perf_default_config(const char *var, const char *value,
void *dummy __maybe_unused)
{
- if (!prefixcmp(var, "core."))
+ if (strstarts(var, "core."))
return perf_default_core_config(var, value);
- if (!prefixcmp(var, "hist."))
+ if (strstarts(var, "hist."))
return perf_hist_config(var, value);
- if (!prefixcmp(var, "ui."))
+ if (strstarts(var, "ui."))
return perf_ui_config(var, value);
- if (!prefixcmp(var, "call-graph."))
+ if (strstarts(var, "call-graph."))
return perf_callchain_config(var, value);
- if (!prefixcmp(var, "llvm."))
+ if (strstarts(var, "llvm."))
return perf_llvm_config(var, value);
- if (!prefixcmp(var, "buildid."))
+ if (strstarts(var, "buildid."))
return perf_buildid_config(var, value);
/* Add other config variables here. */
diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c
index c6a15f204c03..209b0c82eff4 100644
--- a/tools/perf/util/llvm-utils.c
+++ b/tools/perf/util/llvm-utils.c
@@ -33,7 +33,7 @@ struct llvm_param llvm_param = {
int perf_llvm_config(const char *var, const char *value)
{
- if (prefixcmp(var, "llvm."))
+ if (!strstarts(var, "llvm."))
return 0;
var += sizeof("llvm.") - 1;
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 16/40] tools lib: Update copy of strtobool from the kernel sources
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (14 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 15/40] tools include: Adopt strstarts() from the kernel Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 17/40] perf annotate: Introduce struct sym_hist_entry Arnaldo Carvalho de Melo
` (24 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan,
Kees Cook
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Getting support for "on", "off" introduced in a81a5a17d44b ("lib: add
"on"/"off" support to kstrtobool") and making it check for NULL,
introduced in ef951599074b ("lib: move strtobool() to kstrtobool()").
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Kees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/n/tip-mu8ghin4rklacmmubzwv8td7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/string.c | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/tools/lib/string.c b/tools/lib/string.c
index bd239bc1d557..a4246f14ded1 100644
--- a/tools/lib/string.c
+++ b/tools/lib/string.c
@@ -39,27 +39,45 @@ void *memdup(const void *src, size_t len)
* @s: input string
* @res: result
*
- * This routine returns 0 iff the first character is one of 'Yy1Nn0'.
- * Otherwise it will return -EINVAL. Value pointed to by res is
- * updated upon finding a match.
+ * This routine returns 0 iff the first character is one of 'Yy1Nn0', or
+ * [oO][NnFf] for "on" and "off". Otherwise it will return -EINVAL. Value
+ * pointed to by res is updated upon finding a match.
*/
int strtobool(const char *s, bool *res)
{
+ if (!s)
+ return -EINVAL;
+
switch (s[0]) {
case 'y':
case 'Y':
case '1':
*res = true;
- break;
+ return 0;
case 'n':
case 'N':
case '0':
*res = false;
- break;
+ return 0;
+ case 'o':
+ case 'O':
+ switch (s[1]) {
+ case 'n':
+ case 'N':
+ *res = true;
+ return 0;
+ case 'f':
+ case 'F':
+ *res = false;
+ return 0;
+ default:
+ break;
+ }
default:
- return -EINVAL;
+ break;
}
- return 0;
+
+ return -EINVAL;
}
/**
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 17/40] perf annotate: Introduce struct sym_hist_entry
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (15 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 16/40] tools lib: Update copy of strtobool from the kernel sources Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 18/40] perf annotate: Rename 'sum' to 'nr_samples' in struct sym_hist Arnaldo Carvalho de Melo
` (23 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Jiri Olsa,
Namhyung Kim, Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
struct sym_hist has addr[] but it should have not only number of samples
but also the sample period. So use new struct symhist_entry to pave the
way to have that.
Committer notes:
This initial patch will only introduce the struct sym_hist_entry and use
only the nr_samples member, which makes the code clearer and paves the
way to save the period as well.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1500500205-16553-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/annotate.c | 6 +++---
tools/perf/ui/gtk/annotate.c | 4 ++--
tools/perf/util/annotate.c | 45 ++++++++++++++++++++-------------------
tools/perf/util/annotate.h | 9 ++++++--
4 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 6794a8bec404..dbe4e630b90f 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -450,14 +450,14 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
next = disasm__get_next_ip_line(¬es->src->source, pos);
for (i = 0; i < browser->nr_events; i++) {
- u64 nr_samples;
+ struct sym_hist_entry sample;
bpos->samples[i].percent = disasm__calc_percent(notes,
evsel->idx + i,
pos->offset,
next ? next->offset : len,
- &path, &nr_samples);
- bpos->samples[i].nr = nr_samples;
+ &path, &sample);
+ bpos->samples[i].nr = sample.nr_samples;
if (max_percent < bpos->samples[i].percent)
max_percent = bpos->samples[i].percent;
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index 87e3760624f2..d736fd57ab9b 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -34,10 +34,10 @@ static int perf_gtk__get_percent(char *buf, size_t size, struct symbol *sym,
return 0;
symhist = annotation__histogram(symbol__annotation(sym), evidx);
- if (!symbol_conf.event_group && !symhist->addr[dl->offset])
+ if (!symbol_conf.event_group && !symhist->addr[dl->offset].nr_samples)
return 0;
- percent = 100.0 * symhist->addr[dl->offset] / symhist->sum;
+ percent = 100.0 * symhist->addr[dl->offset].nr_samples / symhist->sum;
markup = perf_gtk__get_percent_color(percent);
if (markup)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 1742510f0120..c3829555ce1c 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -610,10 +610,10 @@ int symbol__alloc_hist(struct symbol *sym)
size_t sizeof_sym_hist;
/* Check for overflow when calculating sizeof_sym_hist */
- if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(u64))
+ if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry))
return -1;
- sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64));
+ sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(struct sym_hist_entry));
/* Check for overflow in zalloc argument */
if (sizeof_sym_hist > (SIZE_MAX - sizeof(*notes->src))
@@ -714,11 +714,11 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
offset = addr - sym->start;
h = annotation__histogram(notes, evidx);
h->sum++;
- h->addr[offset]++;
+ h->addr[offset].nr_samples++;
pr_debug3("%#" PRIx64 " %s: period++ [addr: %#" PRIx64 ", %#" PRIx64
", evidx=%d] => %" PRIu64 "\n", sym->start, sym->name,
- addr, addr - sym->start, evidx, h->addr[offset]);
+ addr, addr - sym->start, evidx, h->addr[offset].nr_samples);
return 0;
}
@@ -928,11 +928,12 @@ struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disa
}
double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
- s64 end, const char **path, u64 *nr_samples)
+ s64 end, const char **path, struct sym_hist_entry *sample)
{
struct source_line *src_line = notes->src->lines;
double percent = 0.0;
- *nr_samples = 0;
+
+ sample->nr_samples = 0;
if (src_line) {
size_t sizeof_src_line = sizeof(*src_line) +
@@ -946,7 +947,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
*path = src_line->path;
percent += src_line->samples[evidx].percent;
- *nr_samples += src_line->samples[evidx].nr;
+ sample->nr_samples += src_line->samples[evidx].nr;
offset++;
}
} else {
@@ -954,10 +955,10 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
unsigned int hits = 0;
while (offset < end)
- hits += h->addr[offset++];
+ hits += h->addr[offset++].nr_samples;
if (h->sum) {
- *nr_samples = hits;
+ sample->nr_samples = hits;
percent = 100.0 * hits / h->sum;
}
}
@@ -1057,10 +1058,10 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
if (dl->offset != -1) {
const char *path = NULL;
- u64 nr_samples;
double percent, max_percent = 0.0;
double *ppercents = &percent;
- u64 *psamples = &nr_samples;
+ struct sym_hist_entry sample;
+ struct sym_hist_entry *psamples = &sample;
int i, nr_percent = 1;
const char *color;
struct annotation *notes = symbol__annotation(sym);
@@ -1074,7 +1075,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
if (perf_evsel__is_group_event(evsel)) {
nr_percent = evsel->nr_members;
ppercents = calloc(nr_percent, sizeof(double));
- psamples = calloc(nr_percent, sizeof(u64));
+ psamples = calloc(nr_percent, sizeof(struct sym_hist_entry));
if (ppercents == NULL || psamples == NULL) {
return -1;
}
@@ -1085,10 +1086,10 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
notes->src->lines ? i : evsel->idx + i,
offset,
next ? next->offset : (s64) len,
- &path, &nr_samples);
+ &path, &sample);
ppercents[i] = percent;
- psamples[i] = nr_samples;
+ psamples[i] = sample;
if (percent > max_percent)
max_percent = percent;
}
@@ -1126,12 +1127,12 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
for (i = 0; i < nr_percent; i++) {
percent = ppercents[i];
- nr_samples = psamples[i];
+ sample = psamples[i];
color = get_percent_color(percent);
if (symbol_conf.show_total_period)
color_fprintf(stdout, color, " %7" PRIu64,
- nr_samples);
+ sample.nr_samples);
else
color_fprintf(stdout, color, " %7.2f", percent);
}
@@ -1147,7 +1148,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
if (ppercents != &percent)
free(ppercents);
- if (psamples != &nr_samples)
+ if (psamples != &sample)
free(psamples);
} else if (max_lines && printed >= max_lines)
@@ -1702,7 +1703,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
double percent = 0.0;
h = annotation__histogram(notes, evidx + k);
- nr_samples = h->addr[i];
+ nr_samples = h->addr[i].nr_samples;
if (h->sum)
percent = 100.0 * nr_samples / h->sum;
@@ -1773,9 +1774,9 @@ static void symbol__annotate_hits(struct symbol *sym, struct perf_evsel *evsel)
u64 len = symbol__size(sym), offset;
for (offset = 0; offset < len; ++offset)
- if (h->addr[offset] != 0)
+ if (h->addr[offset].nr_samples != 0)
printf("%*" PRIx64 ": %" PRIu64 "\n", BITS_PER_LONG / 2,
- sym->start + offset, h->addr[offset]);
+ sym->start + offset, h->addr[offset].nr_samples);
printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum);
}
@@ -1878,8 +1879,8 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
h->sum = 0;
for (offset = 0; offset < len; ++offset) {
- h->addr[offset] = h->addr[offset] * 7 / 8;
- h->sum += h->addr[offset];
+ h->addr[offset].nr_samples = h->addr[offset].nr_samples * 7 / 8;
+ h->sum += h->addr[offset].nr_samples;
}
}
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index bac698d7cc6a..3a176633b324 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -74,16 +74,21 @@ static inline bool disasm_line__has_offset(const struct disasm_line *dl)
return dl->ops.target.offset_avail;
}
+struct sym_hist_entry {
+ u64 nr_samples;
+ u64 period;
+};
+
void disasm_line__free(struct disasm_line *dl);
struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos);
int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
size_t disasm__fprintf(struct list_head *head, FILE *fp);
double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
- s64 end, const char **path, u64 *nr_samples);
+ s64 end, const char **path, struct sym_hist_entry *sample);
struct sym_hist {
u64 sum;
- u64 addr[0];
+ struct sym_hist_entry addr[0];
};
struct cyc_hist {
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 18/40] perf annotate: Rename 'sum' to 'nr_samples' in struct sym_hist
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (16 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 17/40] perf annotate: Introduce struct sym_hist_entry Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 19/40] perf hists: Pass perf_sample to __symbol__inc_addr_samples() Arnaldo Carvalho de Melo
` (22 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Jiri Olsa,
Namhyung Kim, Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
To make it more clear that it is the sum of all the nr_samples fields in the
addr[] entries, i.e.:
sym_hist->nr_samples = sum(sym_hist->addr[0 .. symbol__size(sym)]->nr_samples)
Committer notes:
Taeung had renamed it to total_samples, but using nr_samples, as in the
added explanation above, looks clearer and establishes the direct
connection, making clear it is about the _number_ of samples.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1500500211-16599-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/gtk/annotate.c | 2 +-
tools/perf/util/annotate.c | 26 +++++++++++++-------------
tools/perf/util/annotate.h | 2 +-
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index d736fd57ab9b..02176193f427 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -37,7 +37,7 @@ static int perf_gtk__get_percent(char *buf, size_t size, struct symbol *sym,
if (!symbol_conf.event_group && !symhist->addr[dl->offset].nr_samples)
return 0;
- percent = 100.0 * symhist->addr[dl->offset].nr_samples / symhist->sum;
+ percent = 100.0 * symhist->addr[dl->offset].nr_samples / symhist->nr_samples;
markup = perf_gtk__get_percent_color(percent);
if (markup)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index c3829555ce1c..58c6b63ff049 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -713,7 +713,7 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
offset = addr - sym->start;
h = annotation__histogram(notes, evidx);
- h->sum++;
+ h->nr_samples++;
h->addr[offset].nr_samples++;
pr_debug3("%#" PRIx64 " %s: period++ [addr: %#" PRIx64 ", %#" PRIx64
@@ -957,9 +957,9 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
while (offset < end)
hits += h->addr[offset++].nr_samples;
- if (h->sum) {
+ if (h->nr_samples) {
sample->nr_samples = hits;
- percent = 100.0 * hits / h->sum;
+ percent = 100.0 * hits / h->nr_samples;
}
}
@@ -1672,19 +1672,19 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
struct sym_hist *h = annotation__histogram(notes, evidx);
struct rb_root tmp_root = RB_ROOT;
int nr_pcnt = 1;
- u64 h_sum = h->sum;
+ u64 nr_samples = h->nr_samples;
size_t sizeof_src_line = sizeof(struct source_line);
if (perf_evsel__is_group_event(evsel)) {
for (i = 1; i < evsel->nr_members; i++) {
h = annotation__histogram(notes, evidx + i);
- h_sum += h->sum;
+ nr_samples += h->nr_samples;
}
nr_pcnt = evsel->nr_members;
sizeof_src_line += (nr_pcnt - 1) * sizeof(src_line->samples);
}
- if (!h_sum)
+ if (!nr_samples)
return 0;
src_line = notes->src->lines = calloc(len, sizeof_src_line);
@@ -1694,7 +1694,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
start = map__rip_2objdump(map, sym->start);
for (i = 0; i < len; i++) {
- u64 offset, nr_samples;
+ u64 offset;
double percent_max = 0.0;
src_line->nr_pcnt = nr_pcnt;
@@ -1704,8 +1704,8 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
h = annotation__histogram(notes, evidx + k);
nr_samples = h->addr[i].nr_samples;
- if (h->sum)
- percent = 100.0 * nr_samples / h->sum;
+ if (h->nr_samples)
+ percent = 100.0 * nr_samples / h->nr_samples;
if (percent > percent_max)
percent_max = percent;
@@ -1777,7 +1777,7 @@ static void symbol__annotate_hits(struct symbol *sym, struct perf_evsel *evsel)
if (h->addr[offset].nr_samples != 0)
printf("%*" PRIx64 ": %" PRIu64 "\n", BITS_PER_LONG / 2,
sym->start + offset, h->addr[offset].nr_samples);
- printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum);
+ printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->nr_samples", h->nr_samples);
}
int symbol__annotate_printf(struct symbol *sym, struct map *map,
@@ -1813,7 +1813,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
width *= evsel->nr_members;
graph_dotted_len = printf(" %-*.*s| Source code & Disassembly of %s for %s (%" PRIu64 " samples)\n",
- width, width, "Percent", d_filename, evsel_name, h->sum);
+ width, width, "Percent", d_filename, evsel_name, h->nr_samples);
printf("%-*.*s----\n",
graph_dotted_len, graph_dotted_len, graph_dotted_line);
@@ -1877,10 +1877,10 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
struct sym_hist *h = annotation__histogram(notes, evidx);
int len = symbol__size(sym), offset;
- h->sum = 0;
+ h->nr_samples = 0;
for (offset = 0; offset < len; ++offset) {
h->addr[offset].nr_samples = h->addr[offset].nr_samples * 7 / 8;
- h->sum += h->addr[offset].nr_samples;
+ h->nr_samples += h->addr[offset].nr_samples;
}
}
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 3a176633b324..e8c246ec53df 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -87,7 +87,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
s64 end, const char **path, struct sym_hist_entry *sample);
struct sym_hist {
- u64 sum;
+ u64 nr_samples;
struct sym_hist_entry addr[0];
};
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 19/40] perf hists: Pass perf_sample to __symbol__inc_addr_samples()
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (17 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 18/40] perf annotate: Rename 'sum' to 'nr_samples' in struct sym_hist Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 20/40] perf annotate: Store the sample period in each histogram bucket Arnaldo Carvalho de Melo
` (21 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Jiri Olsa,
Namhyung Kim, Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
To pave the way to use perf_sample fields in the annotate code, storing
sample->period in sym_hist->addr->period and its sum in
sym_hist->period.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1500500215-16646-1-git-send-email-treeze.taeung@gmail.com
[ split and adjusted from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-report.c | 15 ++++++++-------
tools/perf/builtin-top.c | 5 +++--
tools/perf/util/annotate.c | 18 +++++++++++-------
tools/perf/util/annotate.h | 6 ++++--
5 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 5205408e795b..96fe1a88c1e5 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -184,7 +184,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
if (he == NULL)
return -ENOMEM;
- ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
+ ret = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr);
hists__inc_nr_samples(hists, true);
return ret;
}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index cea25d03f4dd..983b238d5eea 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -115,37 +115,38 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
struct report *rep = arg;
struct hist_entry *he = iter->he;
struct perf_evsel *evsel = iter->evsel;
+ struct perf_sample *sample = iter->sample;
struct mem_info *mi;
struct branch_info *bi;
if (!ui__has_annotation())
return 0;
- hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
+ hist__account_cycles(sample->branch_stack, al, sample,
rep->nonany_branch_mode);
if (sort__mode == SORT_MODE__BRANCH) {
bi = he->branch_info;
- err = addr_map_symbol__inc_samples(&bi->from, evsel->idx);
+ err = addr_map_symbol__inc_samples(&bi->from, sample, evsel->idx);
if (err)
goto out;
- err = addr_map_symbol__inc_samples(&bi->to, evsel->idx);
+ err = addr_map_symbol__inc_samples(&bi->to, sample, evsel->idx);
} else if (rep->mem_mode) {
mi = he->mem_info;
- err = addr_map_symbol__inc_samples(&mi->daddr, evsel->idx);
+ err = addr_map_symbol__inc_samples(&mi->daddr, sample, evsel->idx);
if (err)
goto out;
- err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
+ err = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr);
} else if (symbol_conf.cumulate_callchain) {
if (single)
- err = hist_entry__inc_addr_samples(he, evsel->idx,
+ err = hist_entry__inc_addr_samples(he, sample, evsel->idx,
al->addr);
} else {
- err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
+ err = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr);
}
out:
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 022486dc67f5..e5a8f249077f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -183,6 +183,7 @@ static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip)
static void perf_top__record_precise_ip(struct perf_top *top,
struct hist_entry *he,
+ struct perf_sample *sample,
int counter, u64 ip)
{
struct annotation *notes;
@@ -199,7 +200,7 @@ static void perf_top__record_precise_ip(struct perf_top *top,
if (pthread_mutex_trylock(¬es->lock))
return;
- err = hist_entry__inc_addr_samples(he, counter, ip);
+ err = hist_entry__inc_addr_samples(he, sample, counter, ip);
pthread_mutex_unlock(¬es->lock);
@@ -671,7 +672,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
struct perf_evsel *evsel = iter->evsel;
if (perf_hpp_list.sym && single)
- perf_top__record_precise_ip(top, he, evsel->idx, al->addr);
+ perf_top__record_precise_ip(top, he, iter->sample, evsel->idx, al->addr);
hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
!(top->record_opts.branch_stack & PERF_SAMPLE_BRANCH_ANY));
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 58c6b63ff049..c2fe16d5e473 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -697,7 +697,8 @@ static int __symbol__account_cycles(struct annotation *notes,
}
static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
- struct annotation *notes, int evidx, u64 addr)
+ struct annotation *notes, int evidx, u64 addr,
+ struct perf_sample *sample __maybe_unused)
{
unsigned offset;
struct sym_hist *h;
@@ -738,7 +739,8 @@ static struct annotation *symbol__get_annotation(struct symbol *sym, bool cycles
}
static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
- int evidx, u64 addr)
+ int evidx, u64 addr,
+ struct perf_sample *sample)
{
struct annotation *notes;
@@ -747,7 +749,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
notes = symbol__get_annotation(sym, false);
if (notes == NULL)
return -ENOMEM;
- return __symbol__inc_addr_samples(sym, map, notes, evidx, addr);
+ return __symbol__inc_addr_samples(sym, map, notes, evidx, addr, sample);
}
static int symbol__account_cycles(u64 addr, u64 start,
@@ -811,14 +813,16 @@ int addr_map_symbol__account_cycles(struct addr_map_symbol *ams,
return err;
}
-int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, int evidx)
+int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample,
+ int evidx)
{
- return symbol__inc_addr_samples(ams->sym, ams->map, evidx, ams->al_addr);
+ return symbol__inc_addr_samples(ams->sym, ams->map, evidx, ams->al_addr, sample);
}
-int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip)
+int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
+ int evidx, u64 ip)
{
- return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);
+ return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip, sample);
}
static void disasm_line__init_ins(struct disasm_line *dl, struct arch *arch, struct map *map)
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index e8c246ec53df..720f18195046 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -154,13 +154,15 @@ static inline struct annotation *symbol__annotation(struct symbol *sym)
return (void *)sym - symbol_conf.priv_size;
}
-int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, int evidx);
+int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample,
+ int evidx);
int addr_map_symbol__account_cycles(struct addr_map_symbol *ams,
struct addr_map_symbol *start,
unsigned cycles);
-int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);
+int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
+ int evidx, u64 addr);
int symbol__alloc_hist(struct symbol *sym);
void symbol__annotate_zero_histograms(struct symbol *sym);
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 20/40] perf annotate: Store the sample period in each histogram bucket
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (18 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 19/40] perf hists: Pass perf_sample to __symbol__inc_addr_samples() Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 21/40] perf annotate: Do not overwrite sample->period Arnaldo Carvalho de Melo
` (20 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan,
Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
We'll use it soon, when fixing --show-total-period.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1500500215-16646-1-git-send-email-treeze.taeung@gmail.com
[ split from a larger patch, do the math in __symbol__inc_addr_samples() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 17 ++++++++++++-----
tools/perf/util/annotate.h | 1 +
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index c2fe16d5e473..00e085fc945b 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -698,7 +698,7 @@ static int __symbol__account_cycles(struct annotation *notes,
static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
struct annotation *notes, int evidx, u64 addr,
- struct perf_sample *sample __maybe_unused)
+ struct perf_sample *sample)
{
unsigned offset;
struct sym_hist *h;
@@ -716,10 +716,13 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
h = annotation__histogram(notes, evidx);
h->nr_samples++;
h->addr[offset].nr_samples++;
+ h->period += sample->period;
+ h->addr[offset].period += sample->period;
pr_debug3("%#" PRIx64 " %s: period++ [addr: %#" PRIx64 ", %#" PRIx64
- ", evidx=%d] => %" PRIu64 "\n", sym->start, sym->name,
- addr, addr - sym->start, evidx, h->addr[offset].nr_samples);
+ ", evidx=%d] => nr_samples: %" PRIu64 ", period: %" PRIu64 "\n",
+ sym->start, sym->name, addr, addr - sym->start, evidx,
+ h->addr[offset].nr_samples, h->addr[offset].period);
return 0;
}
@@ -937,7 +940,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
struct source_line *src_line = notes->src->lines;
double percent = 0.0;
- sample->nr_samples = 0;
+ sample->nr_samples = sample->period = 0;
if (src_line) {
size_t sizeof_src_line = sizeof(*src_line) +
@@ -957,11 +960,15 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
} else {
struct sym_hist *h = annotation__histogram(notes, evidx);
unsigned int hits = 0;
+ u64 period = 0;
- while (offset < end)
+ while (offset < end) {
hits += h->addr[offset++].nr_samples;
+ period += h->addr[offset++].period;
+ }
if (h->nr_samples) {
+ sample->period = period;
sample->nr_samples = hits;
percent = 100.0 * hits / h->nr_samples;
}
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 720f18195046..9ce575c25fd9 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -88,6 +88,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
struct sym_hist {
u64 nr_samples;
+ u64 period;
struct sym_hist_entry addr[0];
};
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 21/40] perf annotate: Do not overwrite sample->period
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (19 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 20/40] perf annotate: Store the sample period in each histogram bucket Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 22/40] perf annotate stdio: Fix --show-total-period Arnaldo Carvalho de Melo
` (19 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Jiri Olsa,
Milian Wolff, Namhyung Kim, Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
In fixing the --show-total-period option it was noticed that the value
of sample->period was being overwritten, fix it.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: fd36f3dd7933 ("perf hist: Pass struct sample to __hists__add_entry()")
Link: http://lkml.kernel.org/r/1500500215-16646-1-git-send-email-treeze.taeung@gmail.com
[ split from a larger patch, added the Fixes tag ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-annotate.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 96fe1a88c1e5..7e33278eff67 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -177,7 +177,6 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
*/
process_branch_stack(sample->branch_stack, al, sample);
- sample->period = 1;
sample->weight = 1;
he = hists__add_entry(hists, al, NULL, NULL, NULL, sample, true);
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 22/40] perf annotate stdio: Fix --show-total-period
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (20 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 21/40] perf annotate: Do not overwrite sample->period Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 23/40] perf report: Fix kernel symbol adjustment for s390x Arnaldo Carvalho de Melo
` (18 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Jiri Olsa,
Martin Liška, Milian Wolff, Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
We were showing the total number of samples, not the total period as
asked by the user, fix it.
Reported-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Martin Liška <mliska@suse.cz>
Cc: Milian Wolff <milian.wolff@kdab.com>
Link: http://lkml.kernel.org/n/tip-lh2nh89rtqn5x5vbfthw6qml@git.kernel.org
Fixes: 0c4a5bcea460 ("perf annotate: Display total number of samples with --show-total-period")
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 00e085fc945b..004072f82511 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1143,7 +1143,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
if (symbol_conf.show_total_period)
color_fprintf(stdout, color, " %7" PRIu64,
- sample.nr_samples);
+ sample.period);
else
color_fprintf(stdout, color, " %7.2f", percent);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 23/40] perf report: Fix kernel symbol adjustment for s390x
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (21 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 22/40] perf annotate stdio: Fix --show-total-period Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 24/40] perf cgroup: Fix refcount usage Arnaldo Carvalho de Melo
` (17 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Thomas Richter, Hendrik Brueckner,
Arnaldo Carvalho de Melo
From: Thomas Richter <tmricht@linux.vnet.ibm.com>
On s390x the kernel text segment starts at address 0x0. When perf
report reads kernel symbols from vmlinux file it adds an offset of
0x1000.
For example see symbol set_reset_devices:
[root@s8360047 linux-devel]# nm -A vmlinux| fgrep set_reset_devices
vmlinux:0000000001379000 t set_reset_devices
[root@s8360047 linux-devel]#
[root@s8360047 linux-devel]# fgrep set_reset_devices /proc/kallsyms
0000000001379000 t set_reset_devices
[root@s8360047 linux-devel]#
The kernel symbol table and the vmlinux file have the same address for
symbol set_reset_devices namely 1379000.
When perf report reads this symbols it displays it with address
symbol__new: set_reset_devices 0x137a000-0x137a018
There is a difference between perf report and vmlinux of 0x1000.
The reason for the difference is at kernel symbol load time in function
dso__load_sym(). The vmlinux file is investigated with its ELF header.
Command readelf shows this:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000000000000 00001000
0000000000b0e0c2 0000000000000000 AX 0 0 128
This leads to an invalid calculation of the symbol start address, see
file utit/symbol-elf.c line 974:
/* Adjust symbol to map to file offset */
if (adjust_kernel_syms)
sym.st_value -= shdr.sh_addr - shdr.sh_offset;
With shdr.sh_addr set to 0x0 and shdr.sh_offset set to 0x1000 as read
from the ELF .text section 0x1000 is added to the symbol address.
I would like to fix this by introducing an archticture specific function
named elf__needs_adjust_symbols(). This is the same approach as done by
PowerPC. The function currently does not exist for s390x and the
default weak one is used. The s390x specific one returns false when
symsrc_init() is invoked for kernel symbols and results in variable
adjust_kernel_syms being false. This omits the adjustment and the
correct address is displayed (when symbol resolvement does not work).
The s390x specific function returns false for kernel symbol adjustment
and returns true for kernel modules, processes and shared libraries.
Signed-off-by: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
LPU-Reference: 20170713130252.6167-1-tmricht@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/s390/util/Build | 1 +
tools/perf/arch/s390/util/sym-handling.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
create mode 100644 tools/perf/arch/s390/util/sym-handling.c
diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build
index 5bd7b9260cc0..bd518b623d7a 100644
--- a/tools/perf/arch/s390/util/Build
+++ b/tools/perf/arch/s390/util/Build
@@ -1,4 +1,5 @@
libperf-y += header.o
+libperf-y += sym-handling.o
libperf-y += kvm-stat.o
libperf-$(CONFIG_DWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/s390/util/sym-handling.c b/tools/perf/arch/s390/util/sym-handling.c
new file mode 100644
index 000000000000..b6cd056ccf71
--- /dev/null
+++ b/tools/perf/arch/s390/util/sym-handling.c
@@ -0,0 +1,22 @@
+/*
+ * Architecture specific ELF symbol handling and relocation mapping.
+ *
+ * Copyright 2017 IBM Corp.
+ * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License (version 2 only)
+ * as published by the Free Software Foundation.
+ */
+
+#include "symbol.h"
+
+#ifdef HAVE_LIBELF_SUPPORT
+bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
+{
+ if (ehdr.e_type == ET_EXEC)
+ return false;
+ return ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN;
+}
+
+#endif
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 24/40] perf cgroup: Fix refcount usage
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (22 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 23/40] perf report: Fix kernel symbol adjustment for s390x Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 25/40] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile Arnaldo Carvalho de Melo
` (16 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Alexander Shishkin, David Ahern, David Carrillo-Cisneros,
Kees Kook, Krister Johansen, Paul Turner, Peter Zijlstra,
Stephane Eranian, Sudeep Holla, Thomas-Mich Richter, Wang Nan,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
When converting from atomic_t to refcount_t we didn't follow the usual
step of initializing it to one before taking any new reference, which
trips over checking if taking a reference for a freed refcount_t, fix
it.
Brendan's report:
---
It's 4.12-rc7, with node v4.4.1. I'm building 4.13-rc1 now, as I hit
what I think is another unrelated perf bug and I'm starting to wonder
what else is broken on that version:
(root) /mnt/src/linux-4.12-rc7/tools/perf # ./perf record -F 99 -a -e
cpu-clock --cgroup=docker/f9e9d5df065b14646e8a11edc837a13877fd90c171137b2ba3feb67a0201cb65
-g
perf: /mnt/src/linux-4.12-rc7/tools/include/linux/refcount.h:108:
refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
Aborted
that used to work...
---
Testing it:
Before:
# perf stat -e cycles -C 0 --cgroup /
perf: /home/acme/git/linux/tools/include/linux/refcount.h:108: refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
Aborted (core dumped)
#
After:
# perf stat -e cycles -C 0 --cgroup /
^C
Performance counter stats for 'CPU(s) 0':
132,081,393 cycles /
2.492942763 seconds time elapsed
#
Reported-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Acked-by: Elena Reshetova <elena.reshetova@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sudeep Holla <Sudeep.Holla@arm.com>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 79c5fe6db8c7 ("perf cgroup: Convert cgroup_sel.refcnt from atomic_t to refcount_t")
Link: http://lkml.kernel.org/n/tip-l7ovfblq14ip2i08m1g0fkhv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/cgroup.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 03347748f3fa..0e77bc9e5f3c 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -98,8 +98,10 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
cgrp = counter->cgrp;
if (!cgrp)
continue;
- if (!strcmp(cgrp->name, str))
+ if (!strcmp(cgrp->name, str)) {
+ refcount_inc(&cgrp->refcnt);
break;
+ }
cgrp = NULL;
}
@@ -110,6 +112,7 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
return -1;
cgrp->name = str;
+ refcount_set(&cgrp->refcnt, 1);
cgrp->fd = open_cgroup(str);
if (cgrp->fd == -1) {
@@ -128,12 +131,11 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
goto found;
n++;
}
- if (refcount_read(&cgrp->refcnt) == 0)
+ if (refcount_dec_and_test(&cgrp->refcnt))
free(cgrp);
return -1;
found:
- refcount_inc(&cgrp->refcnt);
counter->cgrp = cgrp;
return 0;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 25/40] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (23 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 24/40] perf cgroup: Fix refcount usage Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 26/40] perf annotate: Process tracing data in pipe mode Arnaldo Carvalho de Melo
` (15 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, David Carrillo-Cisneros,
Alexander Shishkin, Elena Reshetova, Kees Kook, Paul Turner,
Stephane Eranian, Sudeep Holla, Wang Nan,
Arnaldo Carvalho de Melo
From: David Carrillo-Cisneros <davidcc@google.com>
The goal is to allow users to override linking of libraries that
were automatically added to PERFLIBS.
EXCLUDE_EXTLIBS contains linker flags to be removed from LIBS
while EXTRA_PERFLIBS contains linker flags to be added.
My use case is to force certain library to be build statically,
e.g. for libelf:
EXCLUDE_EXTLIBS=-lelf EXTRA_PERFLIBS=path/libelf.a
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Paul Turner <pjt@google.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170719011839.99399-3-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.perf | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5008f51a08a2..100a6c1670c8 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -33,6 +33,11 @@ include ../scripts/utilities.mak
#
# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
#
+# Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated
+# EXTLIBS.
+#
+# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
+#
# Define NO_DWARF if you do not want debug-info analysis feature at all.
#
# Define WERROR=0 to disable treating any warnings as errors.
@@ -352,7 +357,8 @@ ifdef ASCIIDOC8
export ASCIIDOC8
endif
-LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
+LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
ifeq ($(USE_CLANG), 1)
CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 26/40] perf annotate: Process tracing data in pipe mode
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (24 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 25/40] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 27/40] perf jvmti: Fix linker error when libelf config is disabled Arnaldo Carvalho de Melo
` (14 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, David Carrillo-Cisneros,
Alexander Shishkin, Elena Reshetova, Kees Kook, Paul Turner,
Stephane Eranian, Sudeep Holla, Wang Nan,
Arnaldo Carvalho de Melo
From: David Carrillo-Cisneros <davidcc@google.com>
'perf annotate' was missing the handler for tracing data records.
Prior to this patch we obtained "unhandled" records when piping trace
events to perf annotate (using -D option to show the dump_printf
messages in process_event_synth_tracing_data_stub):
$ perf record -o - -e block:bio_free sleep 2 | perf annotate -D --stdio
...
0x78 [0xc]: PERF_RECORD_TRACING_DATA: unhandled!
...
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Paul Turner <pjt@google.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170719011839.99399-4-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-annotate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 7e33278eff67..6db782dfce96 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -396,6 +396,7 @@ int cmd_annotate(int argc, const char **argv)
.namespaces = perf_event__process_namespaces,
.attr = perf_event__process_attr,
.build_id = perf_event__process_build_id,
+ .tracing_data = perf_event__process_tracing_data,
.feature = perf_event__process_feature,
.ordered_events = true,
.ordering_requires_timestamps = true,
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 27/40] perf jvmti: Fix linker error when libelf config is disabled
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (25 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 26/40] perf annotate: Process tracing data in pipe mode Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 28/40] perf evsel: Add verbose output for sys_perf_event_open fallback Arnaldo Carvalho de Melo
` (13 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Sudeep Holla, Sudeep Holla,
Alexander Shishkin, Elena Reshetova, Kees Kook, Paul Turner,
Peter Zijlstra, Stephane Eranian, Wang Nan,
Arnaldo Carvalho de Melo
From: Sudeep Holla <Sudeep.Holla@arm.com>
When libelf is disabled in the configuration, we get the following
linker error:
LINK libperf-jvmti.so
ld: cannot find -lelf
Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: David Carrillo-Cisneros <davidcc@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
Link: http://lkml.kernel.org/r/20170719011839.99399-5-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 100a6c1670c8..d66f90e6be5c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -518,7 +518,7 @@ $(LIBJVMTI_IN): FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
- $(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+ $(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
endif
$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 28/40] perf evsel: Add verbose output for sys_perf_event_open fallback
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (26 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 27/40] perf jvmti: Fix linker error when libelf config is disabled Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 29/40] perf top: Support lookup of symbols in other mount namespaces Arnaldo Carvalho de Melo
` (12 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Jiri Olsa, Alexander Shishkin,
Andi Kleen, David Ahern, Namhyung Kim, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@kernel.org>
Adding info about what is being switched off in the sys_perf_event_open
fallback.
New output (notice the 'switching off' lines):
$ perf stat -e '{cycles,instructions}' -vvv ls
Using CPUID GenuineIntel-6-3D
intel_pt default config: tsc
------------------------------------------------------------
perf_event_attr:
size 112
sample_type IDENTIFIER
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
disabled 1
inherit 1
enable_on_exec 1
exclude_guest 1
------------------------------------------------------------
sys_perf_event_open: pid 3591 cpu -1 group_fd -1 flags 0x8
sys_perf_event_open failed, error -22
switching off cloexec flag
------------------------------------------------------------
perf_event_attr:
size 112
sample_type IDENTIFIER
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
disabled 1
inherit 1
enable_on_exec 1
exclude_guest 1
------------------------------------------------------------
sys_perf_event_open: pid 3591 cpu -1 group_fd -1 flags 0
sys_perf_event_open failed, error -22
switching off exclude_guest, exclude_host
------------------------------------------------------------
perf_event_attr:
size 112
sample_type IDENTIFIER
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
disabled 1
inherit 1
enable_on_exec 1
------------------------------------------------------------
sys_perf_event_open: pid 3591 cpu -1 group_fd -1 flags 0
sys_perf_event_open failed, error -22
switching off sample_id_all
------------------------------------------------------------
perf_event_attr:
size 112
sample_type IDENTIFIER
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
disabled 1
inherit 1
enable_on_exec 1
...
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170721121212.21414-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 6dd069a41ac3..450b5fadf8cb 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1671,31 +1671,39 @@ int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
*/
if (!perf_missing_features.write_backward && evsel->attr.write_backward) {
perf_missing_features.write_backward = true;
+ pr_debug2("switching off write_backward\n");
goto out_close;
} else if (!perf_missing_features.clockid_wrong && evsel->attr.use_clockid) {
perf_missing_features.clockid_wrong = true;
+ pr_debug2("switching off clockid\n");
goto fallback_missing_features;
} else if (!perf_missing_features.clockid && evsel->attr.use_clockid) {
perf_missing_features.clockid = true;
+ pr_debug2("switching off use_clockid\n");
goto fallback_missing_features;
} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
perf_missing_features.cloexec = true;
+ pr_debug2("switching off cloexec flag\n");
goto fallback_missing_features;
} else if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {
perf_missing_features.mmap2 = true;
+ pr_debug2("switching off mmap2\n");
goto fallback_missing_features;
} else if (!perf_missing_features.exclude_guest &&
(evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
perf_missing_features.exclude_guest = true;
+ pr_debug2("switching off exclude_guest, exclude_host\n");
goto fallback_missing_features;
} else if (!perf_missing_features.sample_id_all) {
perf_missing_features.sample_id_all = true;
+ pr_debug2("switching off sample_id_all\n");
goto retry_sample_id;
} else if (!perf_missing_features.lbr_flags &&
(evsel->attr.branch_sample_type &
(PERF_SAMPLE_BRANCH_NO_CYCLES |
PERF_SAMPLE_BRANCH_NO_FLAGS))) {
perf_missing_features.lbr_flags = true;
+ pr_debug2("switching off branch sample type no (cycles/flags)\n");
goto fallback_missing_features;
}
out_close:
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 29/40] perf top: Support lookup of symbols in other mount namespaces.
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (27 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 28/40] perf evsel: Add verbose output for sys_perf_event_open fallback Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 30/40] perf script: Remove some bogus error handling Arnaldo Carvalho de Melo
` (11 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Krister Johansen,
Alexander Shishkin, Brendan Gregg, Peter Zijlstra,
Thomas-Mich Richter, Arnaldo Carvalho de Melo
From: Krister Johansen <kjlx@templeofstupid.com>
The perf top command needs to unshare its fs from the helper threads in
order to successfully setns(2) during its symbol lookup. It also needs
to impelement a force flag to ignore ownership of perf-<pid>.map files.
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1499305693-1599-6-git-send-email-kjlx@templeofstupid.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-top.txt | 4 ++++
tools/perf/builtin-top.c | 15 +++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index e71d63843f45..d864ea6fd367 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -237,6 +237,10 @@ Default is to monitor all CPUS.
--hierarchy::
Enable hierarchy output.
+--force::
+ Don't do ownership validation.
+
+
INTERACTIVE PROMPTING KEYS
--------------------------
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index e5a8f249077f..ee954bde7e3e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -587,6 +587,13 @@ static void *display_thread_tui(void *arg)
.refresh = top->delay_secs,
};
+ /* In order to read symbols from other namespaces perf to needs to call
+ * setns(2). This isn't permitted if the struct_fs has multiple users.
+ * unshare(2) the fs so that we may continue to setns into namespaces
+ * that we're observing.
+ */
+ unshare(CLONE_FS);
+
perf_top__sort_new_samples(top);
/*
@@ -628,6 +635,13 @@ static void *display_thread(void *arg)
struct perf_top *top = arg;
int delay_msecs, c;
+ /* In order to read symbols from other namespaces perf to needs to call
+ * setns(2). This isn't permitted if the struct_fs has multiple users.
+ * unshare(2) the fs so that we may continue to setns into namespaces
+ * that we're observing.
+ */
+ unshare(CLONE_FS);
+
display_setup_sig();
pthread__unblock_sigwinch();
repeat:
@@ -1206,6 +1220,7 @@ int cmd_top(int argc, const char **argv)
"Show raw trace event output (do not use print fmt or plugins)"),
OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy,
"Show entries in a hierarchy"),
+ OPT_BOOLEAN(0, "force", &symbol_conf.force, "don't complain, do it"),
OPT_END()
};
const char * const top_usage[] = {
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 30/40] perf script: Remove some bogus error handling
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (28 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 29/40] perf top: Support lookup of symbols in other mount namespaces Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 31/40] perf script python: Allocate memory only if handler exists Arnaldo Carvalho de Melo
` (10 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Dan Carpenter, Alexander Shishkin,
Peter Zijlstra, kernel-janitors, Arnaldo Carvalho de Melo
From: Dan Carpenter <dan.carpenter@oracle.com>
If script_desc__new() fails then the current code has a NULL
dereference. We don't actually need to do any cleanup, we can just
return NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-janitors@vger.kernel.org
Link: http://lkml.kernel.org/r/20170722073610.nnsyiwdcfl6bhn4t@mwanda
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-script.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d430ff42208a..378f76cdf923 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2199,16 +2199,11 @@ static struct script_desc *script_desc__findnew(const char *name)
s = script_desc__new(name);
if (!s)
- goto out_delete_desc;
+ return NULL;
script_desc__add(s);
return s;
-
-out_delete_desc:
- script_desc__delete(s);
-
- return NULL;
}
static const char *ends_with(const char *str, const char *suffix)
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 31/40] perf script python: Allocate memory only if handler exists
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (29 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 30/40] perf script: Remove some bogus error handling Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 32/40] perf script python: Refactor creation of perf sample dict Arnaldo Carvalho de Melo
` (9 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arun Kalyanasundaram,
Alexander Shishkin, Daniel Borkmann, David Carrillo-Cisneros,
David S . Miller, Peter Zijlstra, Seongjae Park, Stephane Eranian,
Arnaldo Carvalho de Melo
From: Arun Kalyanasundaram <arunkaly@google.com>
Avoid allocating memory if hook handler is not available. This saves
unused memory allocation and simplifies error path.
Let handler in python_process_tracepoint point to either tracepoint
specific or trace_unhandled hook. Use dict to check if handler points to
trace_unhandled.
Remove the exit label in python_process_general_event and return when no
handler is available.
Signed-off-by: Arun Kalyanasundaram <arunkaly@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Seongjae Park <sj38.park@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20170721220422.63962-2-arunkaly@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../util/scripting-engines/trace-event-python.c | 38 +++++++++++++---------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 57b7a00e6f16..8a8f4829d3e2 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -407,10 +407,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
void *data = sample->raw_data;
unsigned long long nsecs = sample->time;
const char *comm = thread__comm_str(al->thread);
-
- t = PyTuple_New(MAX_FIELDS);
- if (!t)
- Py_FatalError("couldn't create Python tuple");
+ const char *default_handler_name = "trace_unhandled";
if (!event) {
snprintf(handler_name, sizeof(handler_name),
@@ -427,10 +424,19 @@ static void python_process_tracepoint(struct perf_sample *sample,
handler = get_handler(handler_name);
if (!handler) {
+ handler = get_handler(default_handler_name);
+ if (!handler)
+ return;
dict = PyDict_New();
if (!dict)
Py_FatalError("couldn't create Python dict");
}
+
+ t = PyTuple_New(MAX_FIELDS);
+ if (!t)
+ Py_FatalError("couldn't create Python tuple");
+
+
s = nsecs / NSEC_PER_SEC;
ns = nsecs - s * NSEC_PER_SEC;
@@ -445,7 +451,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
/* ip unwinding */
callchain = python_process_callchain(sample, evsel, al);
- if (handler) {
+ if (!dict) {
PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
PyTuple_SetItem(t, n++, PyInt_FromLong(s));
PyTuple_SetItem(t, n++, PyInt_FromLong(ns));
@@ -484,23 +490,23 @@ static void python_process_tracepoint(struct perf_sample *sample,
} else { /* FIELD_IS_NUMERIC */
obj = get_field_numeric_entry(event, field, data);
}
- if (handler)
+ if (!dict)
PyTuple_SetItem(t, n++, obj);
else
pydict_set_item_string_decref(dict, field->name, obj);
}
- if (!handler)
+ if (dict)
PyTuple_SetItem(t, n++, dict);
if (_PyTuple_Resize(&t, n) == -1)
Py_FatalError("error resizing Python tuple");
- if (handler) {
+ if (!dict) {
call_object(handler, t, handler_name);
} else {
- try_call_object("trace_unhandled", t);
+ call_object(handler, t, default_handler_name);
Py_DECREF(dict);
}
@@ -799,6 +805,12 @@ static void python_process_general_event(struct perf_sample *sample,
static char handler_name[64];
unsigned n = 0;
+ snprintf(handler_name, sizeof(handler_name), "%s", "process_event");
+
+ handler = get_handler(handler_name);
+ if (!handler)
+ return;
+
/*
* Use the MAX_FIELDS to make the function expandable, though
* currently there is only one item for the tuple.
@@ -815,12 +827,6 @@ static void python_process_general_event(struct perf_sample *sample,
if (!dict_sample)
Py_FatalError("couldn't create Python dictionary");
- snprintf(handler_name, sizeof(handler_name), "%s", "process_event");
-
- handler = get_handler(handler_name);
- if (!handler)
- goto exit;
-
pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize(
(const char *)&evsel->attr, sizeof(evsel->attr)));
@@ -861,7 +867,7 @@ static void python_process_general_event(struct perf_sample *sample,
Py_FatalError("error resizing Python tuple");
call_object(handler, t, handler_name);
-exit:
+
Py_DECREF(dict);
Py_DECREF(t);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 32/40] perf script python: Refactor creation of perf sample dict
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (30 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 31/40] perf script python: Allocate memory only if handler exists Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 33/40] perf script python: Add sample_read to dict Arnaldo Carvalho de Melo
` (8 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arun Kalyanasundaram,
Alexander Shishkin, Daniel Borkmann, David Carrillo-Cisneros,
David S . Miller, Peter Zijlstra, Seongjae Park, Stephane Eranian,
Arnaldo Carvalho de Melo
From: Arun Kalyanasundaram <arunkaly@google.com>
Move the creation of the dict containing perf_sample entries into a
helper function to enable its reuse in other sample processing routines.
Signed-off-by: Arun Kalyanasundaram <arunkaly@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Seongjae Park <sj38.park@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20170721220422.63962-3-arunkaly@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../util/scripting-engines/trace-event-python.c | 94 ++++++++++++----------
1 file changed, 53 insertions(+), 41 deletions(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 8a8f4829d3e2..69d1b6db96f6 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -391,6 +391,57 @@ static PyObject *python_process_callchain(struct perf_sample *sample,
return pylist;
}
+static PyObject *get_perf_sample_dict(struct perf_sample *sample,
+ struct perf_evsel *evsel,
+ struct addr_location *al,
+ PyObject *callchain)
+{
+ PyObject *dict, *dict_sample;
+
+ dict = PyDict_New();
+ if (!dict)
+ Py_FatalError("couldn't create Python dictionary");
+
+ dict_sample = PyDict_New();
+ if (!dict_sample)
+ Py_FatalError("couldn't create Python dictionary");
+
+ pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
+ pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize(
+ (const char *)&evsel->attr, sizeof(evsel->attr)));
+
+ pydict_set_item_string_decref(dict_sample, "pid",
+ PyInt_FromLong(sample->pid));
+ pydict_set_item_string_decref(dict_sample, "tid",
+ PyInt_FromLong(sample->tid));
+ pydict_set_item_string_decref(dict_sample, "cpu",
+ PyInt_FromLong(sample->cpu));
+ pydict_set_item_string_decref(dict_sample, "ip",
+ PyLong_FromUnsignedLongLong(sample->ip));
+ pydict_set_item_string_decref(dict_sample, "time",
+ PyLong_FromUnsignedLongLong(sample->time));
+ pydict_set_item_string_decref(dict_sample, "period",
+ PyLong_FromUnsignedLongLong(sample->period));
+ pydict_set_item_string_decref(dict, "sample", dict_sample);
+
+ pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
+ (const char *)sample->raw_data, sample->raw_size));
+ pydict_set_item_string_decref(dict, "comm",
+ PyString_FromString(thread__comm_str(al->thread)));
+ if (al->map) {
+ pydict_set_item_string_decref(dict, "dso",
+ PyString_FromString(al->map->dso->name));
+ }
+ if (al->sym) {
+ pydict_set_item_string_decref(dict, "symbol",
+ PyString_FromString(al->sym->name));
+ }
+
+ pydict_set_item_string_decref(dict, "callchain", callchain);
+
+ return dict;
+}
+
static void python_process_tracepoint(struct perf_sample *sample,
struct perf_evsel *evsel,
struct addr_location *al)
@@ -801,7 +852,7 @@ static void python_process_general_event(struct perf_sample *sample,
struct perf_evsel *evsel,
struct addr_location *al)
{
- PyObject *handler, *t, *dict, *callchain, *dict_sample;
+ PyObject *handler, *t, *dict, *callchain;
static char handler_name[64];
unsigned n = 0;
@@ -819,48 +870,9 @@ static void python_process_general_event(struct perf_sample *sample,
if (!t)
Py_FatalError("couldn't create Python tuple");
- dict = PyDict_New();
- if (!dict)
- Py_FatalError("couldn't create Python dictionary");
-
- dict_sample = PyDict_New();
- if (!dict_sample)
- Py_FatalError("couldn't create Python dictionary");
-
- pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
- pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize(
- (const char *)&evsel->attr, sizeof(evsel->attr)));
-
- pydict_set_item_string_decref(dict_sample, "pid",
- PyInt_FromLong(sample->pid));
- pydict_set_item_string_decref(dict_sample, "tid",
- PyInt_FromLong(sample->tid));
- pydict_set_item_string_decref(dict_sample, "cpu",
- PyInt_FromLong(sample->cpu));
- pydict_set_item_string_decref(dict_sample, "ip",
- PyLong_FromUnsignedLongLong(sample->ip));
- pydict_set_item_string_decref(dict_sample, "time",
- PyLong_FromUnsignedLongLong(sample->time));
- pydict_set_item_string_decref(dict_sample, "period",
- PyLong_FromUnsignedLongLong(sample->period));
- pydict_set_item_string_decref(dict, "sample", dict_sample);
-
- pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
- (const char *)sample->raw_data, sample->raw_size));
- pydict_set_item_string_decref(dict, "comm",
- PyString_FromString(thread__comm_str(al->thread)));
- if (al->map) {
- pydict_set_item_string_decref(dict, "dso",
- PyString_FromString(al->map->dso->name));
- }
- if (al->sym) {
- pydict_set_item_string_decref(dict, "symbol",
- PyString_FromString(al->sym->name));
- }
-
/* ip unwinding */
callchain = python_process_callchain(sample, evsel, al);
- pydict_set_item_string_decref(dict, "callchain", callchain);
+ dict = get_perf_sample_dict(sample, evsel, al, callchain);
PyTuple_SetItem(t, n++, dict);
if (_PyTuple_Resize(&t, n) == -1)
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 33/40] perf script python: Add sample_read to dict
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (31 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 32/40] perf script python: Refactor creation of perf sample dict Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 34/40] perf script python: Add perf_sample dict to tracepoint handlers Arnaldo Carvalho de Melo
` (7 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arun Kalyanasundaram,
Alexander Shishkin, Daniel Borkmann, David Carrillo-Cisneros,
David S . Miller, Peter Zijlstra, Seongjae Park, Stephane Eranian,
Arnaldo Carvalho de Melo
From: Arun Kalyanasundaram <arunkaly@google.com>
Provide time_enabled, time_running and counter value in the perf_sample
dict.
Signed-off-by: Arun Kalyanasundaram <arunkaly@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Seongjae Park <sj38.park@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20170721220422.63962-4-arunkaly@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../util/scripting-engines/trace-event-python.c | 51 ++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 69d1b6db96f6..55a45784c910 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -391,6 +391,56 @@ static PyObject *python_process_callchain(struct perf_sample *sample,
return pylist;
}
+static PyObject *get_sample_value_as_tuple(struct sample_read_value *value)
+{
+ PyObject *t;
+
+ t = PyTuple_New(2);
+ if (!t)
+ Py_FatalError("couldn't create Python tuple");
+ PyTuple_SetItem(t, 0, PyLong_FromUnsignedLongLong(value->id));
+ PyTuple_SetItem(t, 1, PyLong_FromUnsignedLongLong(value->value));
+ return t;
+}
+
+static void set_sample_read_in_dict(PyObject *dict_sample,
+ struct perf_sample *sample,
+ struct perf_evsel *evsel)
+{
+ u64 read_format = evsel->attr.read_format;
+ PyObject *values;
+ unsigned int i;
+
+ if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) {
+ pydict_set_item_string_decref(dict_sample, "time_enabled",
+ PyLong_FromUnsignedLongLong(sample->read.time_enabled));
+ }
+
+ if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) {
+ pydict_set_item_string_decref(dict_sample, "time_running",
+ PyLong_FromUnsignedLongLong(sample->read.time_running));
+ }
+
+ if (read_format & PERF_FORMAT_GROUP)
+ values = PyList_New(sample->read.group.nr);
+ else
+ values = PyList_New(1);
+
+ if (!values)
+ Py_FatalError("couldn't create Python list");
+
+ if (read_format & PERF_FORMAT_GROUP) {
+ for (i = 0; i < sample->read.group.nr; i++) {
+ PyObject *t = get_sample_value_as_tuple(&sample->read.group.values[i]);
+ PyList_SET_ITEM(values, i, t);
+ }
+ } else {
+ PyObject *t = get_sample_value_as_tuple(&sample->read.one);
+ PyList_SET_ITEM(values, 0, t);
+ }
+ pydict_set_item_string_decref(dict_sample, "values", values);
+}
+
static PyObject *get_perf_sample_dict(struct perf_sample *sample,
struct perf_evsel *evsel,
struct addr_location *al,
@@ -422,6 +472,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
PyLong_FromUnsignedLongLong(sample->time));
pydict_set_item_string_decref(dict_sample, "period",
PyLong_FromUnsignedLongLong(sample->period));
+ set_sample_read_in_dict(dict_sample, sample, evsel);
pydict_set_item_string_decref(dict, "sample", dict_sample);
pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 34/40] perf script python: Add perf_sample dict to tracepoint handlers
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (32 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 33/40] perf script python: Add sample_read to dict Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 35/40] perf script python: Generate hooks with additional argument Arnaldo Carvalho de Melo
` (6 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arun Kalyanasundaram,
Alexander Shishkin, Daniel Borkmann, David Carrillo-Cisneros,
David S . Miller, Peter Zijlstra, Seongjae Park, Stephane Eranian,
Arnaldo Carvalho de Melo
From: Arun Kalyanasundaram <arunkaly@google.com>
The process_event python hook receives a dict with all perf_sample
entries, but the tracepoint specific and trace_unhandled hooks predate
the introduction of this dict, and do not receive it.
Add the aforementioned dict as an additional argument to the affected
handlers. To keep backwards compatibility (and avoid unnecessary work),
do not pass the dict if the number of arguments signals that handler
version predates this change.
Signed-off-by: Arun Kalyanasundaram <arunkaly@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Seongjae Park <sj38.park@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20170721220422.63962-5-arunkaly@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../util/scripting-engines/trace-event-python.c | 41 +++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 55a45784c910..938b39f6ad31 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -116,6 +116,34 @@ static PyObject *get_handler(const char *handler_name)
return handler;
}
+static int get_argument_count(PyObject *handler)
+{
+ int arg_count = 0;
+
+ /*
+ * The attribute for the code object is func_code in Python 2,
+ * whereas it is __code__ in Python 3.0+.
+ */
+ PyObject *code_obj = PyObject_GetAttrString(handler,
+ "func_code");
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ code_obj = PyObject_GetAttrString(handler,
+ "__code__");
+ }
+ PyErr_Clear();
+ if (code_obj) {
+ PyObject *arg_count_obj = PyObject_GetAttrString(code_obj,
+ "co_argcount");
+ if (arg_count_obj) {
+ arg_count = (int) PyInt_AsLong(arg_count_obj);
+ Py_DECREF(arg_count_obj);
+ }
+ Py_DECREF(code_obj);
+ }
+ return arg_count;
+}
+
static void call_object(PyObject *handler, PyObject *args, const char *die_msg)
{
PyObject *retval;
@@ -499,7 +527,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
{
struct event_format *event = evsel->tp_format;
PyObject *handler, *context, *t, *obj = NULL, *callchain;
- PyObject *dict = NULL;
+ PyObject *dict = NULL, *all_entries_dict = NULL;
static char handler_name[256];
struct format_field *field;
unsigned long s, ns;
@@ -552,6 +580,8 @@ static void python_process_tracepoint(struct perf_sample *sample,
/* ip unwinding */
callchain = python_process_callchain(sample, evsel, al);
+ /* Need an additional reference for the perf_sample dict */
+ Py_INCREF(callchain);
if (!dict) {
PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
@@ -602,6 +632,14 @@ static void python_process_tracepoint(struct perf_sample *sample,
if (dict)
PyTuple_SetItem(t, n++, dict);
+ if (get_argument_count(handler) == (int) n + 1) {
+ all_entries_dict = get_perf_sample_dict(sample, evsel, al,
+ callchain);
+ PyTuple_SetItem(t, n++, all_entries_dict);
+ } else {
+ Py_DECREF(callchain);
+ }
+
if (_PyTuple_Resize(&t, n) == -1)
Py_FatalError("error resizing Python tuple");
@@ -612,6 +650,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
Py_DECREF(dict);
}
+ Py_XDECREF(all_entries_dict);
Py_DECREF(t);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 35/40] perf script python: Generate hooks with additional argument
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (33 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 34/40] perf script python: Add perf_sample dict to tracepoint handlers Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 36/40] perf report: Make --branch-history work without callgraphs(-g) option in perf record Arnaldo Carvalho de Melo
` (5 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arun Kalyanasundaram,
Alexander Shishkin, Daniel Borkmann, David Carrillo-Cisneros,
David S . Miller, Peter Zijlstra, Seongjae Park, Stephane Eranian,
Arnaldo Carvalho de Melo
From: Arun Kalyanasundaram <arunkaly@google.com>
Modify the signature of tracepoint specific and trace_unhandled hooks to
add the perf_sample dict as a new argument.
Create a python helper function to print a dictionary.
Signed-off-by: Arun Kalyanasundaram <arunkaly@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Seongjae Park <sj38.park@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20170721220422.63962-6-arunkaly@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../util/scripting-engines/trace-event-python.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 938b39f6ad31..c7187f067d31 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -1367,6 +1367,12 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
fprintf(ofp, "%s", f->name);
}
+ if (not_first++)
+ fprintf(ofp, ", ");
+ if (++count % 5 == 0)
+ fprintf(ofp, "\n\t\t");
+ fprintf(ofp, "perf_sample_dict");
+
fprintf(ofp, "):\n");
fprintf(ofp, "\t\tprint_header(event_name, common_cpu, "
@@ -1436,6 +1442,9 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
fprintf(ofp, ")\n\n");
+ fprintf(ofp, "\t\tprint 'Sample: {'+"
+ "get_dict_as_string(perf_sample_dict['sample'], ', ')+'}'\n\n");
+
fprintf(ofp, "\t\tfor node in common_callchain:");
fprintf(ofp, "\n\t\t\tif 'sym' in node:");
fprintf(ofp, "\n\t\t\t\tprint \"\\t[%%x] %%s\" %% (node['ip'], node['sym']['name'])");
@@ -1446,15 +1455,20 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
}
fprintf(ofp, "def trace_unhandled(event_name, context, "
- "event_fields_dict):\n");
+ "event_fields_dict, perf_sample_dict):\n");
- fprintf(ofp, "\t\tprint ' '.join(['%%s=%%s'%%(k,str(v))"
- "for k,v in sorted(event_fields_dict.items())])\n\n");
+ fprintf(ofp, "\t\tprint get_dict_as_string(event_fields_dict)\n");
+ fprintf(ofp, "\t\tprint 'Sample: {'+"
+ "get_dict_as_string(perf_sample_dict['sample'], ', ')+'}'\n\n");
fprintf(ofp, "def print_header("
"event_name, cpu, secs, nsecs, pid, comm):\n"
"\tprint \"%%-20s %%5u %%05u.%%09u %%8u %%-20s \" %% \\\n\t"
- "(event_name, cpu, secs, nsecs, pid, comm),\n");
+ "(event_name, cpu, secs, nsecs, pid, comm),\n\n");
+
+ fprintf(ofp, "def get_dict_as_string(a_dict, delimiter=' '):\n"
+ "\treturn delimiter.join"
+ "(['%%s=%%s'%%(k,str(v))for k,v in sorted(a_dict.items())])\n");
fclose(ofp);
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 36/40] perf report: Make --branch-history work without callgraphs(-g) option in perf record
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (34 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 35/40] perf script python: Generate hooks with additional argument Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 37/40] perf report: Tag branch type/flag on "to" and tag cycles on "from" Arnaldo Carvalho de Melo
` (4 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Jin Yao, Alexander Shishkin,
Jiri Olsa, Kan Liang, Peter Zijlstra, Arnaldo Carvalho de Melo
From: Jin Yao <yao.jin@linux.intel.com>
perf record -b -g <command>
perf report --branch-history
This merges the LBRs with the callgraphs.
However it would be nice if it also works without callgraphs (-g) set in
perf record, so that only the LBRs are displayed. But currently perf
report errors in this case. For example,
perf record -b <command>
perf report --branch-history
Error:
Selected -g or --branch-history but no callchain data. Did
you call 'perf record' without -g?
This patch displays the LBRs only even if callgraphs(-g) is not enabled
in perf record.
Change log:
v2: According to Milian Wolff's comment, change the obsolete error
message. Now the error message is:
┌─Error:─────────────────────────────────────┐
│Selected -g or --branch-history. │
│But no callchain or branch data. │
│Did you call 'perf record' without -g or -b?│
│ │
│ │
│Press any key... │
└────────────────────────────────────────────┘
When passing the last parameter to hists__fprintf,
changes "|" to "||".
hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
symbol_conf.use_callchain || symbol_conf.show_branchflag_count);
Signed-off-by: Yao Jin <yao.jin@linux.intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1494240182-28899-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 12 +++++++-----
tools/perf/util/callchain.c | 7 ++++---
tools/perf/util/hist.c | 2 ++
tools/perf/util/machine.c | 13 ++++++++++++-
4 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 983b238d5eea..bace3429c030 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -279,10 +279,11 @@ static int report__setup_sample_type(struct report *rep)
"'perf record' without -g?\n");
return -EINVAL;
}
- if (symbol_conf.use_callchain) {
- ui__error("Selected -g or --branch-history but no "
- "callchain data. Did\n"
- "you call 'perf record' without -g?\n");
+ if (symbol_conf.use_callchain &&
+ !symbol_conf.show_branchflag_count) {
+ ui__error("Selected -g or --branch-history.\n"
+ "But no callchain or branch data.\n"
+ "Did you call 'perf record' without -g or -b?\n");
return -1;
}
} else if (!callchain_param.enabled &&
@@ -417,7 +418,8 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
- symbol_conf.use_callchain);
+ symbol_conf.use_callchain ||
+ symbol_conf.show_branchflag_count);
fprintf(stdout, "\n\n");
}
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 02130e2e72c7..1f536418dfb5 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -1010,11 +1010,11 @@ int sample__resolve_callchain(struct perf_sample *sample,
struct perf_evsel *evsel, struct addr_location *al,
int max_stack)
{
- if (sample->callchain == NULL)
+ if (sample->callchain == NULL && !symbol_conf.show_branchflag_count)
return 0;
if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain ||
- perf_hpp_list.parent) {
+ perf_hpp_list.parent || symbol_conf.show_branchflag_count) {
return thread__resolve_callchain(al->thread, cursor, evsel, sample,
parent, al, max_stack);
}
@@ -1023,7 +1023,8 @@ int sample__resolve_callchain(struct perf_sample *sample,
int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample)
{
- if (!symbol_conf.use_callchain || sample->callchain == NULL)
+ if ((!symbol_conf.use_callchain || sample->callchain == NULL) &&
+ !symbol_conf.show_branchflag_count)
return 0;
return callchain_append(he->callchain, &callchain_cursor, sample->period);
}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 2f6c5e6c16f9..9453b2e27015 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1759,6 +1759,8 @@ void perf_evsel__output_resort(struct perf_evsel *evsel, struct ui_progress *pro
else
use_callchain = symbol_conf.use_callchain;
+ use_callchain |= symbol_conf.show_branchflag_count;
+
output_resort(evsel__hists(evsel), prog, use_callchain, NULL);
}
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 79d08ea694da..d4df353051af 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1902,13 +1902,16 @@ static int thread__resolve_callchain_sample(struct thread *thread,
{
struct branch_stack *branch = sample->branch_stack;
struct ip_callchain *chain = sample->callchain;
- int chain_nr = chain->nr;
+ int chain_nr = 0;
u8 cpumode = PERF_RECORD_MISC_USER;
int i, j, err, nr_entries;
int skip_idx = -1;
int first_call = 0;
int nr_loop_iter;
+ if (chain)
+ chain_nr = chain->nr;
+
if (perf_evsel__has_branch_callstack(evsel)) {
err = resolve_lbr_callchain_sample(thread, cursor, sample, parent,
root_al, max_stack);
@@ -1946,6 +1949,10 @@ static int thread__resolve_callchain_sample(struct thread *thread,
for (i = 0; i < nr; i++) {
if (callchain_param.order == ORDER_CALLEE) {
be[i] = branch->entries[i];
+
+ if (chain == NULL)
+ continue;
+
/*
* Check for overlap into the callchain.
* The return address is one off compared to
@@ -2000,6 +2007,10 @@ static int thread__resolve_callchain_sample(struct thread *thread,
if (err)
return err;
}
+
+ if (chain_nr == 0)
+ return 0;
+
chain_nr -= nr;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 37/40] perf report: Tag branch type/flag on "to" and tag cycles on "from"
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (35 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 36/40] perf report: Make --branch-history work without callgraphs(-g) option in perf record Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 38/40] perf jevents: Make build fail on JSON parse error Arnaldo Carvalho de Melo
` (3 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Jin Yao, Alexander Shishkin,
Jiri Olsa, Kan Liang, Peter Zijlstra, Arnaldo Carvalho de Melo
From: Jin Yao <yao.jin@linux.intel.com>
Current --branch-history LBR annotation displays confused data. For
example, each cycles report is duplicated on both "from" and "to"
entries.
For example:
perf report --branch-history --no-children --stdio
--2.32%--main div.c:39 (COND_BWD CROSS_2M predicted:49.7% cycles:1)
main div.c:44 (predicted:49.7% cycles:1)
main div.c:42 (RET CROSS_2M cycles:2)
compute_flag div.c:28 (cycles:2)
compute_flag div.c:27 (RET CROSS_2M cycles:1)
rand rand.c:28 (cycles:1)
rand rand.c:28 (RET CROSS_2M cycles:1)
__random random.c:298 (cycles:1)
__random random.c:297 (COND_BWD CROSS_2M cycles:1)
__random random.c:295 (cycles:1)
__random random.c:295 (COND_BWD CROSS_2M cycles:1)
__random random.c:295 (cycles:1)
__random random.c:295 (RET CROSS_2M cycles:9)
The cycles should be tagged only on the "from". It's for the code block
that ends with "from", not for "to".
Another issue is the "predicted:49.7%" is duplicated too (tag on both
"from" and "to").
This patch tags the branch type/flag on "to" and tag the cycles on
"from".
For example:
--2.32%--main div.c:39 (COND_BWD CROSS_2M predicted:49.7%)
main div.c:44 (cycles:1)
main div.c:42 (RET CROSS_2M)
compute_flag div.c:28 (cycles:2)
compute_flag div.c:27 (RET CROSS_2M)
rand rand.c:28 (cycles:1)
rand rand.c:28 (RET CROSS_2M)
__random random.c:298 (cycles:1)
__random random.c:297 (COND_BWD CROSS_2M)
__random random.c:295 (cycles:1)
__random random.c:295 (COND_BWD CROSS_2M)
__random random.c:295 (cycles:1)
__random random.c:295 (RET CROSS_2M)
|
--2.23%--__random_r random_r.c:392 (cycles:9)
In this example, The "main div.c:39 (COND_BWD CROSS_2M predicted:49.7%)"
is "to" of branch and "main div.c:44 (cycles:1)" is "from" of branch.
It should be easier for understanding than before.
Signed-off-by: Yao Jin <yao.jin@linux.intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1500894547-18411-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/branch.h | 11 ++--
tools/perf/util/callchain.c | 148 +++++++++++++++++++++++++++++++-------------
2 files changed, 111 insertions(+), 48 deletions(-)
diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h
index 686f2b65ba84..1e3c7c5cdc63 100644
--- a/tools/perf/util/branch.h
+++ b/tools/perf/util/branch.h
@@ -5,11 +5,12 @@
#include "../perf.h"
struct branch_type_stat {
- u64 counts[PERF_BR_MAX];
- u64 cond_fwd;
- u64 cond_bwd;
- u64 cross_4k;
- u64 cross_2m;
+ bool branch_to;
+ u64 counts[PERF_BR_MAX];
+ u64 cond_fwd;
+ u64 cond_bwd;
+ u64 cross_4k;
+ u64 cross_2m;
};
struct branch_flags;
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 1f536418dfb5..f320b0777e0d 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -563,20 +563,33 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor)
if (cursor_node->branch) {
call->branch_count = 1;
- if (cursor_node->branch_flags.predicted)
- call->predicted_count = 1;
-
- if (cursor_node->branch_flags.abort)
- call->abort_count = 1;
-
- call->cycles_count = cursor_node->branch_flags.cycles;
- call->iter_count = cursor_node->nr_loop_iter;
- call->samples_count = cursor_node->samples;
-
- branch_type_count(&call->brtype_stat,
- &cursor_node->branch_flags,
- cursor_node->branch_from,
- cursor_node->ip);
+ if (cursor_node->branch_from) {
+ /*
+ * branch_from is set with value somewhere else
+ * to imply it's "to" of a branch.
+ */
+ call->brtype_stat.branch_to = true;
+
+ if (cursor_node->branch_flags.predicted)
+ call->predicted_count = 1;
+
+ if (cursor_node->branch_flags.abort)
+ call->abort_count = 1;
+
+ branch_type_count(&call->brtype_stat,
+ &cursor_node->branch_flags,
+ cursor_node->branch_from,
+ cursor_node->ip);
+ } else {
+ /*
+ * It's "from" of a branch
+ */
+ call->brtype_stat.branch_to = false;
+ call->cycles_count =
+ cursor_node->branch_flags.cycles;
+ call->iter_count = cursor_node->nr_loop_iter;
+ call->samples_count = cursor_node->samples;
+ }
}
list_add_tail(&call->list, &node->val);
@@ -685,20 +698,32 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
if (node->branch) {
cnode->branch_count++;
- if (node->branch_flags.predicted)
- cnode->predicted_count++;
-
- if (node->branch_flags.abort)
- cnode->abort_count++;
-
- cnode->cycles_count += node->branch_flags.cycles;
- cnode->iter_count += node->nr_loop_iter;
- cnode->samples_count += node->samples;
-
- branch_type_count(&cnode->brtype_stat,
- &node->branch_flags,
- node->branch_from,
- node->ip);
+ if (node->branch_from) {
+ /*
+ * It's "to" of a branch
+ */
+ cnode->brtype_stat.branch_to = true;
+
+ if (node->branch_flags.predicted)
+ cnode->predicted_count++;
+
+ if (node->branch_flags.abort)
+ cnode->abort_count++;
+
+ branch_type_count(&cnode->brtype_stat,
+ &node->branch_flags,
+ node->branch_from,
+ node->ip);
+ } else {
+ /*
+ * It's "from" of a branch
+ */
+ cnode->brtype_stat.branch_to = false;
+ cnode->cycles_count +=
+ node->branch_flags.cycles;
+ cnode->iter_count += node->nr_loop_iter;
+ cnode->samples_count += node->samples;
+ }
}
return MATCH_EQ;
@@ -1236,27 +1261,26 @@ static int count_pri64_printf(int idx, const char *str, u64 value, char *bf, int
return printed;
}
-static int count_float_printf(int idx, const char *str, float value, char *bf, int bfsize)
+static int count_float_printf(int idx, const char *str, float value,
+ char *bf, int bfsize, float threshold)
{
int printed;
+ if (threshold != 0.0 && value < threshold)
+ return 0;
+
printed = scnprintf(bf, bfsize, "%s%s:%.1f%%", (idx) ? " " : " (", str, value);
return printed;
}
-static int counts_str_build(char *bf, int bfsize,
- u64 branch_count, u64 predicted_count,
- u64 abort_count, u64 cycles_count,
- u64 iter_count, u64 samples_count,
- struct branch_type_stat *brtype_stat)
+static int branch_to_str(char *bf, int bfsize,
+ u64 branch_count, u64 predicted_count,
+ u64 abort_count,
+ struct branch_type_stat *brtype_stat)
{
- u64 cycles;
int printed, i = 0;
- if (branch_count == 0)
- return scnprintf(bf, bfsize, " (calltrace)");
-
printed = branch_type_str(brtype_stat, bf, bfsize);
if (printed)
i++;
@@ -1264,15 +1288,29 @@ static int counts_str_build(char *bf, int bfsize,
if (predicted_count < branch_count) {
printed += count_float_printf(i++, "predicted",
predicted_count * 100.0 / branch_count,
- bf + printed, bfsize - printed);
+ bf + printed, bfsize - printed, 0.0);
}
if (abort_count) {
printed += count_float_printf(i++, "abort",
abort_count * 100.0 / branch_count,
- bf + printed, bfsize - printed);
+ bf + printed, bfsize - printed, 0.1);
}
+ if (i)
+ printed += scnprintf(bf + printed, bfsize - printed, ")");
+
+ return printed;
+}
+
+static int branch_from_str(char *bf, int bfsize,
+ u64 branch_count,
+ u64 cycles_count, u64 iter_count,
+ u64 samples_count)
+{
+ int printed = 0, i = 0;
+ u64 cycles;
+
cycles = cycles_count / branch_count;
if (cycles) {
printed += count_pri64_printf(i++, "cycles",
@@ -1287,10 +1325,34 @@ static int counts_str_build(char *bf, int bfsize,
}
if (i)
- return scnprintf(bf + printed, bfsize - printed, ")");
+ printed += scnprintf(bf + printed, bfsize - printed, ")");
- bf[0] = 0;
- return 0;
+ return printed;
+}
+
+static int counts_str_build(char *bf, int bfsize,
+ u64 branch_count, u64 predicted_count,
+ u64 abort_count, u64 cycles_count,
+ u64 iter_count, u64 samples_count,
+ struct branch_type_stat *brtype_stat)
+{
+ int printed;
+
+ if (branch_count == 0)
+ return scnprintf(bf, bfsize, " (calltrace)");
+
+ if (brtype_stat->branch_to) {
+ printed = branch_to_str(bf, bfsize, branch_count,
+ predicted_count, abort_count, brtype_stat);
+ } else {
+ printed = branch_from_str(bf, bfsize, branch_count,
+ cycles_count, iter_count, samples_count);
+ }
+
+ if (!printed)
+ bf[0] = 0;
+
+ return printed;
}
static int callchain_counts_printf(FILE *fp, char *bf, int bfsize,
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 38/40] perf jevents: Make build fail on JSON parse error
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (36 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 37/40] perf report: Tag branch type/flag on "to" and tag cycles on "from" Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 39/40] perf annotate stdio: Fix column header when using --show-total-period Arnaldo Carvalho de Melo
` (2 subsequent siblings)
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Andi Kleen, Sukadev Bhattiprolu,
Arnaldo Carvalho de Melo
From: Andi Kleen <ak@linux.intel.com>
Today, when a JSON file fails parsing the build continues, but there are
no json files built in, which is difficult to debug later. Make the
build stop on a parse error instead.
v2: Add fixes from Sukadev. Now we handle architectures
with no JSON events correctly. And fix some stale comments.
Committer note:
Tested by running the cross build container tests, that were all failing
for v1.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170725001638.19990-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/pmu-events/README | 4 ----
tools/perf/pmu-events/jevents.c | 21 ++++++++++++++-------
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/tools/perf/pmu-events/README b/tools/perf/pmu-events/README
index 1408ade0d773..c2ee3e4417fe 100644
--- a/tools/perf/pmu-events/README
+++ b/tools/perf/pmu-events/README
@@ -85,10 +85,6 @@ users to specify events by their name:
where 'pm_1plus_ppc_cmpl' is a Power8 PMU event.
-In case of errors when processing files in the tools/perf/pmu-events/arch
-directory, 'jevents' tries to create an empty mapping file to allow the perf
-build to succeed even if the PMU event aliases cannot be used.
-
However some errors in processing may cause the perf build to fail.
Mapfile format
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index bd0aabb2bd0f..2350f6099a46 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -822,10 +822,6 @@ static int process_one_file(const char *fpath, const struct stat *sb,
* PMU event tables (see struct pmu_events_map).
*
* Write out the PMU events tables and the mapping table to pmu-event.c.
- *
- * If unable to process the JSON or arch files, create an empty mapping
- * table so we can continue to build/use perf even if we cannot use the
- * PMU event aliases.
*/
int main(int argc, char *argv[])
{
@@ -836,6 +832,7 @@ int main(int argc, char *argv[])
const char *arch;
const char *output_file;
const char *start_dirname;
+ struct stat stbuf;
prog = basename(argv[0]);
if (argc < 4) {
@@ -857,11 +854,17 @@ int main(int argc, char *argv[])
return 2;
}
+ sprintf(ldirname, "%s/%s", start_dirname, arch);
+
+ /* If architecture does not have any event lists, bail out */
+ if (stat(ldirname, &stbuf) < 0) {
+ pr_info("%s: Arch %s has no PMU event lists\n", prog, arch);
+ goto empty_map;
+ }
+
/* Include pmu-events.h first */
fprintf(eventsfp, "#include \"../../pmu-events/pmu-events.h\"\n");
- sprintf(ldirname, "%s/%s", start_dirname, arch);
-
/*
* The mapfile allows multiple CPUids to point to the same JSON file,
* so, not sure if there is a need for symlinks within the pmu-events
@@ -878,6 +881,9 @@ int main(int argc, char *argv[])
if (rc && verbose) {
pr_info("%s: Error walking file tree %s\n", prog, ldirname);
goto empty_map;
+ } else if (rc < 0) {
+ /* Make build fail */
+ return 1;
} else if (rc) {
goto empty_map;
}
@@ -892,7 +898,8 @@ int main(int argc, char *argv[])
if (process_mapfile(eventsfp, mapfile)) {
pr_info("%s: Error processing mapfile %s\n", prog, mapfile);
- goto empty_map;
+ /* Make build fail */
+ return 1;
}
return 0;
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 39/40] perf annotate stdio: Fix column header when using --show-total-period
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (37 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 38/40] perf jevents: Make build fail on JSON parse error Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 40/40] perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST Arnaldo Carvalho de Melo
2017-07-26 17:10 ` [GIT PULL 00/40] perf/core improvements and fixes Ingo Molnar
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Taeung Song, Jiri Olsa,
Namhyung Kim, Arnaldo Carvalho de Melo
From: Taeung Song <treeze.taeung@gmail.com>
Currently the first column header is always "Percent", fix it to show
correct column name based on given options, i.e. if using
--show-total-period, show "Event count" as a first column.
Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/c3c902e7-95bc-16d4-366f-12eb034c5c8d@gmail.com
[ Extracted from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 004072f82511..c2b4b00166ed 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1824,7 +1824,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
width *= evsel->nr_members;
graph_dotted_len = printf(" %-*.*s| Source code & Disassembly of %s for %s (%" PRIu64 " samples)\n",
- width, width, "Percent", d_filename, evsel_name, h->nr_samples);
+ width, width, symbol_conf.show_total_period ? "Event count" : "Percent",
+ d_filename, evsel_name, h->nr_samples);
printf("%-*.*s----\n",
graph_dotted_len, graph_dotted_len, graph_dotted_line);
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 40/40] perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (38 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 39/40] perf annotate stdio: Fix column header when using --show-total-period Arnaldo Carvalho de Melo
@ 2017-07-26 14:17 ` Arnaldo Carvalho de Melo
2017-07-26 17:10 ` [GIT PULL 00/40] perf/core improvements and fixes Ingo Molnar
40 siblings, 0 replies; 42+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-26 14:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
This file was copied from the kernel so that we could build tools/perf/
on older systems where some newer defines, such as these are available:
CC trace/beauty/fcntl.o
trace/beauty/fcntl.c: In function ‘syscall_arg__scnprintf_fcntl_arg’:
trace/beauty/fcntl.c:93:13: error: ‘F_OFD_SETLK’ undeclared (first use in this function)
cmd == F_OFD_SETLK || cmd == F_OFD_SETLKW || cmd == F_OFD_GETLK ||
^
trace/beauty/fcntl.c:93:13: note: each undeclared identifier is reported only once for each function it appears in
trace/beauty/fcntl.c:93:35: error: ‘F_OFD_SETLKW’ undeclared (first use in this function)
cmd == F_OFD_SETLK || cmd == F_OFD_SETLKW || cmd == F_OFD_GETLK ||
^
trace/beauty/fcntl.c:93:58: error: ‘F_OFD_GETLK’ undeclared (first use in this function)
cmd == F_OFD_SETLK || cmd == F_OFD_SETLKW || cmd == F_OFD_GETLK ||
^
mv: cannot stat ‘trace/beauty/.fcntl.o.tmp’: No such file or directory
make[4]: *** [trace/beauty/fcntl.o] Error 1
make[3]: *** [trace/beauty] Error 2
make[3]: *** Waiting for unfinished jobs....
CC tests/llvm.o
But we need to make sure that it is also in the tools/perf/MANIFEST file, that
is used to build a tarball for detached (from the kernel sources) compilation,
which was failing, with the above message, on a RHEL7.4 system, fix it.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 84d1d8a12df3 ("tools include uapi asm-generic: Grab a copy of fcntl.h")
Link: http://lkml.kernel.org/n/tip-2d5px7aq5stbwi24pgirwtlm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/MANIFEST | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 9f2267b82eb2..705bdb147e73 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -70,6 +70,7 @@ tools/include/linux/hash.h
tools/include/linux/kernel.h
tools/include/linux/list.h
tools/include/linux/log2.h
+tools/include/uapi/asm-generic/fcntl.h
tools/include/uapi/asm-generic/mman-common.h
tools/include/uapi/asm-generic/mman.h
tools/include/uapi/linux/bpf.h
--
2.9.4
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [GIT PULL 00/40] perf/core improvements and fixes
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (39 preceding siblings ...)
2017-07-26 14:17 ` [PATCH 40/40] perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST Arnaldo Carvalho de Melo
@ 2017-07-26 17:10 ` Ingo Molnar
40 siblings, 0 replies; 42+ messages in thread
From: Ingo Molnar @ 2017-07-26 17:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, linux-perf-users, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Arun Kalyanasundaram, Brendan Gregg, Dan Carpenter,
Daniel Borkmann, David Ahern, David Carrillo-Cisneros,
David S . Miller, Elena Reshetova, Hendrik Brueckner, Jiri Olsa,
Josh Poimboeuf, Kan Liang, Kees Cook, Krister Johansen
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> Test results at the end of this message, as usual.
>
> The following changes since commit 510457ec9dc259b002879bcfe475f89d4514a0fc:
>
> Merge tag 'perf-core-for-mingo-4.13-20170718' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-07-20 10:31:52 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.14-20170725
>
> for you to fetch changes up to 62e6039f02888efdd824e8c596c4927616a97ce3:
>
> perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST (2017-07-25 22:46:37 -0300)
>
> ----------------------------------------------------------------
> perf/core improvemends and fixes for v4.14:
>
> New features:
>
> - Filter out 'sshd' in the tracer ancestry in 'perf trace' syswide tracing,
> to elliminate tracing loops (Arnaldo Carvalho de Melo)
>
> - Support lookup of symbols in other mount namespaces in 'perf top' (Krister Johansen)
>
> - Initial 'clone' syscall args beautifier in 'perf trace' (Arnaldo Carvalho de Melo)
>
> User visible:
>
> - Ignore 'fd' and 'offset' args for MAP_ANONYMOUS in 'perf trace'
> (Arnaldo Carvalho de Melo)
>
> - Process tracing data in 'perf annotate' pipe mode (David Carrillo-Cisneros)
>
> - Make 'perf report --branch-history' work without callgraphs(-g) option
> in perf record (Jin Yao)
>
> - Tag branch type/flag on "to" and tag cycles on "from" in 'perf report' (Jin Yao)
>
> Fixes:
>
> - Fix jvmti linker error when libelf config is disabled (Sudeep Holla)
>
> - Fix cgroups refcount usage (Arnaldo Carvalho de Melo)
>
> - Fix kernel symbol adjustment for s390x (Thomas Richter)
>
> - Fix 'perf report --stdio --show-total-period', it was showing the
> number of samples, not the total period (Taeung Song)
>
> Infrastructure:
>
> - Add perf_sample dictionary to tracepoint handlers in 'perf script'
> python, which were already present for other types of events
> (hardware, etc) (Arun Kalyanasundaram)
>
> - Make build fail on vendor events JSON parse error (Andi Kleen)
>
> - Adopt strstarts() from the kernel (Arnaldo Carvalho de Melo)
>
> Arch specific:
>
> - Set no_aux_samples for the tracking event in Intel PT (Kan Liang)
>
> - Always set no branch for Intel PT dummy event (Kan Liang)
>
> Trivial:
>
> - Simplify some error handlers in 'perf script' (Dan Carpenter)
>
> - Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile (David Carrillo-Cisneros)
>
> ----------------------------------------------------------------
> Andi Kleen (1):
> perf jevents: Make build fail on JSON parse error
>
> Arnaldo Carvalho de Melo (16):
> perf trace: Add missing ' = ' in the default formatting of syscall returns
> perf trace beauty mmap: Ignore 'fd' and 'offset' args for MAP_ANONYMOUS
> perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint
> perf trace: Use the syscall_fmt formatters without a tracepoint
> perf trace: Ditch __syscall__arg_val() variant, not needed anymore
> perf trace: Allow specifying number of syscall args for tracepointless syscalls
> perf trace: Allow specifying names to syscall arguments formatters
> tools include uapi: Grab a copy of linux/sched.h
> perf trace beauty clone: Beautify syscall arguments
> perf trace beauty clone: Suppress unused args according to 'flags' arg
> perf trace: Introduce filter_loop_pids()
> perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing
> tools include: Adopt strstarts() from the kernel
> tools lib: Update copy of strtobool from the kernel sources
> perf cgroup: Fix refcount usage
> perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST
>
> Arun Kalyanasundaram (5):
> perf script python: Allocate memory only if handler exists
> perf script python: Refactor creation of perf sample dict
> perf script python: Add sample_read to dict
> perf script python: Add perf_sample dict to tracepoint handlers
> perf script python: Generate hooks with additional argument
>
> Dan Carpenter (1):
> perf script: Remove some bogus error handling
>
> David Carrillo-Cisneros (2):
> perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile
> perf annotate: Process tracing data in pipe mode
>
> Jin Yao (2):
> perf report: Make --branch-history work without callgraphs(-g) option in perf record
> perf report: Tag branch type/flag on "to" and tag cycles on "from"
>
> Jiri Olsa (1):
> perf evsel: Add verbose output for sys_perf_event_open fallback
>
> Kan Liang (2):
> perf intel-pt: Set no_aux_samples for the tracking event
> perf intel-pt: Always set no branch for dummy event
>
> Krister Johansen (1):
> perf top: Support lookup of symbols in other mount namespaces.
>
> Sudeep Holla (1):
> perf jvmti: Fix linker error when libelf config is disabled
>
> Taeung Song (7):
> perf annotate: Introduce struct sym_hist_entry
> perf annotate: Rename 'sum' to 'nr_samples' in struct sym_hist
> perf hists: Pass perf_sample to __symbol__inc_addr_samples()
> perf annotate: Store the sample period in each histogram bucket
> perf annotate: Do not overwrite sample->period
> perf annotate stdio: Fix --show-total-period
> perf annotate stdio: Fix column header when using --show-total-period
>
> Thomas Richter (1):
> perf report: Fix kernel symbol adjustment for s390x
>
> tools/include/linux/string.h | 12 +-
> tools/include/uapi/linux/sched.h | 52 +++++
> tools/lib/string.c | 41 ++--
> tools/lib/subcmd/help.c | 2 +-
> tools/lib/subcmd/parse-options.c | 18 +-
> tools/perf/Documentation/perf-top.txt | 4 +
> tools/perf/MANIFEST | 2 +
> tools/perf/Makefile.perf | 10 +-
> tools/perf/arch/s390/util/Build | 1 +
> tools/perf/arch/s390/util/sym-handling.c | 22 ++
> tools/perf/arch/x86/util/intel-pt.c | 3 +
> tools/perf/builtin-annotate.c | 4 +-
> tools/perf/builtin-config.c | 3 +-
> tools/perf/builtin-ftrace.c | 2 +-
> tools/perf/builtin-help.c | 6 +-
> tools/perf/builtin-report.c | 27 ++-
> tools/perf/builtin-script.c | 7 +-
> tools/perf/builtin-top.c | 20 +-
> tools/perf/builtin-trace.c | 140 ++++++++----
> tools/perf/check-headers.sh | 1 +
> tools/perf/perf.c | 16 +-
> tools/perf/pmu-events/README | 4 -
> tools/perf/pmu-events/jevents.c | 21 +-
> tools/perf/trace/beauty/Build | 1 +
> tools/perf/trace/beauty/beauty.h | 3 +
> tools/perf/trace/beauty/clone.c | 75 +++++++
> tools/perf/trace/beauty/mmap.c | 3 +
> tools/perf/ui/browser.c | 3 +-
> tools/perf/ui/browsers/annotate.c | 9 +-
> tools/perf/ui/gtk/annotate.c | 4 +-
> tools/perf/ui/stdio/hist.c | 3 +-
> tools/perf/util/annotate.c | 99 +++++----
> tools/perf/util/annotate.h | 18 +-
> tools/perf/util/bpf-loader.c | 2 +-
> tools/perf/util/branch.h | 11 +-
> tools/perf/util/callchain.c | 157 +++++++++----
> tools/perf/util/cgroup.c | 8 +-
> tools/perf/util/config.c | 13 +-
> tools/perf/util/evsel.c | 8 +
> tools/perf/util/hist.c | 2 +
> tools/perf/util/llvm-utils.c | 2 +-
> tools/perf/util/machine.c | 13 +-
> .../util/scripting-engines/trace-event-python.c | 246 +++++++++++++++------
> 43 files changed, 798 insertions(+), 300 deletions(-)
> create mode 100644 tools/include/uapi/linux/sched.h
> create mode 100644 tools/perf/arch/s390/util/sym-handling.c
> create mode 100644 tools/perf/trace/beauty/clone.c
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2017-07-26 17:10 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-26 14:16 [GIT PULL 00/40] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 01/40] perf intel-pt: Set no_aux_samples for the tracking event Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 02/40] perf intel-pt: Always set no branch for dummy event Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 03/40] perf trace: Add missing ' = ' in the default formatting of syscall returns Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 04/40] perf trace beauty mmap: Ignore 'fd' and 'offset' args for MAP_ANONYMOUS Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 05/40] perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 06/40] perf trace: Use the syscall_fmt formatters without a tracepoint Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 07/40] perf trace: Ditch __syscall__arg_val() variant, not needed anymore Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 08/40] perf trace: Allow specifying number of syscall args for tracepointless syscalls Arnaldo Carvalho de Melo
2017-07-26 14:16 ` [PATCH 09/40] perf trace: Allow specifying names to syscall arguments formatters Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 10/40] tools include uapi: Grab a copy of linux/sched.h Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 11/40] perf trace beauty clone: Beautify syscall arguments Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 12/40] perf trace beauty clone: Suppress unused args according to 'flags' arg Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 13/40] perf trace: Introduce filter_loop_pids() Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 14/40] perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 15/40] tools include: Adopt strstarts() from the kernel Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 16/40] tools lib: Update copy of strtobool from the kernel sources Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 17/40] perf annotate: Introduce struct sym_hist_entry Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 18/40] perf annotate: Rename 'sum' to 'nr_samples' in struct sym_hist Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 19/40] perf hists: Pass perf_sample to __symbol__inc_addr_samples() Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 20/40] perf annotate: Store the sample period in each histogram bucket Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 21/40] perf annotate: Do not overwrite sample->period Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 22/40] perf annotate stdio: Fix --show-total-period Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 23/40] perf report: Fix kernel symbol adjustment for s390x Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 24/40] perf cgroup: Fix refcount usage Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 25/40] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 26/40] perf annotate: Process tracing data in pipe mode Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 27/40] perf jvmti: Fix linker error when libelf config is disabled Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 28/40] perf evsel: Add verbose output for sys_perf_event_open fallback Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 29/40] perf top: Support lookup of symbols in other mount namespaces Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 30/40] perf script: Remove some bogus error handling Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 31/40] perf script python: Allocate memory only if handler exists Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 32/40] perf script python: Refactor creation of perf sample dict Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 33/40] perf script python: Add sample_read to dict Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 34/40] perf script python: Add perf_sample dict to tracepoint handlers Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 35/40] perf script python: Generate hooks with additional argument Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 36/40] perf report: Make --branch-history work without callgraphs(-g) option in perf record Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 37/40] perf report: Tag branch type/flag on "to" and tag cycles on "from" Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 38/40] perf jevents: Make build fail on JSON parse error Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 39/40] perf annotate stdio: Fix column header when using --show-total-period Arnaldo Carvalho de Melo
2017-07-26 14:17 ` [PATCH 40/40] perf tools: Add tools/include/uapi/asm-generic/fcntl.h to the MANIFEST Arnaldo Carvalho de Melo
2017-07-26 17:10 ` [GIT PULL 00/40] perf/core improvements and fixes Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).