* [GIT PULL 00/30] perf/core improvements and fixes
@ 2012-09-24 15:59 Arnaldo Carvalho de Melo
0 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-09-24 15:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Arjan van de Ven,
Avi Kivity, David Ahern, Dong Hao, Eric Sandeen, Feng Tang,
Frederic Weisbecker, Irina Tirdea, Jiri Olsa, kvm,
Marcelo Tosatti, Markus Trippelsdorf, Masami Hiramatsu,
Mike Frysinger, Mike Galbraith, Namhyung Kim, Paul Mackerras,
Peter Zijlstra, Robert Richter, Runzhen Wang, Stephane Eranian,
Steven Rostedt, Xiao Guangrong, Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 1e6dd8adc78d4a153db253d051fd4ef6c49c9019:
perf: Fix off by one test in perf_reg_value() (2012-09-19 17:08:40 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
for you to fetch changes up to b1ac754b67b5a875d63bee880f60ccb0c6bd8899:
tools lib traceevent: Handle alloc_arg failure (2012-09-24 12:31:52 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
. Convert the trace builtins to use the growing evsel/evlist
tracepoint infrastructure, removing several open coded constructs
like switch like series of strcmp to dispatch events, etc.
Basically what had already been showcased in 'perf sched'.
. Add evsel constructor for tracepoints, that uses libtraceevent
just to parse the /format events file, use it in a new 'perf test'
to make sure the libtraceevent format parsing regressions can
be more readily caught.
. Some strange errors were happening in some builds, but not on the
next, reported by several people, problem was some parser related
files, generated during the build, didn't had proper make deps,
fix from Eric Sandeen.
. Fix some compiling errors on 32-bit, from Feng Tang.
. Don't use sscanf extension %as, not available on bionic, reimplementation
by Irina Tirdea.
. Fix bfd.h/libbfd detection with recent binutils, from Markus Trippelsdorf.
. Introduce struct and cache information about the environment where a
perf.data file was captured, from Namhyung Kim.
. Fix several error paths in libtraceevent, from Namhyung Kim.
Print event causing perf_event_open() to fail in 'perf record',
from Stephane Eranian.
. New 'kvm' analysis tool, from Xiao Guangrong.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Arnaldo Carvalho de Melo (11):
perf kvm: Use perf_evsel__intval
perf kmem: Use perf_evsel__intval and perf_session__set_tracepoints_handlers
perf lock: Use perf_evsel__intval and perf_session__set_tracepoints_handlers
perf timechart: Use zalloc and fix a couple leaks
tools lib traceevent: Use asprintf were applicable
tools lib traceevent: Use calloc were applicable
tools lib traceevent: Fix afterlife gotos
tools lib traceevent: Remove some die() calls
tools lib traceevent: Carve out events format parsing routine
perf evsel: Provide a new constructor for tracepoints
perf test: Add test for the sched tracepoint format fields
Eric Sandeen (1):
perf tools: Fix parallel build
Feng Tang (2):
perf tools: Fix a compiling error in trace-event-perl.c for 32 bits machine
perf tools: Fix a compiling error in util/map.c
Irina Tirdea (1):
perf tools: remove sscanf extension %as
Markus Trippelsdorf (1):
perf tools: bfd.h/libbfd detection fails with recent binutils
Namhyung Kim (11):
perf header: Add struct perf_session_env
perf header: Add ->process callbacks to most of features
perf header: Use pre-processed session env when printing
perf header: Remove unused @feat arg from ->process callback
perf kvm: Use perf_session_env for reading cpuid
perf header: Remove perf_header__read_feature
tools lib traceevent: Fix error path on process_array()
tools lib traceevent: Make sure that arg->op.right is set properly
tools lib traceevent: Free field if an error occurs on process_fields
tools lib traceevent: Free field if an error occurs on process_flags/symbols
tools lib traceevent: Handle alloc_arg failure
Stephane Eranian (1):
perf record: Print event causing perf_event_open() to fail
Xiao Guangrong (2):
KVM: x86: Export svm/vmx exit code and vector code to userspace
perf kvm: Events analysis tool
arch/x86/include/asm/kvm.h | 16 +
arch/x86/include/asm/kvm_host.h | 16 -
arch/x86/include/asm/svm.h | 205 +++--
arch/x86/include/asm/vmx.h | 127 ++-
arch/x86/kvm/trace.h | 89 ---
tools/lib/traceevent/event-parse.c | 570 +++++++++----
tools/lib/traceevent/event-parse.h | 3 +
tools/perf/Documentation/perf-kvm.txt | 30 +-
tools/perf/MANIFEST | 3 +
tools/perf/Makefile | 6 +-
tools/perf/builtin-kmem.c | 90 +--
tools/perf/builtin-kvm.c | 836 +++++++++++++++++++-
tools/perf/builtin-lock.c | 233 ++----
tools/perf/builtin-record.c | 6 +-
tools/perf/builtin-test.c | 86 ++
tools/perf/builtin-timechart.c | 40 +-
tools/perf/util/evsel.c | 88 ++-
tools/perf/util/evsel.h | 5 +
tools/perf/util/header.c | 547 +++++++++----
tools/perf/util/header.h | 24 +
tools/perf/util/map.c | 5 +-
tools/perf/util/probe-event.c | 36 +-
.../perf/util/scripting-engines/trace-event-perl.c | 2 +-
tools/perf/util/symbol.h | 1 +
tools/perf/util/thread.h | 2 +
tools/perf/util/trace-event-parse.c | 18 +-
26 files changed, 2278 insertions(+), 806 deletions(-)
^ permalink raw reply [flat|nested] 44+ messages in thread
* [GIT PULL 00/30] perf/core improvements and fixes
@ 2015-05-08 20:56 Arnaldo Carvalho de Melo
2015-05-09 6:22 ` Ingo Molnar
2015-05-11 5:09 ` Namhyung Kim
0 siblings, 2 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-08 20:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Namhyung Kim,
Naveen N . Rao, Peter Zijlstra, Ralf Baechle, Stephane Eranian,
Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit cb307113746b4d184155d2c412e8069aeaa60d42:
perf_event: Don't allow vmalloc() backed perf on powerpc (2015-05-08 12:26:01 +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
for you to fetch changes up to 76d408498b08447e0f61dfdd611aeb6e8e61ce80:
perf build: Disable libdw DWARF unwind when built with NO_DWARF (2015-05-08 16:43:14 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- 'perf probe' improvements (Masami Hiramatsu)
- Support glob wildcards for function name
- Support $params special probe argument: Collect all function arguments
- Make --line checks validate C-style function name.
- Add --no-inlines option to avoid searching inline functions
- Introduce new 'perf bench futex' benchmark: 'wake-parallel', to
measure parallel waker threads generating contention for kerne
locks (hb->lock) (Davidlohr Bueso)
Bug fixes:
- 'perf top' survives much longer on high core count machines, more work
needed to refcount more data structures besides 'struct thread' and fix
more races (Arnaldo Carvalho de Melo)
Infrastructure:
- Move barrier.h mb/rmb/wmb API from tools/perf/ to kernel like tools/arch/
hierarchy (Arnaldo Carvalho de Melo)
- Borrow atomic.h from the kernel, initially the x86 implementations
with a fallback to gcc intrinsics for the other arches, all the kernel
like framework in place for doing arch specific implementations,
preferrably cloning what is in the kernel to the greater extent
possible (Arnaldo Carvalho de Melo)
- Protect the 'struct thread' lifetime with a reference counter,
and protect data structures that contains its instances with
a mutex (Arnaldo Carvalho de Melo
- Disable libdw DWARF unwind when built with NO_DWARF (Naveen N. Rao)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Arnaldo Carvalho de Melo (17):
perf tools: Move x86 barrier.h stuff to tools/arch/x86/include/asm/barrier.h
perf tools: Move powerpc barrier.h stuff to tools/arch/powerpc/include/asm/barrier.h
perf tools: Move s390 barrier.h stuff to tools/arch/s390/include/asm/barrier.h
perf tools: Move barrier() definition to tools/include/linux/compiler.h
tools: Adopt asm-generic/barrier.h
perf tools: Move sh barrier.h stuff to tools/arch/sh/include/asm/barrier.h
perf tools: Move sparc barrier.h stuff to tools/arch/sparc/include/asm/barrier.h
perf tools: Move alpha barrier.h stuff to tools/arch/alpha/include/asm/barrier.h
perf tools: Move ia64 barrier.h stuff to tools/arch/ia64/include/asm/barrier.h
perf tools: Move arm(64) barrier.h stuff to tools/arch/arm*/include/asm/barrier.h
perf tools: Move xtensa barrier.h stuff to tools/arch/xtensa/include/asm/barrier.h
perf tools: Move mips barrier.h stuff to tools/arch/mips/include/asm/barrier.h
perf tools: Move tile barrier.h stuff to tools/arch/tile/include/asm/barrier.h
perf tools: Move generic barriers out of perf-sys.h
tools include: Add basic atomic.h implementation from the kernel sources
perf tools: Use atomic_t to implement thread__{get,put} refcnt
perf machine: Protect the machine->threads with a rwlock
Davidlohr Bueso (2):
perf bench futex: Support parallel waker threads
perf bench futex: Handle spurious wakeups
Masami Hiramatsu (10):
perf probe: Fix to close probe_events file in error
perf probe: Fix a typo for the flags of open
perf probe: Fix to return 0 when positive value returned
perf probe: Make --line checks validate C-style function name
perf probe: Skip kernel symbols which is out of .text
perf probe: Support $params special probe argument
perf probe: Use perf_probe_event.target instead of passing as an argument
perf probe: Introduce probe_conf global configs
perf probe: Add --no-inlines option to avoid searching inline functions
perf probe: Support glob wildcards for function name
Naveen N. Rao (1):
perf build: Disable libdw DWARF unwind when built with NO_DWARF
tools/arch/alpha/include/asm/barrier.h | 8 +
tools/arch/arm/include/asm/barrier.h | 12 ++
tools/arch/arm64/include/asm/barrier.h | 16 ++
tools/arch/ia64/include/asm/barrier.h | 48 +++++
tools/arch/mips/include/asm/barrier.h | 20 ++
tools/arch/powerpc/include/asm/barrier.h | 29 +++
tools/arch/s390/include/asm/barrier.h | 30 +++
tools/arch/sh/include/asm/barrier.h | 32 ++++
tools/arch/sparc/include/asm/barrier.h | 8 +
tools/arch/sparc/include/asm/barrier_32.h | 6 +
tools/arch/sparc/include/asm/barrier_64.h | 42 +++++
tools/arch/tile/include/asm/barrier.h | 15 ++
tools/arch/x86/include/asm/atomic.h | 65 +++++++
tools/arch/x86/include/asm/barrier.h | 28 +++
tools/arch/x86/include/asm/rmwcc.h | 41 +++++
tools/arch/xtensa/include/asm/barrier.h | 18 ++
tools/include/asm-generic/atomic-gcc.h | 63 +++++++
tools/include/asm-generic/barrier.h | 44 +++++
tools/include/asm/atomic.h | 10 +
tools/include/asm/barrier.h | 27 +++
tools/include/linux/atomic.h | 6 +
tools/include/linux/compiler.h | 4 +
tools/include/linux/types.h | 4 +
tools/perf/Documentation/perf-bench.txt | 3 +
tools/perf/Documentation/perf-probe.txt | 6 +-
tools/perf/MANIFEST | 19 ++
tools/perf/bench/Build | 1 +
tools/perf/bench/bench.h | 2 +
tools/perf/bench/futex-wake-parallel.c | 294 ++++++++++++++++++++++++++++++
tools/perf/bench/futex-wake.c | 7 +-
tools/perf/builtin-annotate.c | 10 +-
tools/perf/builtin-bench.c | 1 +
tools/perf/builtin-diff.c | 9 +-
tools/perf/builtin-inject.c | 1 +
tools/perf/builtin-kmem.c | 7 +-
tools/perf/builtin-kvm.c | 6 +-
tools/perf/builtin-lock.c | 8 +-
tools/perf/builtin-mem.c | 5 +-
tools/perf/builtin-probe.c | 26 +--
tools/perf/builtin-report.c | 9 +-
tools/perf/builtin-sched.c | 82 ++++++---
tools/perf/builtin-script.c | 20 +-
tools/perf/builtin-timechart.c | 5 +-
tools/perf/builtin-top.c | 2 +-
tools/perf/builtin-trace.c | 36 ++--
tools/perf/config/Makefile | 4 +
tools/perf/perf-sys.h | 73 +-------
tools/perf/tests/code-reading.c | 22 ++-
tools/perf/tests/dwarf-unwind.c | 1 +
tools/perf/tests/hists_common.c | 1 +
tools/perf/tests/hists_cumulate.c | 4 +-
tools/perf/tests/hists_filter.c | 4 +-
tools/perf/tests/hists_link.c | 8 +-
tools/perf/tests/hists_output.c | 4 +-
tools/perf/tests/mmap-thread-lookup.c | 2 +
tools/perf/tests/thread-mg-share.c | 12 +-
tools/perf/util/build-id.c | 5 +-
tools/perf/util/db-export.c | 14 +-
tools/perf/util/dwarf-aux.c | 16 ++
tools/perf/util/dwarf-aux.h | 3 +
tools/perf/util/event.c | 15 ++
tools/perf/util/event.h | 2 +
tools/perf/util/machine.c | 89 +++++++--
tools/perf/util/machine.h | 5 +-
tools/perf/util/probe-event.c | 177 ++++++++++--------
tools/perf/util/probe-event.h | 15 +-
tools/perf/util/probe-finder.c | 73 +++++---
tools/perf/util/probe-finder.h | 10 +-
tools/perf/util/thread.c | 14 +-
tools/perf/util/thread.h | 3 +-
tools/perf/util/util.h | 4 +
71 files changed, 1392 insertions(+), 323 deletions(-)
create mode 100644 tools/arch/alpha/include/asm/barrier.h
create mode 100644 tools/arch/arm/include/asm/barrier.h
create mode 100644 tools/arch/arm64/include/asm/barrier.h
create mode 100644 tools/arch/ia64/include/asm/barrier.h
create mode 100644 tools/arch/mips/include/asm/barrier.h
create mode 100644 tools/arch/powerpc/include/asm/barrier.h
create mode 100644 tools/arch/s390/include/asm/barrier.h
create mode 100644 tools/arch/sh/include/asm/barrier.h
create mode 100644 tools/arch/sparc/include/asm/barrier.h
create mode 100644 tools/arch/sparc/include/asm/barrier_32.h
create mode 100644 tools/arch/sparc/include/asm/barrier_64.h
create mode 100644 tools/arch/tile/include/asm/barrier.h
create mode 100644 tools/arch/x86/include/asm/atomic.h
create mode 100644 tools/arch/x86/include/asm/barrier.h
create mode 100644 tools/arch/x86/include/asm/rmwcc.h
create mode 100644 tools/arch/xtensa/include/asm/barrier.h
create mode 100644 tools/include/asm-generic/atomic-gcc.h
create mode 100644 tools/include/asm-generic/barrier.h
create mode 100644 tools/include/asm/atomic.h
create mode 100644 tools/include/asm/barrier.h
create mode 100644 tools/include/linux/atomic.h
create mode 100644 tools/perf/bench/futex-wake-parallel.c
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-08 20:56 Arnaldo Carvalho de Melo
@ 2015-05-09 6:22 ` Ingo Molnar
2015-05-11 5:09 ` Namhyung Kim
1 sibling, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2015-05-09 6:22 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, Ananth N Mavinakayanahalli,
Borislav Petkov, David Ahern, Davidlohr Bueso, Deng-Cheng Zhu,
Don Zickus, Frederic Weisbecker, Hemant Kumar, Jiri Olsa,
Masami Hiramatsu, Namhyung Kim, Naveen N . Rao, Peter Zijlstra,
Ralf Baechle, Stephane Eranian, Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
>
>
> The following changes since commit cb307113746b4d184155d2c412e8069aeaa60d42:
>
> perf_event: Don't allow vmalloc() backed perf on powerpc (2015-05-08 12:26:01 +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
>
> for you to fetch changes up to 76d408498b08447e0f61dfdd611aeb6e8e61ce80:
>
> perf build: Disable libdw DWARF unwind when built with NO_DWARF (2015-05-08 16:43:14 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> - 'perf probe' improvements (Masami Hiramatsu)
>
> - Support glob wildcards for function name
> - Support $params special probe argument: Collect all function arguments
> - Make --line checks validate C-style function name.
> - Add --no-inlines option to avoid searching inline functions
>
> - Introduce new 'perf bench futex' benchmark: 'wake-parallel', to
> measure parallel waker threads generating contention for kerne
> locks (hb->lock) (Davidlohr Bueso)
>
> Bug fixes:
>
> - 'perf top' survives much longer on high core count machines, more work
> needed to refcount more data structures besides 'struct thread' and fix
> more races (Arnaldo Carvalho de Melo)
>
> Infrastructure:
>
> - Move barrier.h mb/rmb/wmb API from tools/perf/ to kernel like tools/arch/
> hierarchy (Arnaldo Carvalho de Melo)
>
> - Borrow atomic.h from the kernel, initially the x86 implementations
> with a fallback to gcc intrinsics for the other arches, all the kernel
> like framework in place for doing arch specific implementations,
> preferrably cloning what is in the kernel to the greater extent
> possible (Arnaldo Carvalho de Melo)
>
> - Protect the 'struct thread' lifetime with a reference counter,
> and protect data structures that contains its instances with
> a mutex (Arnaldo Carvalho de Melo
>
> - Disable libdw DWARF unwind when built with NO_DWARF (Naveen N. Rao)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (17):
> perf tools: Move x86 barrier.h stuff to tools/arch/x86/include/asm/barrier.h
> perf tools: Move powerpc barrier.h stuff to tools/arch/powerpc/include/asm/barrier.h
> perf tools: Move s390 barrier.h stuff to tools/arch/s390/include/asm/barrier.h
> perf tools: Move barrier() definition to tools/include/linux/compiler.h
> tools: Adopt asm-generic/barrier.h
> perf tools: Move sh barrier.h stuff to tools/arch/sh/include/asm/barrier.h
> perf tools: Move sparc barrier.h stuff to tools/arch/sparc/include/asm/barrier.h
> perf tools: Move alpha barrier.h stuff to tools/arch/alpha/include/asm/barrier.h
> perf tools: Move ia64 barrier.h stuff to tools/arch/ia64/include/asm/barrier.h
> perf tools: Move arm(64) barrier.h stuff to tools/arch/arm*/include/asm/barrier.h
> perf tools: Move xtensa barrier.h stuff to tools/arch/xtensa/include/asm/barrier.h
> perf tools: Move mips barrier.h stuff to tools/arch/mips/include/asm/barrier.h
> perf tools: Move tile barrier.h stuff to tools/arch/tile/include/asm/barrier.h
> perf tools: Move generic barriers out of perf-sys.h
> tools include: Add basic atomic.h implementation from the kernel sources
> perf tools: Use atomic_t to implement thread__{get,put} refcnt
> perf machine: Protect the machine->threads with a rwlock
>
> Davidlohr Bueso (2):
> perf bench futex: Support parallel waker threads
> perf bench futex: Handle spurious wakeups
>
> Masami Hiramatsu (10):
> perf probe: Fix to close probe_events file in error
> perf probe: Fix a typo for the flags of open
> perf probe: Fix to return 0 when positive value returned
> perf probe: Make --line checks validate C-style function name
> perf probe: Skip kernel symbols which is out of .text
> perf probe: Support $params special probe argument
> perf probe: Use perf_probe_event.target instead of passing as an argument
> perf probe: Introduce probe_conf global configs
> perf probe: Add --no-inlines option to avoid searching inline functions
> perf probe: Support glob wildcards for function name
>
> Naveen N. Rao (1):
> perf build: Disable libdw DWARF unwind when built with NO_DWARF
>
> tools/arch/alpha/include/asm/barrier.h | 8 +
> tools/arch/arm/include/asm/barrier.h | 12 ++
> tools/arch/arm64/include/asm/barrier.h | 16 ++
> tools/arch/ia64/include/asm/barrier.h | 48 +++++
> tools/arch/mips/include/asm/barrier.h | 20 ++
> tools/arch/powerpc/include/asm/barrier.h | 29 +++
> tools/arch/s390/include/asm/barrier.h | 30 +++
> tools/arch/sh/include/asm/barrier.h | 32 ++++
> tools/arch/sparc/include/asm/barrier.h | 8 +
> tools/arch/sparc/include/asm/barrier_32.h | 6 +
> tools/arch/sparc/include/asm/barrier_64.h | 42 +++++
> tools/arch/tile/include/asm/barrier.h | 15 ++
> tools/arch/x86/include/asm/atomic.h | 65 +++++++
> tools/arch/x86/include/asm/barrier.h | 28 +++
> tools/arch/x86/include/asm/rmwcc.h | 41 +++++
> tools/arch/xtensa/include/asm/barrier.h | 18 ++
> tools/include/asm-generic/atomic-gcc.h | 63 +++++++
> tools/include/asm-generic/barrier.h | 44 +++++
> tools/include/asm/atomic.h | 10 +
> tools/include/asm/barrier.h | 27 +++
> tools/include/linux/atomic.h | 6 +
> tools/include/linux/compiler.h | 4 +
> tools/include/linux/types.h | 4 +
> tools/perf/Documentation/perf-bench.txt | 3 +
> tools/perf/Documentation/perf-probe.txt | 6 +-
> tools/perf/MANIFEST | 19 ++
> tools/perf/bench/Build | 1 +
> tools/perf/bench/bench.h | 2 +
> tools/perf/bench/futex-wake-parallel.c | 294 ++++++++++++++++++++++++++++++
> tools/perf/bench/futex-wake.c | 7 +-
> tools/perf/builtin-annotate.c | 10 +-
> tools/perf/builtin-bench.c | 1 +
> tools/perf/builtin-diff.c | 9 +-
> tools/perf/builtin-inject.c | 1 +
> tools/perf/builtin-kmem.c | 7 +-
> tools/perf/builtin-kvm.c | 6 +-
> tools/perf/builtin-lock.c | 8 +-
> tools/perf/builtin-mem.c | 5 +-
> tools/perf/builtin-probe.c | 26 +--
> tools/perf/builtin-report.c | 9 +-
> tools/perf/builtin-sched.c | 82 ++++++---
> tools/perf/builtin-script.c | 20 +-
> tools/perf/builtin-timechart.c | 5 +-
> tools/perf/builtin-top.c | 2 +-
> tools/perf/builtin-trace.c | 36 ++--
> tools/perf/config/Makefile | 4 +
> tools/perf/perf-sys.h | 73 +-------
> tools/perf/tests/code-reading.c | 22 ++-
> tools/perf/tests/dwarf-unwind.c | 1 +
> tools/perf/tests/hists_common.c | 1 +
> tools/perf/tests/hists_cumulate.c | 4 +-
> tools/perf/tests/hists_filter.c | 4 +-
> tools/perf/tests/hists_link.c | 8 +-
> tools/perf/tests/hists_output.c | 4 +-
> tools/perf/tests/mmap-thread-lookup.c | 2 +
> tools/perf/tests/thread-mg-share.c | 12 +-
> tools/perf/util/build-id.c | 5 +-
> tools/perf/util/db-export.c | 14 +-
> tools/perf/util/dwarf-aux.c | 16 ++
> tools/perf/util/dwarf-aux.h | 3 +
> tools/perf/util/event.c | 15 ++
> tools/perf/util/event.h | 2 +
> tools/perf/util/machine.c | 89 +++++++--
> tools/perf/util/machine.h | 5 +-
> tools/perf/util/probe-event.c | 177 ++++++++++--------
> tools/perf/util/probe-event.h | 15 +-
> tools/perf/util/probe-finder.c | 73 +++++---
> tools/perf/util/probe-finder.h | 10 +-
> tools/perf/util/thread.c | 14 +-
> tools/perf/util/thread.h | 3 +-
> tools/perf/util/util.h | 4 +
> 71 files changed, 1392 insertions(+), 323 deletions(-)
> create mode 100644 tools/arch/alpha/include/asm/barrier.h
> create mode 100644 tools/arch/arm/include/asm/barrier.h
> create mode 100644 tools/arch/arm64/include/asm/barrier.h
> create mode 100644 tools/arch/ia64/include/asm/barrier.h
> create mode 100644 tools/arch/mips/include/asm/barrier.h
> create mode 100644 tools/arch/powerpc/include/asm/barrier.h
> create mode 100644 tools/arch/s390/include/asm/barrier.h
> create mode 100644 tools/arch/sh/include/asm/barrier.h
> create mode 100644 tools/arch/sparc/include/asm/barrier.h
> create mode 100644 tools/arch/sparc/include/asm/barrier_32.h
> create mode 100644 tools/arch/sparc/include/asm/barrier_64.h
> create mode 100644 tools/arch/tile/include/asm/barrier.h
> create mode 100644 tools/arch/x86/include/asm/atomic.h
> create mode 100644 tools/arch/x86/include/asm/barrier.h
> create mode 100644 tools/arch/x86/include/asm/rmwcc.h
> create mode 100644 tools/arch/xtensa/include/asm/barrier.h
> create mode 100644 tools/include/asm-generic/atomic-gcc.h
> create mode 100644 tools/include/asm-generic/barrier.h
> create mode 100644 tools/include/asm/atomic.h
> create mode 100644 tools/include/asm/barrier.h
> create mode 100644 tools/include/linux/atomic.h
> create mode 100644 tools/perf/bench/futex-wake-parallel.c
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-08 20:56 Arnaldo Carvalho de Melo
2015-05-09 6:22 ` Ingo Molnar
@ 2015-05-11 5:09 ` Namhyung Kim
2015-05-11 14:06 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 44+ messages in thread
From: Namhyung Kim @ 2015-05-11 5:09 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, linux-kernel, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Naveen N . Rao,
Peter Zijlstra, Ralf Baechle, Stephane Eranian,
Arnaldo Carvalho de Melo
Hi Arnaldo,
On Fri, May 08, 2015 at 05:56:12PM -0300, Arnaldo Carvalho de Melo wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
>
>
> The following changes since commit cb307113746b4d184155d2c412e8069aeaa60d42:
>
> perf_event: Don't allow vmalloc() backed perf on powerpc (2015-05-08 12:26:01 +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
>
> for you to fetch changes up to 76d408498b08447e0f61dfdd611aeb6e8e61ce80:
>
> perf build: Disable libdw DWARF unwind when built with NO_DWARF (2015-05-08 16:43:14 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> - 'perf probe' improvements (Masami Hiramatsu)
>
> - Support glob wildcards for function name
> - Support $params special probe argument: Collect all function arguments
> - Make --line checks validate C-style function name.
> - Add --no-inlines option to avoid searching inline functions
>
> - Introduce new 'perf bench futex' benchmark: 'wake-parallel', to
> measure parallel waker threads generating contention for kerne
> locks (hb->lock) (Davidlohr Bueso)
>
> Bug fixes:
>
> - 'perf top' survives much longer on high core count machines, more work
> needed to refcount more data structures besides 'struct thread' and fix
> more races (Arnaldo Carvalho de Melo)
I'm seeing a segfault on 'perf report' with a large data file after
applying thread refcount change - it happens regardless of the atomic
operation.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-11 5:09 ` Namhyung Kim
@ 2015-05-11 14:06 ` Arnaldo Carvalho de Melo
2015-05-14 8:23 ` Namhyung Kim
0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-11 14:06 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, linux-kernel, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Naveen N . Rao,
Peter Zijlstra, Ralf Baechle, Stephane Eranian
Em Mon, May 11, 2015 at 02:09:39PM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
>
> I'm seeing a segfault on 'perf report' with a large data file after
> applying thread refcount change - it happens regardless of the atomic
> operation.
Any specific 'perf record' command line? Does it take a long time to
reproduce? Any backtraces? I'll try to repro, its possible that we're
doing one too many thread__put()...
- Arnaldo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-11 14:06 ` Arnaldo Carvalho de Melo
@ 2015-05-14 8:23 ` Namhyung Kim
2015-05-14 13:18 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 44+ messages in thread
From: Namhyung Kim @ 2015-05-14 8:23 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, linux-kernel, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Naveen N . Rao,
Peter Zijlstra, Ralf Baechle, Stephane Eranian
On Mon, May 11, 2015 at 11:06:26AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 11, 2015 at 02:09:39PM +0900, Namhyung Kim escreveu:
> > Hi Arnaldo,
> >
> > I'm seeing a segfault on 'perf report' with a large data file after
> > applying thread refcount change - it happens regardless of the atomic
> > operation.
>
> Any specific 'perf record' command line? Does it take a long time to
> reproduce? Any backtraces? I'll try to repro, its possible that we're
> doing one too many thread__put()...
It's a kernel build with '-j 20' and recorded data size is ~2.1GB.
It takes ~30 sec to reproduce.
$ perf report -i threaded/kbuild7.data --header-only
# ========
# captured on: Thu Dec 18 12:06:35 2014
# hostname : sejong
# os release : 3.17.4-1-ARCH
# perf version : 3.18.rc3.gcb4774b
# arch : x86_64
# nrcpus online : 12
# nrcpus avail : 12
# cpudesc : Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
# cpuid : GenuineIntel,6,45,7
# total memory : 24646828 kB
# cmdline : /home/namhyung/project/linux/tools/perf/perf record -ag -o /home/namhyung/tmp/perf/threaded/kbuild7.data -- make -j20
# event : name = cycles, , size = 104, { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled = 1, inherit
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# pmu mappings: cpu = 4, software = 1, power = 24, uncore_pcu = 13, tracepoint = 2, uncore_imc_0 = 15, uncore_imc_1 = 16, uncore_imc_2 = 17, uncore_
# ========
#
$ perf data stat -i threaded/kbuild7.data
Total event stats for 'threaded/kbuild7.data' file:
TOTAL events: 25126492
MMAP events: 114
COMM events: 117957
EXIT events: 240544
THROTTLE events: 16
UNTHROTTLE events: 16
FORK events: 120488
SAMPLE events: 23878219
MMAP2 events: 745325
FINISHED_ROUND events: 23813
Sample event stats:
20,579,564,471,104 cycles
23,878,219 samples # sampling ratio 99.745% (3989/4000)
498.736917889 second time sampled
$ perf report -i threaded/kbuild7.data
perf: Segmentation fault
-------- backtrace --------
perf[0x51c7cb]
/usr/lib/libc.so.6(+0x33540)[0x7f37eb37e540]
/usr/lib/libc.so.6(+0x9029e)[0x7f37eb3db29e]
perf[0x4dd9c8]
perf(__hists__add_entry+0x188)[0x4e2258]
perf[0x4e2580]
perf(hist_entry_iter__add+0x9d)[0x4e2a7d]
perf[0x437fda]
perf[0x4c4c8e]
perf[0x4c5176]
perf[0x4c8bab]
perf[0x4c53c2]
perf[0x4c5f0c]
perf(perf_session__process_events+0xb3)[0x4c6b23]
perf(cmd_report+0x12a0)[0x439310]
perf[0x483ec3]
perf(main+0x60a)[0x42979a]
/usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f37eb36b800]
perf(_start+0x29)[0x4298b9]
[0x0]
It seems like some memory area was corrupted..
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-14 8:23 ` Namhyung Kim
@ 2015-05-14 13:18 ` Arnaldo Carvalho de Melo
2015-05-15 2:08 ` Namhyung Kim
0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-14 13:18 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, linux-kernel, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Naveen N . Rao,
Peter Zijlstra, Ralf Baechle, Stephane Eranian
Em Thu, May 14, 2015 at 05:23:30PM +0900, Namhyung Kim escreveu:
> On Mon, May 11, 2015 at 11:06:26AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, May 11, 2015 at 02:09:39PM +0900, Namhyung Kim escreveu:
> > > I'm seeing a segfault on 'perf report' with a large data file after
> > > applying thread refcount change - it happens regardless of the atomic
> > > operation.
> > Any specific 'perf record' command line? Does it take a long time to
> > reproduce? Any backtraces? I'll try to repro, its possible that we're
> > doing one too many thread__put()...
> It's a kernel build with '-j 20' and recorded data size is ~2.1GB.
> It takes ~30 sec to reproduce.
>
> $ perf report -i threaded/kbuild7.data --header-only
> # ========
> # captured on: Thu Dec 18 12:06:35 2014
> # hostname : sejong
> # os release : 3.17.4-1-ARCH
> # perf version : 3.18.rc3.gcb4774b
> # arch : x86_64
> # nrcpus online : 12
> # nrcpus avail : 12
> # cpudesc : Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
> # cpuid : GenuineIntel,6,45,7
> # total memory : 24646828 kB
> # cmdline : /home/namhyung/project/linux/tools/perf/perf record -ag -o /home/namhyung/tmp/perf/threaded/kbuild7.data -- make -j20
> # event : name = cycles, , size = 104, { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled = 1, inherit
> # HEADER_CPU_TOPOLOGY info available, use -I to display
> # HEADER_NUMA_TOPOLOGY info available, use -I to display
> # pmu mappings: cpu = 4, software = 1, power = 24, uncore_pcu = 13, tracepoint = 2, uncore_imc_0 = 15, uncore_imc_1 = 16, uncore_imc_2 = 17, uncore_
> # ========
> #
>
>
> $ perf data stat -i threaded/kbuild7.data
>
> Total event stats for 'threaded/kbuild7.data' file:
>
> TOTAL events: 25126492
> MMAP events: 114
> COMM events: 117957
> EXIT events: 240544
> THROTTLE events: 16
> UNTHROTTLE events: 16
> FORK events: 120488
> SAMPLE events: 23878219
> MMAP2 events: 745325
> FINISHED_ROUND events: 23813
>
> Sample event stats:
>
> 20,579,564,471,104 cycles
> 23,878,219 samples # sampling ratio 99.745% (3989/4000)
>
> 498.736917889 second time sampled
>
>
> $ perf report -i threaded/kbuild7.data
We need to improve this segfault backtrace, I have to always use
addr2line to resolve those missing entries, i.e. if you try:
addr2line -fe /path/to/your/perf 0x4dd9c8
addr2line -fe /path/to/your/perf 0x4e2580
We would have resolved those lines :-/
But I think this is a longstanding bug in handling hist_entries, i.e.
probably we have more than one pointer to a hist_entry and are accessing
it in two places at the same time, with one of them deleting it and
possibly reusing the data.
> perf: Segmentation fault
> -------- backtrace --------
> perf[0x51c7cb]
> /usr/lib/libc.so.6(+0x33540)[0x7f37eb37e540]
> /usr/lib/libc.so.6(+0x9029e)[0x7f37eb3db29e]
> perf[0x4dd9c8]
> perf(__hists__add_entry+0x188)[0x4e2258]
> perf[0x4e2580]
> perf(hist_entry_iter__add+0x9d)[0x4e2a7d]
> perf[0x437fda]
> perf[0x4c4c8e]
> perf[0x4c5176]
> perf[0x4c8bab]
> perf[0x4c53c2]
> perf[0x4c5f0c]
> perf(perf_session__process_events+0xb3)[0x4c6b23]
> perf(cmd_report+0x12a0)[0x439310]
> perf[0x483ec3]
> perf(main+0x60a)[0x42979a]
> /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f37eb36b800]
> perf(_start+0x29)[0x4298b9]
> [0x0]
>
> It seems like some memory area was corrupted..
Right, looks like use after free, for instance, freeing something still
on a list or rbtree :-/
- Arnaldo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-14 13:18 ` Arnaldo Carvalho de Melo
@ 2015-05-15 2:08 ` Namhyung Kim
2015-05-18 16:21 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 44+ messages in thread
From: Namhyung Kim @ 2015-05-15 2:08 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, linux-kernel, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Naveen N . Rao,
Peter Zijlstra, Ralf Baechle, Stephane Eranian
Hi Arnaldo,
On Thu, May 14, 2015 at 10:18:27AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, May 14, 2015 at 05:23:30PM +0900, Namhyung Kim escreveu:
> > On Mon, May 11, 2015 at 11:06:26AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, May 11, 2015 at 02:09:39PM +0900, Namhyung Kim escreveu:
> > > > I'm seeing a segfault on 'perf report' with a large data file after
> > > > applying thread refcount change - it happens regardless of the atomic
> > > > operation.
>
> > > Any specific 'perf record' command line? Does it take a long time to
> > > reproduce? Any backtraces? I'll try to repro, its possible that we're
> > > doing one too many thread__put()...
>
> > It's a kernel build with '-j 20' and recorded data size is ~2.1GB.
> > It takes ~30 sec to reproduce.
> >
> > $ perf report -i threaded/kbuild7.data --header-only
> > # ========
> > # captured on: Thu Dec 18 12:06:35 2014
> > # hostname : sejong
> > # os release : 3.17.4-1-ARCH
> > # perf version : 3.18.rc3.gcb4774b
> > # arch : x86_64
> > # nrcpus online : 12
> > # nrcpus avail : 12
> > # cpudesc : Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
> > # cpuid : GenuineIntel,6,45,7
> > # total memory : 24646828 kB
> > # cmdline : /home/namhyung/project/linux/tools/perf/perf record -ag -o /home/namhyung/tmp/perf/threaded/kbuild7.data -- make -j20
> > # event : name = cycles, , size = 104, { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled = 1, inherit
> > # HEADER_CPU_TOPOLOGY info available, use -I to display
> > # HEADER_NUMA_TOPOLOGY info available, use -I to display
> > # pmu mappings: cpu = 4, software = 1, power = 24, uncore_pcu = 13, tracepoint = 2, uncore_imc_0 = 15, uncore_imc_1 = 16, uncore_imc_2 = 17, uncore_
> > # ========
> > #
> >
> >
> > $ perf data stat -i threaded/kbuild7.data
> >
> > Total event stats for 'threaded/kbuild7.data' file:
> >
> > TOTAL events: 25126492
> > MMAP events: 114
> > COMM events: 117957
> > EXIT events: 240544
> > THROTTLE events: 16
> > UNTHROTTLE events: 16
> > FORK events: 120488
> > SAMPLE events: 23878219
> > MMAP2 events: 745325
> > FINISHED_ROUND events: 23813
> >
> > Sample event stats:
> >
> > 20,579,564,471,104 cycles
> > 23,878,219 samples # sampling ratio 99.745% (3989/4000)
> >
> > 498.736917889 second time sampled
> >
> >
> > $ perf report -i threaded/kbuild7.data
>
> We need to improve this segfault backtrace, I have to always use
> addr2line to resolve those missing entries, i.e. if you try:
>
> addr2line -fe /path/to/your/perf 0x4dd9c8
> addr2line -fe /path/to/your/perf 0x4e2580
>
> We would have resolved those lines :-/
Right, I'll add it to my TODO list.
Anyway, this is a backtrace using gdb..
Thanks,
Namhyung
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5fb229e in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff5fb229e in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
#1 0x00000000004d3948 in _sort__dso_cmp (map_r=<optimized out>, map_l=<optimized out>) at util/sort.c:142
#2 sort__dso_cmp (left=<optimized out>, right=<optimized out>) at util/sort.c:148
#3 0x00000000004d7f08 in hist_entry__cmp (right=0x7fffffffc530, left=0x323a27f0) at util/hist.c:911
#4 add_hist_entry (sample_self=true, al=0x7fffffffc710, entry=0x7fffffffc530, hists=0x18f6690) at util/hist.c:389
#5 __hists__add_entry (hists=0x18f6690, al=0x7fffffffc710, sym_parent=<optimized out>, bi=bi@entry=0x0, mi=mi@entry=0x0, period=<optimized out>,
weight=0, transaction=0, sample_self=true) at util/hist.c:471
#6 0x00000000004d8234 in iter_add_single_normal_entry (iter=0x7fffffffc740, al=<optimized out>) at util/hist.c:662
#7 0x00000000004d8765 in hist_entry_iter__add (iter=0x7fffffffc740, al=0x7fffffffc710, evsel=0x18f6550, sample=<optimized out>,
max_stack_depth=<optimized out>, arg=0x7fffffffd0a0) at util/hist.c:871
#8 0x0000000000436353 in process_sample_event (tool=0x7fffffffd0a0, event=<optimized out>, sample=0x7fffffffc870, evsel=0x18f6550,
machine=<optimized out>) at builtin-report.c:171
#9 0x00000000004bbe23 in perf_evlist__deliver_sample (machine=0x18f4cc0, evsel=0x18f6550, sample=0x7fffffffc870, event=0x7fffe0bd3220,
tool=0x7fffffffd0a0, evlist=0x18f5b50) at util/session.c:972
#10 machines__deliver_event (machines=machines@entry=0x18f4cc0, evlist=<optimized out>, event=event@entry=0x7fffe0bd3220,
sample=sample@entry=0x7fffffffc870, tool=tool@entry=0x7fffffffd0a0, file_offset=file_offset@entry=1821434400) at util/session.c:1009
#11 0x00000000004bc681 in perf_session__deliver_event (file_offset=1821434400, tool=0x7fffffffd0a0, sample=0x7fffffffc870, event=0x7fffe0bd3220,
session=<optimized out>) at util/session.c:1050
#12 ordered_events__deliver_event (oe=0x18f4e00, event=<optimized out>) at util/session.c:109
#13 0x00000000004bf12b in __ordered_events__flush (oe=0x18f4e00) at util/ordered-events.c:207
#14 ordered_events__flush (oe=0x18f4e00, how=OE_FLUSH__ROUND) at util/ordered-events.c:271
#15 0x00000000004bc8aa in perf_session__process_user_event (file_offset=1821919744, event=0x7fffe0c49a00, session=0x18f4c00) at util/session.c:1087
#16 perf_session__process_event (session=session@entry=0x18f4c00, event=event@entry=0x7fffe0c49a00, file_offset=file_offset@entry=1821919744)
at util/session.c:1200
#17 0x00000000004bdcd0 in __perf_session__process_events (file_size=2160054608, data_size=<optimized out>, data_offset=<optimized out>,
session=0x18f4c00) at util/session.c:1501
#18 perf_session__process_events (session=session@entry=0x18f4c00) at util/session.c:1548
#19 0x0000000000437609 in __cmd_report (rep=0x7fffffffd0a0) at builtin-report.c:487
#20 cmd_report (argc=0, argv=0x7fffffffe8d0, prefix=<optimized out>) at builtin-report.c:878
#21 0x000000000047de33 in run_builtin (p=p@entry=0x85a6e8 <commands+168>, argc=argc@entry=6, argv=argv@entry=0x7fffffffe8d0) at perf.c:370
#22 0x000000000042893a in handle_internal_command (argv=0x7fffffffe8d0, argc=6) at perf.c:429
#23 run_argv (argv=0x7fffffffe660, argcp=0x7fffffffe66c) at perf.c:473
#24 main (argc=6, argv=0x7fffffffe8d0) at perf.c:588
>
> But I think this is a longstanding bug in handling hist_entries, i.e.
> probably we have more than one pointer to a hist_entry and are accessing
> it in two places at the same time, with one of them deleting it and
> possibly reusing the data.
>
> > perf: Segmentation fault
> > -------- backtrace --------
> > perf[0x51c7cb]
> > /usr/lib/libc.so.6(+0x33540)[0x7f37eb37e540]
> > /usr/lib/libc.so.6(+0x9029e)[0x7f37eb3db29e]
> > perf[0x4dd9c8]
> > perf(__hists__add_entry+0x188)[0x4e2258]
> > perf[0x4e2580]
> > perf(hist_entry_iter__add+0x9d)[0x4e2a7d]
> > perf[0x437fda]
> > perf[0x4c4c8e]
> > perf[0x4c5176]
> > perf[0x4c8bab]
> > perf[0x4c53c2]
> > perf[0x4c5f0c]
> > perf(perf_session__process_events+0xb3)[0x4c6b23]
> > perf(cmd_report+0x12a0)[0x439310]
> > perf[0x483ec3]
> > perf(main+0x60a)[0x42979a]
> > /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f37eb36b800]
> > perf(_start+0x29)[0x4298b9]
> > [0x0]
> >
> > It seems like some memory area was corrupted..
>
> Right, looks like use after free, for instance, freeing something still
> on a list or rbtree :-/
>
> - Arnaldo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2015-05-15 2:08 ` Namhyung Kim
@ 2015-05-18 16:21 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-18 16:21 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, linux-kernel, Adrian Hunter,
Ananth N Mavinakayanahalli, Borislav Petkov, David Ahern,
Davidlohr Bueso, Deng-Cheng Zhu, Don Zickus, Frederic Weisbecker,
Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Naveen N . Rao,
Peter Zijlstra, Ralf Baechle, Stephane Eranian
Em Fri, May 15, 2015 at 11:08:04AM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
>
> On Thu, May 14, 2015 at 10:18:27AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, May 14, 2015 at 05:23:30PM +0900, Namhyung Kim escreveu:
> > > On Mon, May 11, 2015 at 11:06:26AM -0300, Arnaldo Carvalho de Melo wrote:
> > We need to improve this segfault backtrace, I have to always use
> > addr2line to resolve those missing entries, i.e. if you try:
> >
> > addr2line -fe /path/to/your/perf 0x4dd9c8
> > addr2line -fe /path/to/your/perf 0x4e2580
> >
> > We would have resolved those lines :-/
>
> Right, I'll add it to my TODO list.
>
> Anyway, this is a backtrace using gdb..
Ok, reproduced here:
[acme@ibm-x3650m4-01 linux]$ fg
gdb perf
list
134 if (verbose) {
135 dso_name_l = dso_l->long_name;
136 dso_name_r = dso_r->long_name;
137 } else {
138 dso_name_l = dso_l->short_name;
139 dso_name_r = dso_r->short_name;
140 }
141
142 return strcmp(dso_name_l, dso_name_r);
143 }
(gdb) p dso_l
$2 = (struct dso *) 0x1924ba0
(gdb)
$3 = (struct dso *) 0x1924ba0
(gdb) p dso_r
$4 = (struct dso *) 0x1
(gdb) bt
#0 0x00000000004f557b in _sort__dso_cmp (map_l=0x182ab3120, map_r=0xd5325b0) at util/sort.c:139
#1 0x00000000004f55f1 in sort__dso_cmp (left=0x606c7f0, right=0x7fffffffb850) at util/sort.c:148
#2 0x00000000004f8470 in __sort__hpp_cmp (fmt=0x1922fb0, a=0x606c7f0, b=0x7fffffffb850) at util/sort.c:1313
#3 0x00000000004fc3b8 in hist_entry__cmp (left=0x606c7f0, right=0x7fffffffb850) at util/hist.c:911
#4 0x00000000004fafcc in add_hist_entry (hists=0x1922d80, entry=0x7fffffffb850, al=0x7fffffffbbe0, sample_self=false) at util/hist.c:389
#5 0x00000000004fb350 in __hists__add_entry (hists=0x1922d80, al=0x7fffffffbbe0, sym_parent=0x0, bi=0x0, mi=0x0, period=557536, weight=0, transaction=0, sample_self=false)
at util/hist.c:471
#6 0x00000000004fc03c in iter_add_next_cumulative_entry (iter=0x7fffffffbc10, al=0x7fffffffbbe0) at util/hist.c:797
#7 0x00000000004fc291 in hist_entry_iter__add (iter=0x7fffffffbc10, al=0x7fffffffbbe0, evsel=0x1922c50, sample=0x7fffffffbdf0, max_stack_depth=127, arg=0x7fffffffc810) at util/hist.c:882
#8 0x000000000042f1b7 in process_sample_event (tool=0x7fffffffc810, event=0x7ffed74b41e0, sample=0x7fffffffbdf0, evsel=0x1922c50, machine=0x19213d0) at builtin-report.c:171
#9 0x00000000004da272 in perf_evlist__deliver_sample (evlist=0x1922260, tool=0x7fffffffc810, event=0x7ffed74b41e0, sample=0x7fffffffbdf0, evsel=0x1922c50, machine=0x19213d0)
at util/session.c:1000
#10 0x00000000004da40c in machines__deliver_event (machines=0x19213d0, evlist=0x1922260, event=0x7ffed74b41e0, sample=0x7fffffffbdf0, tool=0x7fffffffc810, file_offset=1097646560)
at util/session.c:1037
#11 0x00000000004da659 in perf_session__deliver_event (session=0x1921310, event=0x7ffed74b41e0, sample=0x7fffffffbdf0, tool=0x7fffffffc810, file_offset=1097646560) at util/session.c:1082
#12 0x00000000004d7d7b in ordered_events__deliver_event (oe=0x1921558, event=0x2050430) at util/session.c:109
#13 0x00000000004dd65b in __ordered_events__flush (oe=0x1921558) at util/ordered-events.c:207
#14 0x00000000004dd92f in ordered_events__flush (oe=0x1921558, how=OE_FLUSH__ROUND) at util/ordered-events.c:271
#15 0x00000000004d94c8 in process_finished_round (tool=0x7fffffffc810, event=0x7ffed74c6830, oe=0x1921558) at util/session.c:663
#16 0x00000000004da7cd in perf_session__process_user_event (session=0x1921310, event=0x7ffed74c6830, file_offset=1097721904) at util/session.c:1119
#17 0x00000000004daced in perf_session__process_event (session=0x1921310, event=0x7ffed74c6830, file_offset=1097721904) at util/session.c:1232
#18 0x00000000004db811 in __perf_session__process_events (session=0x1921310, data_offset=232, data_size=5774474704, file_size=5774474936) at util/session.c:1533
#19 0x00000000004dba01 in perf_session__process_events (session=0x1921310) at util/session.c:1580
#20 0x000000000042ff9f in __cmd_report (rep=0x7fffffffc810) at builtin-report.c:487
#21 0x00000000004315d9 in cmd_report (argc=0, argv=0x7fffffffddd0, prefix=0x0) at builtin-report.c:878
#22 0x0000000000490fb8 in run_builtin (p=0x886528 <commands+168>, argc=1, argv=0x7fffffffddd0) at perf.c:370
#23 0x0000000000491217 in handle_internal_command (argc=1, argv=0x7fffffffddd0) at perf.c:429
#24 0x0000000000491363 in run_argv (argcp=0x7fffffffdc2c, argv=0x7fffffffdc20) at perf.c:473
#25 0x00000000004916c4 in main (argc=1, argv=0x7fffffffddd0) at perf.c:588
(gdb)
Looking at the frame #1 I see:
(gdb) p left->hists
$22 = (struct hists *) 0x1922d80
(gdb) p right->hists
$23 = (struct hists *) 0x1922d80
(gdb)
I.e. both look like fine hist_entry instances, both are on the same struct hists, but:
(gdb) p right->ms.map->dso
$25 = (struct dso *) 0x1924ba0
(gdb) p right->ms.ma
There is no member named ma.
(gdb) p right->ms.map
$26 = (struct map *) 0x182ab3120
(gdb) p right->ms.map->dso
$27 = (struct dso *) 0x1924ba0
(gdb) p right->ms.map->dso->name
$28 = 0x1924cc0 "/usr/lib64/libc-2.18.so"
(gdb) p left->ms.map
$29 = (struct map *) 0xd5325b0
(gdb) p left->ms.map->dso
$30 = (struct dso *) 0x1
(gdb) p *left->ms.map
$31 = {{rb_node = {__rb_parent_color = 0, rb_right = 0x118cdc3c8, rb_left = 0x0}, node = {next = 0x0, prev = 0x118cdc3c8}}, start = 0, end = 0, type = 71 'G', referenced = 138,
erange_warned = 8, priv = 0, prot = 0, flags = 0, pgoff = 81, reloc = 559687, maj = 0, min = 0, ino = 559687, ino_generation = 0, map_ip = 0x0, unmap_ip = 0x0, dso = 0x1,
groups = 0xd5302a0}
(gdb)
Will continue investigating later...
- Arnaldo
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff5fb229e in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
> (gdb) bt
> #0 0x00007ffff5fb229e in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
> #1 0x00000000004d3948 in _sort__dso_cmp (map_r=<optimized out>, map_l=<optimized out>) at util/sort.c:142
> #2 sort__dso_cmp (left=<optimized out>, right=<optimized out>) at util/sort.c:148
> #3 0x00000000004d7f08 in hist_entry__cmp (right=0x7fffffffc530, left=0x323a27f0) at util/hist.c:911
> #4 add_hist_entry (sample_self=true, al=0x7fffffffc710, entry=0x7fffffffc530, hists=0x18f6690) at util/hist.c:389
> #5 __hists__add_entry (hists=0x18f6690, al=0x7fffffffc710, sym_parent=<optimized out>, bi=bi@entry=0x0, mi=mi@entry=0x0, period=<optimized out>,
> weight=0, transaction=0, sample_self=true) at util/hist.c:471
> #6 0x00000000004d8234 in iter_add_single_normal_entry (iter=0x7fffffffc740, al=<optimized out>) at util/hist.c:662
> #7 0x00000000004d8765 in hist_entry_iter__add (iter=0x7fffffffc740, al=0x7fffffffc710, evsel=0x18f6550, sample=<optimized out>,
> max_stack_depth=<optimized out>, arg=0x7fffffffd0a0) at util/hist.c:871
> #8 0x0000000000436353 in process_sample_event (tool=0x7fffffffd0a0, event=<optimized out>, sample=0x7fffffffc870, evsel=0x18f6550,
> machine=<optimized out>) at builtin-report.c:171
> #9 0x00000000004bbe23 in perf_evlist__deliver_sample (machine=0x18f4cc0, evsel=0x18f6550, sample=0x7fffffffc870, event=0x7fffe0bd3220,
> tool=0x7fffffffd0a0, evlist=0x18f5b50) at util/session.c:972
> #10 machines__deliver_event (machines=machines@entry=0x18f4cc0, evlist=<optimized out>, event=event@entry=0x7fffe0bd3220,
> sample=sample@entry=0x7fffffffc870, tool=tool@entry=0x7fffffffd0a0, file_offset=file_offset@entry=1821434400) at util/session.c:1009
> #11 0x00000000004bc681 in perf_session__deliver_event (file_offset=1821434400, tool=0x7fffffffd0a0, sample=0x7fffffffc870, event=0x7fffe0bd3220,
> session=<optimized out>) at util/session.c:1050
> #12 ordered_events__deliver_event (oe=0x18f4e00, event=<optimized out>) at util/session.c:109
> #13 0x00000000004bf12b in __ordered_events__flush (oe=0x18f4e00) at util/ordered-events.c:207
> #14 ordered_events__flush (oe=0x18f4e00, how=OE_FLUSH__ROUND) at util/ordered-events.c:271
> #15 0x00000000004bc8aa in perf_session__process_user_event (file_offset=1821919744, event=0x7fffe0c49a00, session=0x18f4c00) at util/session.c:1087
> #16 perf_session__process_event (session=session@entry=0x18f4c00, event=event@entry=0x7fffe0c49a00, file_offset=file_offset@entry=1821919744)
> at util/session.c:1200
> #17 0x00000000004bdcd0 in __perf_session__process_events (file_size=2160054608, data_size=<optimized out>, data_offset=<optimized out>,
> session=0x18f4c00) at util/session.c:1501
> #18 perf_session__process_events (session=session@entry=0x18f4c00) at util/session.c:1548
> #19 0x0000000000437609 in __cmd_report (rep=0x7fffffffd0a0) at builtin-report.c:487
> #20 cmd_report (argc=0, argv=0x7fffffffe8d0, prefix=<optimized out>) at builtin-report.c:878
> #21 0x000000000047de33 in run_builtin (p=p@entry=0x85a6e8 <commands+168>, argc=argc@entry=6, argv=argv@entry=0x7fffffffe8d0) at perf.c:370
> #22 0x000000000042893a in handle_internal_command (argv=0x7fffffffe8d0, argc=6) at perf.c:429
> #23 run_argv (argv=0x7fffffffe660, argcp=0x7fffffffe66c) at perf.c:473
> #24 main (argc=6, argv=0x7fffffffe8d0) at perf.c:588
>
>
> >
> > But I think this is a longstanding bug in handling hist_entries, i.e.
> > probably we have more than one pointer to a hist_entry and are accessing
> > it in two places at the same time, with one of them deleting it and
> > possibly reusing the data.
> >
> > > perf: Segmentation fault
> > > -------- backtrace --------
> > > perf[0x51c7cb]
> > > /usr/lib/libc.so.6(+0x33540)[0x7f37eb37e540]
> > > /usr/lib/libc.so.6(+0x9029e)[0x7f37eb3db29e]
> > > perf[0x4dd9c8]
> > > perf(__hists__add_entry+0x188)[0x4e2258]
> > > perf[0x4e2580]
> > > perf(hist_entry_iter__add+0x9d)[0x4e2a7d]
> > > perf[0x437fda]
> > > perf[0x4c4c8e]
> > > perf[0x4c5176]
> > > perf[0x4c8bab]
> > > perf[0x4c53c2]
> > > perf[0x4c5f0c]
> > > perf(perf_session__process_events+0xb3)[0x4c6b23]
> > > perf(cmd_report+0x12a0)[0x439310]
> > > perf[0x483ec3]
> > > perf(main+0x60a)[0x42979a]
> > > /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f37eb36b800]
> > > perf(_start+0x29)[0x4298b9]
> > > [0x0]
> > >
> > > It seems like some memory area was corrupted..
> >
> > Right, looks like use after free, for instance, freeing something still
> > on a list or rbtree :-/
> >
> > - Arnaldo
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 44+ messages in thread
* [GIT PULL 00/30] perf/core improvements and fixes
@ 2016-04-27 14:30 Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 01/30] perf buildid: Fix off-by-one in write_buildid() Arnaldo Carvalho de Melo
` (30 more replies)
0 siblings, 31 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Alexander Shishkin, Alexei Starovoitov,
Ananth N Mavinakayanahalli, Andi Kleen, Andrey Ryabinin,
Borislav Petkov, Brendan Gregg, Chris Phlipot, Colin Ian King,
David Ahern, Davidlohr Bueso, Eric Engestrom, Frederic Weisbecker,
He Kuang, Hemant Kumar, Hitoshi Mitake, Jiri Olsa, Kan Liang,
Linus Torvalds, Masami Hiramatsu, Milian Wolff, Namhyung Kim,
Naveen N . Rao, Peter Zijlstra, pi3orama, Ravi Bangoria,
Srikar Dronamraju, Stephane Eranian, Thomas Gleixner, TJ,
Vince Weaver, Wang Nan, Zefan Li
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 67d61296ffcc850bffdd4466430cb91e5328f39a:
Merge tag 'perf-core-for-mingo-20160419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux (2016-04-23 14:50:39 +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-20160427
for you to fetch changes up to 4cb93446c587d56e2a54f4f83113daba2c0b6dee:
perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack (2016-04-27 10:29:07 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- perf trace --pf maj/min/all works with --call-graph: (Arnaldo Carvalho de Melo)
Tracing write syscalls and major page faults with callchains while starting
firefox, limiting the stack to 5 frames:
# perf trace -e write --pf maj --max-stack 5 firefox
589.549 ( 0.014 ms): firefox/15377 write(fd: 4, buf: 0x7fff80acc898, count: 151) = 151
[0xfaed] (/usr/lib64/libpthread-2.22.so)
fire_glxtest_process+0x5c (/usr/lib64/firefox/libxul.so)
InstallGdkErrorHandler+0x41 (/usr/lib64/firefox/libxul.so)
XREMain::XRE_mainInit+0x12c (/usr/lib64/firefox/libxul.so)
XREMain::XRE_main+0x1e4 (/usr/lib64/firefox/libxul.so)
760.704 ( 0.000 ms): firefox/15332 majfault [gtk_tree_view_accessible_get_type+0x0] => /usr/lib64/libgtk-3.so.0.1800.9@0xa0850 (x.)
gtk_tree_view_accessible_get_type+0x0 (/usr/lib64/libgtk-3.so.0.1800.9)
gtk_tree_view_class_intern_init+0x1a54 (/usr/lib64/libgtk-3.so.0.1800.9)
g_type_class_ref+0x6dd (/usr/lib64/libgobject-2.0.so.0.4600.2)
[0x115378] (/usr/lib64/libgnutls.so.30.6.3)
This automagically selects "--call-graph dwarf", use "--call-graph fp" on systems
where -fno-omit-frame-pointer was used to built the components of interest, to
incur in less overhead, or tune "--call-graph dwarf" appropriately, see 'perf record --help'.
- Allow /proc/sys/kernel/perf_event_max_stack, that defaults to the old hard coded value
of PERF_MAX_STACK_DEPTH (127), useful for huge callstacks for things like Groovy, Ruby, etc,
and also to reduce overhead by limiting it to a smaller value, upcoming work will allow
this to be done per-event (Arnaldo Carvalho de Melo)
- Make 'perf trace --min-stack' be honoured by --pf and --event (Arnaldo Carvalho de Melo)
- Make 'perf evlist -v' decode perf_event_attr->branch_sample_type (Arnaldo Carvalho de Melo)
# perf record --call lbr usleep 1
# perf evlist -v
cycles:ppp: ... sample_type: IP|TID|TIME|CALLCHAIN|PERIOD|BRANCH_STACK, ...
branch_sample_type: USER|CALL_STACK|NO_FLAGS|NO_CYCLES
#
- Clear dummy entry accumulated period, fixing such 'perf top/report' output
as: (Kan Liang)
4769.98% 0.01% 0.00% 0.01% tchain_edit [kernel] [k] update_fast_timekeeper
- System calls with pid_t arguments gets them augmented with the COMM event
more thoroughly:
# trace -e perf_event_open perf stat -e cycles -p 15608
6.876 ( 0.014 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15608 (hexchat), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
6.882 ( 0.005 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15639 (gmain), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 4
6.889 ( 0.005 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15640 (gdbus), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
^^^^^^^^^^^^^^^^^^
^C
- Fix offline module name mismatch issue in 'perf probe' (Ravi Bangoria)
- Fix module probe issue if no dwarf support in (Ravi Bangoria)
Assorted fixes:
- Fix off-by-one in write_buildid() (Andrey Ryabinin)
- Fix segfault when printing callchains in 'perf script' (Chris Phlipot)
- Replace assignment with comparison on assert check in 'perf test' entry (Colin Ian King)
- Fix off-by-one comparison in intel-pt code (Colin Ian King)
- Close target file on error path in 'perf probe' (Masami Hiramatsu)
- Set default kprobe group name if not given in 'perf probe' (Masami Hiramatsu)
- Avoid partial perf_event_header reads (Wang Nan)
Infrastructure:
- Update x86's syscall_64.tbl copy, adding preadv2 & pwritev2 (Arnaldo Carvalho de Melo)
- Make the x86 clean quiet wrt syscall table removal (Jiri Olsa)
Cleanups:
- Simplify wrapper for LOCK_PI in 'perf bench futex' (Davidlohr Bueso)
- Remove duplicate const qualifier (Eric Engestrom)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Andrey Ryabinin (1):
perf buildid: Fix off-by-one in write_buildid()
Arnaldo Carvalho de Melo (14):
perf trace: Extract evsel contructor from perf_evlist__add_pgfault
perf trace: Make --pf maj/min/all use callchains too
perf trace: Make --event honour --min-stack too
perf trace: Make --pf honour --min-stack too
perf evlist: Decode perf_event_attr->branch_sample_type
perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/
perf trace: Do not beautify the 'pid' parameter as a simple integer
tools lib api fs: Add helper to read string from procfs file
perf thread: Introduce method to set comm from /proc/pid/self
perf trace: Read thread's COMM from /proc when not set
perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2
perf bench: Remove one more die() call
perf core: Allow setting up max frame stack depth via sysctl
perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack
Chris Phlipot (1):
perf script: Fix segfault when printing callchains
Colin Ian King (2):
perf tests: Replace assignment with comparison on assert check
perf intel-pt: Fix off-by-one comparison on maximum code
Davidlohr Bueso (1):
perf bench futex: Simplify wrapper for LOCK_PI
Eric Engestrom (1):
perf tools: Remove duplicate const qualifier
Jiri Olsa (2):
perf tools: Make the x86 clean quiet
tools build: Fix perf_clean target
Kan Liang (1):
perf hists: Clear dummy entry accumulated period
Masami Hiramatsu (4):
perf probe: Close target file on error path
perf tools: Add lsdir() helper to read a directory
perf probe: Let probe_file__add_event return 0 if succeeded
perf probe: Set default kprobe group name if it is not given
Ravi Bangoria (2):
perf probe: Fix offline module name missmatch issue
perf probe: Fix module probe issue if no dwarf support
Wang Nan (1):
perf evlist: Enforce ring buffer reading
Documentation/sysctl/kernel.txt | 14 ++
arch/arm/kernel/perf_callchain.c | 2 +-
arch/arm64/kernel/perf_callchain.c | 4 +-
arch/metag/kernel/perf_callchain.c | 2 +-
arch/mips/kernel/perf_event.c | 4 +-
arch/powerpc/perf/callchain.c | 4 +-
arch/sparc/kernel/perf_event.c | 6 +-
arch/x86/events/core.c | 4 +-
arch/xtensa/kernel/perf_event.c | 4 +-
include/linux/perf_event.h | 8 +-
kernel/bpf/stackmap.c | 8 +-
kernel/events/callchain.c | 35 ++++-
kernel/sysctl.c | 12 ++
tools/Makefile | 3 +-
tools/lib/api/fs/fs.c | 13 ++
tools/lib/api/fs/fs.h | 2 +
tools/perf/Documentation/perf-report.txt | 2 +-
tools/perf/Documentation/perf-script.txt | 2 +-
tools/perf/Documentation/perf-top.txt | 2 +-
tools/perf/Documentation/perf-trace.txt | 2 +-
tools/perf/arch/x86/Makefile | 2 +-
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 2 +
tools/perf/bench/futex-lock-pi.c | 2 +-
tools/perf/bench/futex.h | 6 +-
tools/perf/bench/mem-functions.c | 22 ++-
tools/perf/builtin-report.c | 4 +-
tools/perf/builtin-script.c | 16 +-
tools/perf/builtin-top.c | 4 +-
tools/perf/builtin-trace.c | 174 +++++++++++----------
tools/perf/perf.c | 5 +
tools/perf/tests/event_update.c | 2 +-
tools/perf/tests/hists_cumulate.c | 2 +-
tools/perf/tests/hists_filter.c | 2 +-
tools/perf/tests/hists_output.c | 2 +-
tools/perf/trace/beauty/perf_event_open.c | 43 +++++
tools/perf/trace/beauty/pid.c | 5 +-
tools/perf/util/build-id.c | 6 +-
tools/perf/util/evlist.c | 12 +-
tools/perf/util/evsel.c | 18 ++-
tools/perf/util/hist.c | 2 +
.../perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +-
tools/perf/util/machine.c | 6 +-
tools/perf/util/probe-event.c | 114 +++++++++++---
tools/perf/util/probe-file.c | 3 +-
.../perf/util/scripting-engines/trace-event-perl.c | 2 +-
tools/perf/util/thread.c | 21 ++-
tools/perf/util/thread.h | 2 +
tools/perf/util/util.c | 36 +++++
tools/perf/util/util.h | 4 +
49 files changed, 475 insertions(+), 179 deletions(-)
create mode 100644 tools/perf/trace/beauty/perf_event_open.c
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 01/30] perf buildid: Fix off-by-one in write_buildid()
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 02/30] perf trace: Extract evsel contructor from perf_evlist__add_pgfault Arnaldo Carvalho de Melo
` (29 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Andrey Ryabinin, Alexander Shishkin, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
write_buildid() increments 'name_len' with intention to take into
account trailing zero byte. However, 'name_len' was already incremented
in machine__write_buildid_table() before. So this leads to
out-of-bounds read in do_write():
$ ./perf record sleep 0
[ perf record: Woken up 1 times to write data ]
=================================================================
==15899==ERROR: AddressSanitizer: global-buffer-overflow on address 0x00000099fc92 at pc 0x7f1aa9c7eab5 bp 0x7fff940f84d0 sp 0x7fff940f7c78
READ of size 19 at 0x00000099fc92 thread T0
#0 0x7f1aa9c7eab4 (/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/libasan.so.2+0x44ab4)
#1 0x649c5b in do_write util/header.c:67
#2 0x649c5b in write_padded util/header.c:82
#3 0x57e8bc in write_buildid util/build-id.c:239
#4 0x57e8bc in machine__write_buildid_table util/build-id.c:278
...
0x00000099fc92 is located 0 bytes to the right of global variable '*.LC99' defined in 'util/symbol.c' (0x99fc80) of size 18
'*.LC99' is ascii string '[kernel.kallsyms]'
...
Shadow bytes around the buggy address:
0x00008012bf80: f9 f9 f9 f9 00 00 00 00 00 00 03 f9 f9 f9 f9 f9
=>0x00008012bf90: 00 00[02]f9 f9 f9 f9 f9 00 00 00 00 00 05 f9 f9
0x00008012bfa0: f9 f9 f9 f9 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1461053847-5633-1-git-send-email-aryabinin@virtuozzo.com
[ Remove the off-by one at the origin, to keep len(s) == strlen(s) assumption ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/build-id.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 0573c2ec861d..b6ecf87bc3e3 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -261,14 +261,14 @@ static int machine__write_buildid_table(struct machine *machine, int fd)
if (dso__is_vdso(pos)) {
name = pos->short_name;
- name_len = pos->short_name_len + 1;
+ name_len = pos->short_name_len;
} else if (dso__is_kcore(pos)) {
machine__mmap_name(machine, nm, sizeof(nm));
name = nm;
- name_len = strlen(nm) + 1;
+ name_len = strlen(nm);
} else {
name = pos->long_name;
- name_len = pos->long_name_len + 1;
+ name_len = pos->long_name_len;
}
in_kernel = pos->kernel ||
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 02/30] perf trace: Extract evsel contructor from perf_evlist__add_pgfault
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 01/30] perf buildid: Fix off-by-one in write_buildid() Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too Arnaldo Carvalho de Melo
` (28 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Prep work for next patches, where we'll need access to the created
evsels, to possibly configure callchains.
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-2pcgsgnkgellhlcao4aub8tu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 5e2614bbb48d..69b460354201 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2381,8 +2381,7 @@ static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist)
return true;
}
-static int perf_evlist__add_pgfault(struct perf_evlist *evlist,
- u64 config)
+static struct perf_evsel *perf_evsel__new_pgfault(u64 config)
{
struct perf_evsel *evsel;
struct perf_event_attr attr = {
@@ -2396,13 +2395,10 @@ static int perf_evlist__add_pgfault(struct perf_evlist *evlist,
event_attr_init(&attr);
evsel = perf_evsel__new(&attr);
- if (!evsel)
- return -ENOMEM;
-
- evsel->handler = trace__pgfault;
- perf_evlist__add(evlist, evsel);
+ if (evsel)
+ evsel->handler = trace__pgfault;
- return 0;
+ return evsel;
}
static void trace__handle_event(struct trace *trace, union perf_event *event, struct perf_sample *sample)
@@ -2504,7 +2500,7 @@ out_enomem:
static int trace__run(struct trace *trace, int argc, const char **argv)
{
struct perf_evlist *evlist = trace->evlist;
- struct perf_evsel *evsel;
+ struct perf_evsel *evsel, *pgfault_maj = NULL, *pgfault_min = NULL;
int err = -1, i;
unsigned long before;
const bool forks = argc > 0;
@@ -2518,14 +2514,19 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (trace->trace_syscalls)
trace->vfs_getname = perf_evlist__add_vfs_getname(evlist);
- if ((trace->trace_pgfaults & TRACE_PFMAJ) &&
- perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MAJ)) {
- goto out_error_mem;
+ if ((trace->trace_pgfaults & TRACE_PFMAJ)) {
+ pgfault_maj = perf_evsel__new_pgfault(PERF_COUNT_SW_PAGE_FAULTS_MAJ);
+ if (pgfault_maj == NULL)
+ goto out_error_mem;
+ perf_evlist__add(evlist, pgfault_maj);
}
- if ((trace->trace_pgfaults & TRACE_PFMIN) &&
- perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MIN))
- goto out_error_mem;
+ if ((trace->trace_pgfaults & TRACE_PFMIN)) {
+ pgfault_min = perf_evsel__new_pgfault(PERF_COUNT_SW_PAGE_FAULTS_MIN);
+ if (pgfault_min == NULL)
+ goto out_error_mem;
+ perf_evlist__add(evlist, pgfault_min);
+ }
if (trace->sched &&
perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime",
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 01/30] perf buildid: Fix off-by-one in write_buildid() Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 02/30] perf trace: Extract evsel contructor from perf_evlist__add_pgfault Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 04/30] perf script: Fix segfault when printing callchains Arnaldo Carvalho de Melo
` (27 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Forgot about page faults, a software event, when adding support for callchains,
fix it:
# trace --no-syscalls --pf maj --call dwarf
0.000 ( 0.000 ms): Xorg/2068 majfault [sfbSegment1+0x0] => /usr/lib64/xorg/modules/drivers/intel_drv.so@0x11b490 (x.)
sfbSegment1+0x0 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
fbPolySegment32+0x361 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
sna_poly_segment+0x743 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
damagePolySegment+0x77 (/usr/libexec/Xorg)
ProcPolySegment+0xe7 (/usr/libexec/Xorg)
Dispatch+0x25f (/usr/libexec/Xorg)
dix_main+0x3c3 (/usr/libexec/Xorg)
__libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
_start+0x29 (/usr/libexec/Xorg)
0.257 ( 0.000 ms): Xorg/2068 majfault [miZeroClipLine+0x0] => /usr/libexec/Xorg@0x18e830 (x.)
miZeroClipLine+0x0 (/usr/libexec/Xorg)
_fbSegment+0x2c0 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
sfbSegment1+0x67 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
fbPolySegment32+0x361 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
sna_poly_segment+0x743 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
damagePolySegment+0x77 (/usr/libexec/Xorg)
ProcPolySegment+0xe7 (/usr/libexec/Xorg)
Dispatch+0x25f (/usr/libexec/Xorg)
dix_main+0x3c3 (/usr/libexec/Xorg)
__libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
_start+0x29 (/usr/libexec/Xorg)
^C#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-8h6ssirw5z15qyhy2lwd6f89@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 59 ++++++++++++++++++++++++++++++++--------------
1 file changed, 41 insertions(+), 18 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 69b460354201..d1bbcb9abca3 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2222,6 +2222,11 @@ static int trace__pgfault(struct trace *trace,
print_location(trace->output, sample, &al, true, false);
fprintf(trace->output, " (%c%c)\n", map_type, al.level);
+
+ if (sample->callchain) {
+ if (trace__resolve_callchain(trace, evsel, sample, &callchain_cursor) == 0)
+ trace__fprintf_callchain(trace, sample);
+ }
out:
err = 0;
out_put:
@@ -2547,24 +2552,42 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
perf_evlist__config(evlist, &trace->opts, NULL);
- if (callchain_param.enabled && trace->syscalls.events.sys_exit) {
- perf_evsel__config_callchain(trace->syscalls.events.sys_exit,
- &trace->opts, &callchain_param);
- /*
- * Now we have evsels with different sample_ids, use
- * PERF_SAMPLE_IDENTIFIER to map from sample to evsel
- * from a fixed position in each ring buffer record.
- *
- * As of this the changeset introducing this comment, this
- * isn't strictly needed, as the fields that can come before
- * PERF_SAMPLE_ID are all used, but we'll probably disable
- * some of those for things like copying the payload of
- * pointer syscall arguments, and for vfs_getname we don't
- * need PERF_SAMPLE_ADDR and PERF_SAMPLE_IP, so do this
- * here as a warning we need to use PERF_SAMPLE_IDENTIFIER.
- */
- perf_evlist__set_sample_bit(evlist, IDENTIFIER);
- perf_evlist__reset_sample_bit(evlist, ID);
+ if (callchain_param.enabled) {
+ bool use_identifier = false;
+
+ if (trace->syscalls.events.sys_exit) {
+ perf_evsel__config_callchain(trace->syscalls.events.sys_exit,
+ &trace->opts, &callchain_param);
+ use_identifier = true;
+ }
+
+ if (pgfault_maj) {
+ perf_evsel__config_callchain(pgfault_maj, &trace->opts, &callchain_param);
+ use_identifier = true;
+ }
+
+ if (pgfault_min) {
+ perf_evsel__config_callchain(pgfault_min, &trace->opts, &callchain_param);
+ use_identifier = true;
+ }
+
+ if (use_identifier) {
+ /*
+ * Now we have evsels with different sample_ids, use
+ * PERF_SAMPLE_IDENTIFIER to map from sample to evsel
+ * from a fixed position in each ring buffer record.
+ *
+ * As of this the changeset introducing this comment, this
+ * isn't strictly needed, as the fields that can come before
+ * PERF_SAMPLE_ID are all used, but we'll probably disable
+ * some of those for things like copying the payload of
+ * pointer syscall arguments, and for vfs_getname we don't
+ * need PERF_SAMPLE_ADDR and PERF_SAMPLE_IP, so do this
+ * here as a warning we need to use PERF_SAMPLE_IDENTIFIER.
+ */
+ perf_evlist__set_sample_bit(evlist, IDENTIFIER);
+ perf_evlist__reset_sample_bit(evlist, ID);
+ }
}
signal(SIGCHLD, sig_handler);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 04/30] perf script: Fix segfault when printing callchains
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 05/30] perf trace: Make --event honour --min-stack too Arnaldo Carvalho de Melo
` (26 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Chris Phlipot, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Chris Phlipot <cphlipot0@gmail.com>
This fixes a bug caused by an unitialized callchain cursor. The crash
frist appeared in:
6f736735e30f ("perf evsel: Require that callchains be resolved before
calling fprintf_{sym,callchain}")
The callchain cursor is a struct that contains pointers, that when
uninitialized will cause unpredictable behavior (usually a crash)
when trying to append to the callchain.
The existing implementation has the following issues:
1. The callchain cursor used is not initialized, resulting in
unpredictable behavior when used.
2. The cursor is declared on the stack. Even if it is properly initalized,
the implmentation will leak memory when the function returns,
since all the references to the callchain_nodes allocated by
callchain_cursor_append will be lost when the cursor goes out of
scope.
3. Storing the cursor on the stack is inefficient. Even if memory is
properly freed when it goes out of scope, a performance penalty
will be incurred due to reallocation of callchain nodes.
callchain_cursor_append is designed to avoid these reallocations
when an existing cursor is reused.
This patch fixes the crash by replacing cursor_callchain with a reference
to the global callchain_cursor which also resolves all 3 issues mentioned
above.
How to reproduce the crash:
$ perf record --call-graph=dwarf stress -t 1 -c 1
$ perf script > /dev/null
Segfault
Signed-off-by: Chris Phlipot <cphlipot0@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 6f736735e30f ("perf evsel: Require that callchains be resolved before calling fprintf_{sym,callchain}")
Link: http://lkml.kernel.org/r/1461119531-2529-1-git-send-email-cphlipot0@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-script.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 5099740aa50b..f43b0c6f88f4 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -570,12 +570,12 @@ static void print_sample_bts(struct perf_sample *sample,
/* print branch_from information */
if (PRINT_FIELD(IP)) {
unsigned int print_opts = output[attr->type].print_ip_opts;
- struct callchain_cursor *cursor = NULL, cursor_callchain;
+ struct callchain_cursor *cursor = NULL;
if (symbol_conf.use_callchain && sample->callchain &&
- thread__resolve_callchain(al->thread, &cursor_callchain, evsel,
+ thread__resolve_callchain(al->thread, &callchain_cursor, evsel,
sample, NULL, NULL, scripting_max_stack) == 0)
- cursor = &cursor_callchain;
+ cursor = &callchain_cursor;
if (cursor == NULL) {
putchar(' ');
@@ -789,12 +789,12 @@ static void process_event(struct perf_script *script,
printf("%16" PRIu64, sample->weight);
if (PRINT_FIELD(IP)) {
- struct callchain_cursor *cursor = NULL, cursor_callchain;
+ struct callchain_cursor *cursor = NULL;
if (symbol_conf.use_callchain && sample->callchain &&
- thread__resolve_callchain(al->thread, &cursor_callchain, evsel,
+ thread__resolve_callchain(al->thread, &callchain_cursor, evsel,
sample, NULL, NULL, scripting_max_stack) == 0)
- cursor = &cursor_callchain;
+ cursor = &callchain_cursor;
putchar(cursor ? '\n' : ' ');
sample__fprintf_sym(sample, al, 0, output[attr->type].print_ip_opts, cursor, stdout);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 05/30] perf trace: Make --event honour --min-stack too
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 04/30] perf script: Fix segfault when printing callchains Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 06/30] perf trace: Make --pf " Arnaldo Carvalho de Melo
` (25 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-shj0fazntmskhjild5i6x73l@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index d1bbcb9abca3..fc276d718172 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2126,6 +2126,17 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
union perf_event *event __maybe_unused,
struct perf_sample *sample)
{
+ int callchain_ret = 0;
+
+ if (sample->callchain) {
+ callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
+ if (callchain_ret == 0) {
+ if (callchain_cursor.nr < trace->min_stack)
+ goto out;
+ callchain_ret = 1;
+ }
+ }
+
trace__printf_interrupted_entry(trace, sample);
trace__fprintf_tstamp(trace, sample->time, trace->output);
@@ -2144,11 +2155,11 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
fprintf(trace->output, ")\n");
- if (sample->callchain) {
- if (trace__resolve_callchain(trace, evsel, sample, &callchain_cursor) == 0)
- trace__fprintf_callchain(trace, sample);
- }
-
+ if (callchain_ret > 0)
+ trace__fprintf_callchain(trace, sample);
+ else if (callchain_ret < 0)
+ pr_err("Problem processing %s callchain, skipping...\n", perf_evsel__name(evsel));
+out:
return 0;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 06/30] perf trace: Make --pf honour --min-stack too
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 05/30] perf trace: Make --event honour --min-stack too Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 07/30] perf evlist: Decode perf_event_attr->branch_sample_type Arnaldo Carvalho de Melo
` (24 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To check deeply nested page fault callchains.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-wuji34xx003kr88nmqt6jkgf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index fc276d718172..a4b133fac82b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2190,8 +2190,19 @@ static int trace__pgfault(struct trace *trace,
char map_type = 'd';
struct thread_trace *ttrace;
int err = -1;
+ int callchain_ret = 0;
thread = machine__findnew_thread(trace->host, sample->pid, sample->tid);
+
+ if (sample->callchain) {
+ callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
+ if (callchain_ret == 0) {
+ if (callchain_cursor.nr < trace->min_stack)
+ goto out_put;
+ callchain_ret = 1;
+ }
+ }
+
ttrace = thread__trace(thread, trace->output);
if (ttrace == NULL)
goto out_put;
@@ -2234,10 +2245,10 @@ static int trace__pgfault(struct trace *trace,
fprintf(trace->output, " (%c%c)\n", map_type, al.level);
- if (sample->callchain) {
- if (trace__resolve_callchain(trace, evsel, sample, &callchain_cursor) == 0)
- trace__fprintf_callchain(trace, sample);
- }
+ if (callchain_ret > 0)
+ trace__fprintf_callchain(trace, sample);
+ else if (callchain_ret < 0)
+ pr_err("Problem processing %s callchain, skipping...\n", perf_evsel__name(evsel));
out:
err = 0;
out_put:
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 07/30] perf evlist: Decode perf_event_attr->branch_sample_type
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 06/30] perf trace: Make --pf " Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 08/30] perf tools: Make the x86 clean quiet Arnaldo Carvalho de Melo
` (23 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
While trying to use --call-graph lbr in 'perf trace', since we only are
interested in the callchain for userspace, up to the callchain, I found
that 'perf evlist' is not decoding the branch_sample_type field, fix it.
Before:
# perf record --call-graph lbr usleep 1
# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000,
sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD|BRANCH_STACK,
disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1,
precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1,
comm_exec: 1, branch_sample_type: 51201
^^^^^^^^^^^^^^^^^^^^^^^^^
After:
# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000,
sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD|BRANCH_STACK,
disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1,
precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1,
comm_exec: 1, branch_sample_type: USER|CALL_STACK|NO_FLAGS|NO_CYCLES
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-hozai7974u0ulgx13k96fcaw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 545bb3f0b2b0..334364e25bbe 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1231,6 +1231,21 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
__p_bits(buf, size, value, bits);
}
+static void __p_branch_sample_type(char *buf, size_t size, u64 value)
+{
+#define bit_name(n) { PERF_SAMPLE_BRANCH_##n, #n }
+ struct bit_names bits[] = {
+ bit_name(USER), bit_name(KERNEL), bit_name(HV), bit_name(ANY),
+ bit_name(ANY_CALL), bit_name(ANY_RETURN), bit_name(IND_CALL),
+ bit_name(ABORT_TX), bit_name(IN_TX), bit_name(NO_TX),
+ bit_name(COND), bit_name(CALL_STACK), bit_name(IND_JUMP),
+ bit_name(CALL), bit_name(NO_FLAGS), bit_name(NO_CYCLES),
+ { .name = NULL, }
+ };
+#undef bit_name
+ __p_bits(buf, size, value, bits);
+}
+
static void __p_read_format(char *buf, size_t size, u64 value)
{
#define bit_name(n) { PERF_FORMAT_##n, #n }
@@ -1249,6 +1264,7 @@ static void __p_read_format(char *buf, size_t size, u64 value)
#define p_unsigned(val) snprintf(buf, BUF_SIZE, "%"PRIu64, (uint64_t)(val))
#define p_signed(val) snprintf(buf, BUF_SIZE, "%"PRId64, (int64_t)(val))
#define p_sample_type(val) __p_sample_type(buf, BUF_SIZE, val)
+#define p_branch_sample_type(val) __p_branch_sample_type(buf, BUF_SIZE, val)
#define p_read_format(val) __p_read_format(buf, BUF_SIZE, val)
#define PRINT_ATTRn(_n, _f, _p) \
@@ -1305,7 +1321,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
PRINT_ATTRf(bp_type, p_unsigned);
PRINT_ATTRn("{ bp_addr, config1 }", bp_addr, p_hex);
PRINT_ATTRn("{ bp_len, config2 }", bp_len, p_hex);
- PRINT_ATTRf(branch_sample_type, p_unsigned);
+ PRINT_ATTRf(branch_sample_type, p_branch_sample_type);
PRINT_ATTRf(sample_regs_user, p_hex);
PRINT_ATTRf(sample_stack_user, p_unsigned);
PRINT_ATTRf(clockid, p_signed);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 08/30] perf tools: Make the x86 clean quiet
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 07/30] perf evlist: Decode perf_event_attr->branch_sample_type Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 09/30] tools build: Fix perf_clean target Arnaldo Carvalho de Melo
` (22 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
Peter Zijlstra, TJ, Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@kernel.org>
Turn current clean output:
$ make clean
rm -f arch/x86/include/generated/asm/syscalls_64.c
CLEAN libbpf
CLEAN libapi
into:
$ make clean
CLEAN x86
CLEAN libapi
CLEAN libbpf
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: TJ <linux@iam.tj>
Link: http://lkml.kernel.org/r/1461615438-27894-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index a33729173b13..6c9211b18ec0 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -24,6 +24,6 @@ $(header): $(sys)/syscall_64.tbl $(systbl)
$(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@
clean::
- rm -f $(header)
+ $(call QUIET_CLEAN, x86) $(RM) $(header)
archheaders: $(header)
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 09/30] tools build: Fix perf_clean target
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 08/30] perf tools: Make the x86 clean quiet Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 10/30] perf tools: Remove duplicate const qualifier Arnaldo Carvalho de Melo
` (21 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@kernel.org>
Fix perf_clean target to follow the same logic as perf target.
Fixes the following make invokation:
$ cd <kernelsrc> && make tools/perf_clean
Reported-by: TJ <linux@iam.tj>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116411
Link: http://lkml.kernel.org/r/1461615438-27894-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/Makefile b/tools/Makefile
index 60c7e6c8ff17..6bf68fe7dd29 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -137,7 +137,8 @@ libsubcmd_clean:
$(call descend,lib/subcmd,clean)
perf_clean:
- $(call descend,$(@:_clean=),clean)
+ $(Q)mkdir -p $(PERF_O) .
+ $(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
selftests_clean:
$(call descend,testing/$(@:_clean=),clean)
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 10/30] perf tools: Remove duplicate const qualifier
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 09/30] tools build: Fix perf_clean target Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 11/30] perf tests: Replace assignment with comparison on assert check Arnaldo Carvalho de Melo
` (20 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Eric Engestrom, Adrian Hunter, David Ahern,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1461577678-29517-1-git-send-email-eric.engestrom@imgtec.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/thread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index dfd00c6dad6e..de2036d1251b 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -233,7 +233,7 @@ void thread__find_cpumode_addr_location(struct thread *thread,
struct addr_location *al)
{
size_t i;
- const u8 const cpumodes[] = {
+ const u8 cpumodes[] = {
PERF_RECORD_MISC_USER,
PERF_RECORD_MISC_KERNEL,
PERF_RECORD_MISC_GUEST_USER,
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 11/30] perf tests: Replace assignment with comparison on assert check
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 10/30] perf tools: Remove duplicate const qualifier Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 12/30] perf bench futex: Simplify wrapper for LOCK_PI Arnaldo Carvalho de Melo
` (19 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Colin Ian King, Alexander Shishkin, Jiri Olsa,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Colin Ian King <colin.king@canonical.com>
The current assert check is checking an assignment, which will always be
true. Instead, the assert should be checking if scale is equal to 0.122
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1461419154-16918-1-git-send-email-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/event_update.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
index 012eab5d1df1..63ecf21750eb 100644
--- a/tools/perf/tests/event_update.c
+++ b/tools/perf/tests/event_update.c
@@ -30,7 +30,7 @@ static int process_event_scale(struct perf_tool *tool __maybe_unused,
TEST_ASSERT_VAL("wrong id", ev->id == 123);
TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__SCALE);
- TEST_ASSERT_VAL("wrong scale", ev_data->scale = 0.123);
+ TEST_ASSERT_VAL("wrong scale", ev_data->scale == 0.123);
return 0;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 12/30] perf bench futex: Simplify wrapper for LOCK_PI
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 11/30] perf tests: Replace assignment with comparison on assert check Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 13/30] perf intel-pt: Fix off-by-one comparison on maximum code Arnaldo Carvalho de Melo
` (18 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Davidlohr Bueso, Davidlohr Bueso,
Arnaldo Carvalho de Melo
From: Davidlohr Bueso <dave@stgolabs.net>
Given that the 'val' parameter is ignored for FUTEX_LOCK_PI, get rid of
the bogus deadlock detection flag in the wrapper code and avoid the
extra argument, making it resemble its unlock counterpart. And if
nothing else, we already only pass 0 anyway.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Davidlohr Bueso <dbueso@suse.de>
Link: http://lkml.kernel.org/r/1461208447-29328-1-git-send-email-dave@stgolabs.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bench/futex-lock-pi.c | 2 +-
tools/perf/bench/futex.h | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
index 6a18ce21f865..6952db65508a 100644
--- a/tools/perf/bench/futex-lock-pi.c
+++ b/tools/perf/bench/futex-lock-pi.c
@@ -83,7 +83,7 @@ static void *workerfn(void *arg)
do {
int ret;
again:
- ret = futex_lock_pi(w->futex, NULL, 0, futex_flag);
+ ret = futex_lock_pi(w->futex, NULL, futex_flag);
if (ret) { /* handle lock acquisition */
if (!silent)
diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h
index d44de9f44281..b2e06d1190d0 100644
--- a/tools/perf/bench/futex.h
+++ b/tools/perf/bench/futex.h
@@ -57,13 +57,11 @@ futex_wake(u_int32_t *uaddr, int nr_wake, int opflags)
/**
* futex_lock_pi() - block on uaddr as a PI mutex
- * @detect: whether (1) or not (0) to perform deadlock detection
*/
static inline int
-futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int detect,
- int opflags)
+futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int opflags)
{
- return futex(uaddr, FUTEX_LOCK_PI, detect, timeout, NULL, 0, opflags);
+ return futex(uaddr, FUTEX_LOCK_PI, 0, timeout, NULL, 0, opflags);
}
/**
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 13/30] perf intel-pt: Fix off-by-one comparison on maximum code
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (11 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 12/30] perf bench futex: Simplify wrapper for LOCK_PI Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 14/30] perf hists: Clear dummy entry accumulated period Arnaldo Carvalho de Melo
` (17 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Colin Ian King, Adrian Hunter, Alexander Shishkin,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Colin Ian King <colin.king@canonical.com>
The check for the maximum code is off-by-one; the current comparison of
a code that is INTEL_PT_ERR_MAX will cause the strlcpy to perform an out
of bounds array access on the intel_pt_err_msgs array.
Fix this with a >= comparison.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1461524203-10224-1-git-send-email-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 9409d014b46c..9c8f15da86ce 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -356,7 +356,7 @@ static const char *intel_pt_err_msgs[] = {
int intel_pt__strerror(int code, char *buf, size_t buflen)
{
- if (code < 1 || code > INTEL_PT_ERR_MAX)
+ if (code < 1 || code >= INTEL_PT_ERR_MAX)
code = INTEL_PT_ERR_UNK;
strlcpy(buf, intel_pt_err_msgs[code], buflen);
return 0;
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 14/30] perf hists: Clear dummy entry accumulated period
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (12 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 13/30] perf intel-pt: Fix off-by-one comparison on maximum code Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 15/30] perf evlist: Enforce ring buffer reading Arnaldo Carvalho de Melo
` (16 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Kan Liang, Andi Kleen, Namhyung Kim,
Arnaldo Carvalho de Melo
From: Kan Liang <kan.liang@intel.com>
The accumulated period for dummy entry should also be 0. Otherwise, the
total overhead could be overcounted.
$ perf record -e '{LLC-load-misses,cpu/instructions/}' --call-graph=lbr ./tchain
$ perf report --stdio
# To display the perf.data header info, please use --header/--header-only options.
#
# Total Lost Samples: 0
#
# Samples: 21K of event 'anon group { LLC-load-misses, cpu/instructions/ }'
# Event count (approx.): 16313667937
#
# Children Self Command Shared Object Symbol
# ................ ................ ........... ................ ............................
#
4769.98% 0.01% 0.00% 0.01% tchain_edit [kernel.vmlinux] [k] update_fast_timekeeper
4356.18% 0.01% 0.00% 0.01% tchain_edit [kernel.vmlinux] [k] trigger_load_balance
3181.12% 0.01% 0.00% 0.01% tchain_edit [kernel.vmlinux] [k] irq_work_tick
1592.37% 0.00% 0.00% 0.00% tchain_edit [kernel.vmlinux] [k] cpu_needs_another_gp
Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1461565689-5862-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 991a351a8a41..0f33d7e698c4 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -2062,6 +2062,8 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
if (he) {
memset(&he->stat, 0, sizeof(he->stat));
he->hists = hists;
+ if (symbol_conf.cumulate_callchain)
+ memset(he->stat_acc, 0, sizeof(he->stat));
rb_link_node(&he->rb_node_in, parent, p);
rb_insert_color(&he->rb_node_in, root);
hists__inc_stats(hists, he);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 15/30] perf evlist: Enforce ring buffer reading
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (13 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 14/30] perf hists: Clear dummy entry accumulated period Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 16/30] perf probe: Close target file on error path Arnaldo Carvalho de Melo
` (15 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Wang Nan, Peter Zijlstra, Zefan Li, pi3orama,
Arnaldo Carvalho de Melo
From: Wang Nan <wangnan0@huawei.com>
Don't read broken data after 'head' pointer.
Following commits will feed perf_evlist__mmap_read() with some 'head'
pointers not maintained by kernel. If 'head' pointer breaks an event, we
should avoid reading from the broken event. This can happen in backward
ring buffer.
For example:
old head
| |
V V
+---+------+----------+----+-----+--+
|..E|D....D|C........C|B..B|A....|E.|
+---+------+----------+----+-----+--+
'old' pointer points to the beginning of 'A' and trying read from it,
but 'A' has been overwritten. In this case, don't try to read from 'A',
simply return NULL.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1461637738-62722-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 6fb5725821de..85271e54a63b 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -684,6 +684,7 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
struct perf_mmap *md = &evlist->mmap[idx];
u64 head;
u64 old = md->prev;
+ int diff;
unsigned char *data = md->base + page_size;
union perf_event *event = NULL;
@@ -694,6 +695,7 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
return NULL;
head = perf_mmap__read_head(md);
+ diff = head - old;
if (evlist->overwrite) {
/*
* If we're further behind than half the buffer, there's a chance
@@ -703,7 +705,6 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
*
* In either case, truncate and restart at head.
*/
- int diff = head - old;
if (diff > md->mask / 2 || diff < 0) {
fprintf(stderr, "WARNING: failed to keep up with mmap data.\n");
@@ -711,15 +712,21 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
* head points to a known good entry, start there.
*/
old = head;
+ diff = 0;
}
}
- if (old != head) {
+ if (diff >= (int)sizeof(event->header)) {
size_t size;
event = (union perf_event *)&data[old & md->mask];
size = event->header.size;
+ if (size < sizeof(event->header) || diff < (int)size) {
+ event = NULL;
+ goto broken_event;
+ }
+
/*
* Event straddles the mmap boundary -- header should always
* be inside due to u64 alignment of output.
@@ -743,6 +750,7 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
old += size;
}
+broken_event:
md->prev = old;
return event;
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 16/30] perf probe: Close target file on error path
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (14 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 15/30] perf evlist: Enforce ring buffer reading Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 17/30] perf tools: Add lsdir() helper to read a directory Arnaldo Carvalho de Melo
` (14 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Masami Hiramatsu, Namhyung Kim, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Masami Hiramatsu <mhiramat@kernel.org>
Fix a bug to close target elf file in get_text_start_address().
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160426064737.1443.44093.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 8319fbb08636..97b7f8e5fe69 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -486,8 +486,10 @@ static int get_text_start_address(const char *exec, unsigned long *address)
return -errno;
elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
- if (elf == NULL)
- return -EINVAL;
+ if (elf == NULL) {
+ ret = -EINVAL;
+ goto out_close;
+ }
if (gelf_getehdr(elf, &ehdr) == NULL)
goto out;
@@ -499,6 +501,9 @@ static int get_text_start_address(const char *exec, unsigned long *address)
ret = 0;
out:
elf_end(elf);
+out_close:
+ close(fd);
+
return ret;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 17/30] perf tools: Add lsdir() helper to read a directory
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (15 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 16/30] perf probe: Close target file on error path Arnaldo Carvalho de Melo
@ 2016-04-27 14:30 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 18/30] perf probe: Let probe_file__add_event return 0 if succeeded Arnaldo Carvalho de Melo
` (13 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Masami Hiramatsu, Masami Hiramatsu,
Ananth N Mavinakayanahalli, Hemant Kumar, Namhyung Kim,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
As a utility function, add lsdir() which reads given directory and store
entry name into a strlist. lsdir accepts a filter function so that user
can filter out unneeded entries.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160426090242.11891.79014.stgit@devbox
[ Do not use the 'dirname' it is used in some distros ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/util.c | 34 ++++++++++++++++++++++++++++++++++
tools/perf/util/util.h | 3 +++
2 files changed, 37 insertions(+)
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index b7766c577b01..9473d46c00bb 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -117,6 +117,40 @@ int rm_rf(char *path)
return rmdir(path);
}
+/* A filter which removes dot files */
+bool lsdir_no_dot_filter(const char *name __maybe_unused, struct dirent *d)
+{
+ return d->d_name[0] != '.';
+}
+
+/* lsdir reads a directory and store it in strlist */
+struct strlist *lsdir(const char *name,
+ bool (*filter)(const char *, struct dirent *))
+{
+ struct strlist *list = NULL;
+ DIR *dir;
+ struct dirent *d;
+
+ dir = opendir(name);
+ if (!dir)
+ return NULL;
+
+ list = strlist__new(NULL, NULL);
+ if (!list) {
+ errno = -ENOMEM;
+ goto out;
+ }
+
+ while ((d = readdir(dir)) != NULL) {
+ if (!filter || filter(name, d))
+ strlist__add(list, d->d_name);
+ }
+
+out:
+ closedir(dir);
+ return list;
+}
+
static int slow_copyfile(const char *from, const char *to)
{
int err = -1;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 3bf3de86d429..26a924651e7b 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -79,6 +79,7 @@
#include <termios.h>
#include <linux/bitops.h>
#include <termios.h>
+#include "strlist.h"
extern const char *graph_line;
extern const char *graph_dotted_line;
@@ -222,6 +223,8 @@ static inline int sane_case(int x, int high)
int mkdir_p(char *path, mode_t mode);
int rm_rf(char *path);
+struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *));
+bool lsdir_no_dot_filter(const char *name, struct dirent *d);
int copyfile(const char *from, const char *to);
int copyfile_mode(const char *from, const char *to, mode_t mode);
int copyfile_offset(int fromfd, loff_t from_ofs, int tofd, loff_t to_ofs, u64 size);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 18/30] perf probe: Let probe_file__add_event return 0 if succeeded
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (16 preceding siblings ...)
2016-04-27 14:30 ` [PATCH 17/30] perf tools: Add lsdir() helper to read a directory Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 19/30] perf probe: Set default kprobe group name if it is not given Arnaldo Carvalho de Melo
` (12 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Masami Hiramatsu, Ananth N Mavinakayanahalli,
Hemant Kumar, Namhyung Kim, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Masami Hiramatsu <mhiramat@kernel.org>
Since other methods return 0 if succeeded (or filedesc), let
probe_file__add_event() return 0 instead of the length of written bytes.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160426090303.11891.18232.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-file.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index e3b3b92e4458..3fe6214970e6 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -220,8 +220,7 @@ int probe_file__add_event(int fd, struct probe_trace_event *tev)
pr_debug("Writing event: %s\n", buf);
if (!probe_event_dry_run) {
- ret = write(fd, buf, strlen(buf));
- if (ret <= 0) {
+ if (write(fd, buf, strlen(buf)) < (int)strlen(buf)) {
ret = -errno;
pr_warning("Failed to write event: %s\n",
strerror_r(errno, sbuf, sizeof(sbuf)));
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 19/30] perf probe: Set default kprobe group name if it is not given
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (17 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 18/30] perf probe: Let probe_file__add_event return 0 if succeeded Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 20/30] perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/ Arnaldo Carvalho de Melo
` (11 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Masami Hiramatsu, Masami Hiramatsu,
Ananth N Mavinakayanahalli, Hemant Kumar, Namhyung Kim,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Set kprobe group name as "probe" if it is not given.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160426090413.11891.95640.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 97b7f8e5fe69..0de5d10dda71 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2748,9 +2748,13 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
{
int ret;
- if (pev->uprobes && !pev->group) {
- /* Replace group name if not given */
- ret = convert_exec_to_group(pev->target, &pev->group);
+ if (!pev->group) {
+ /* Set group name if not given */
+ if (!pev->uprobes) {
+ pev->group = strdup(PERFPROBE_GROUP);
+ ret = pev->group ? 0 : -ENOMEM;
+ } else
+ ret = convert_exec_to_group(pev->target, &pev->group);
if (ret != 0) {
pr_warning("Failed to make a group name.\n");
return ret;
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 20/30] perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (18 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 19/30] perf probe: Set default kprobe group name if it is not given Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 21/30] perf trace: Do not beautify the 'pid' parameter as a simple integer Arnaldo Carvalho de Melo
` (10 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To reduce the size of builtin-trace.c.
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-8r3gmymyn3r0ynt4yuzspp9g@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 45 +------------------------------
tools/perf/trace/beauty/perf_event_open.c | 43 +++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 44 deletions(-)
create mode 100644 tools/perf/trace/beauty/perf_event_open.c
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a4b133fac82b..903deda92d9e 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -56,22 +56,6 @@
# define MSG_CMSG_CLOEXEC 0x40000000
#endif
-#ifndef PERF_FLAG_FD_NO_GROUP
-# define PERF_FLAG_FD_NO_GROUP (1UL << 0)
-#endif
-
-#ifndef PERF_FLAG_FD_OUTPUT
-# define PERF_FLAG_FD_OUTPUT (1UL << 1)
-#endif
-
-#ifndef PERF_FLAG_PID_CGROUP
-# define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */
-#endif
-
-#ifndef PERF_FLAG_FD_CLOEXEC
-# define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */
-#endif
-
struct trace {
struct perf_tool tool;
struct syscalltbl *sctbl;
@@ -674,34 +658,6 @@ static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size,
#define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags
-static size_t syscall_arg__scnprintf_perf_flags(char *bf, size_t size,
- struct syscall_arg *arg)
-{
- int printed = 0, flags = arg->val;
-
- if (flags == 0)
- return 0;
-
-#define P_FLAG(n) \
- if (flags & PERF_FLAG_##n) { \
- printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
- flags &= ~PERF_FLAG_##n; \
- }
-
- P_FLAG(FD_NO_GROUP);
- P_FLAG(FD_OUTPUT);
- P_FLAG(PID_CGROUP);
- P_FLAG(FD_CLOEXEC);
-#undef P_FLAG
-
- if (flags)
- printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
-
- return printed;
-}
-
-#define SCA_PERF_FLAGS syscall_arg__scnprintf_perf_flags
-
static size_t syscall_arg__scnprintf_pipe_flags(char *bf, size_t size,
struct syscall_arg *arg)
{
@@ -894,6 +850,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,
#include "trace/beauty/pid.c"
#include "trace/beauty/mmap.c"
#include "trace/beauty/mode_t.c"
+#include "trace/beauty/perf_event_open.c"
#include "trace/beauty/sched_policy.c"
#include "trace/beauty/socket_type.c"
#include "trace/beauty/waitid_options.c"
diff --git a/tools/perf/trace/beauty/perf_event_open.c b/tools/perf/trace/beauty/perf_event_open.c
new file mode 100644
index 000000000000..311f09dd718d
--- /dev/null
+++ b/tools/perf/trace/beauty/perf_event_open.c
@@ -0,0 +1,43 @@
+#ifndef PERF_FLAG_FD_NO_GROUP
+# define PERF_FLAG_FD_NO_GROUP (1UL << 0)
+#endif
+
+#ifndef PERF_FLAG_FD_OUTPUT
+# define PERF_FLAG_FD_OUTPUT (1UL << 1)
+#endif
+
+#ifndef PERF_FLAG_PID_CGROUP
+# define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */
+#endif
+
+#ifndef PERF_FLAG_FD_CLOEXEC
+# define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */
+#endif
+
+static size_t syscall_arg__scnprintf_perf_flags(char *bf, size_t size,
+ struct syscall_arg *arg)
+{
+ int printed = 0, flags = arg->val;
+
+ if (flags == 0)
+ return 0;
+
+#define P_FLAG(n) \
+ if (flags & PERF_FLAG_##n) { \
+ printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
+ flags &= ~PERF_FLAG_##n; \
+ }
+
+ P_FLAG(FD_NO_GROUP);
+ P_FLAG(FD_OUTPUT);
+ P_FLAG(PID_CGROUP);
+ P_FLAG(FD_CLOEXEC);
+#undef P_FLAG
+
+ if (flags)
+ printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
+
+ return printed;
+}
+
+#define SCA_PERF_FLAGS syscall_arg__scnprintf_perf_flags
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 21/30] perf trace: Do not beautify the 'pid' parameter as a simple integer
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (19 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 20/30] perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/ Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 22/30] tools lib api fs: Add helper to read string from procfs file Arnaldo Carvalho de Melo
` (9 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Leave it alone so that it ends up assigned to SCA_PID via its type,
'pid_t', that will look up the pid on the machine thread rb_tree and
possibly find its COMM.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-r7dujgmhtxxfajuunpt1bkuo@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 903deda92d9e..48b00f042599 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1043,8 +1043,7 @@ static struct syscall_fmt {
[1] = SCA_FILENAME, /* filename */
[2] = SCA_OPEN_FLAGS, /* flags */ }, },
{ .name = "perf_event_open", .errmsg = true,
- .arg_scnprintf = { [1] = SCA_INT, /* pid */
- [2] = SCA_INT, /* cpu */
+ .arg_scnprintf = { [2] = SCA_INT, /* cpu */
[3] = SCA_FD, /* group_fd */
[4] = SCA_PERF_FLAGS, /* flags */ }, },
{ .name = "pipe2", .errmsg = true,
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 22/30] tools lib api fs: Add helper to read string from procfs file
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (20 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 21/30] perf trace: Do not beautify the 'pid' parameter as a simple integer Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 23/30] perf thread: Introduce method to set comm from /proc/pid/self Arnaldo Carvalho de Melo
` (8 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Borislav Petkov, David Ahern, Jiri Olsa, Milian Wolff,
Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To read things like /proc/self/comm.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ztpkbmseidt0hq2psr46o0h9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/api/fs/fs.c | 13 +++++++++++++
tools/lib/api/fs/fs.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ef78c22ff44d..08556cf2c70d 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -351,6 +351,19 @@ int filename__read_str(const char *filename, char **buf, size_t *sizep)
return err;
}
+int procfs__read_str(const char *entry, char **buf, size_t *sizep)
+{
+ char path[PATH_MAX];
+ const char *procfs = procfs__mountpoint();
+
+ if (!procfs)
+ return -1;
+
+ snprintf(path, sizeof(path), "%s/%s", procfs, entry);
+
+ return filename__read_str(path, buf, sizep);
+}
+
int sysfs__read_ull(const char *entry, unsigned long long *value)
{
char path[PATH_MAX];
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 9f6598098dc5..16c9c2ed7c5b 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -29,6 +29,8 @@ int filename__read_int(const char *filename, int *value);
int filename__read_ull(const char *filename, unsigned long long *value);
int filename__read_str(const char *filename, char **buf, size_t *sizep);
+int procfs__read_str(const char *entry, char **buf, size_t *sizep);
+
int sysctl__read_int(const char *sysctl, int *value);
int sysfs__read_int(const char *entry, int *value);
int sysfs__read_ull(const char *entry, unsigned long long *value);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 23/30] perf thread: Introduce method to set comm from /proc/pid/self
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (21 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 22/30] tools lib api fs: Add helper to read string from procfs file Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 24/30] perf trace: Read thread's COMM from /proc when not set Arnaldo Carvalho de Melo
` (7 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Borislav Petkov, David Ahern, Jiri Olsa, Milian Wolff,
Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Will be used for lazy comm loading in 'perf trace'.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-7ogbkuoka1y2qsmcckqxvl5m@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/thread.c | 19 +++++++++++++++++++
tools/perf/util/thread.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index de2036d1251b..45fcb715a36b 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -10,6 +10,8 @@
#include "comm.h"
#include "unwind.h"
+#include <api/fs/fs.h>
+
int thread__init_map_groups(struct thread *thread, struct machine *machine)
{
struct thread *leader;
@@ -153,6 +155,23 @@ int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp,
return 0;
}
+int thread__set_comm_from_proc(struct thread *thread)
+{
+ char path[64];
+ char *comm = NULL;
+ size_t sz;
+ int err = -1;
+
+ if (!(snprintf(path, sizeof(path), "%d/task/%d/comm",
+ thread->pid_, thread->tid) >= (int)sizeof(path)) &&
+ procfs__read_str(path, &comm, &sz) == 0) {
+ comm[sz - 1] = '\0';
+ err = thread__set_comm(thread, comm, 0);
+ }
+
+ return err;
+}
+
const char *thread__comm_str(const struct thread *thread)
{
const struct comm *comm = thread__comm(thread);
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index e214207bb13a..45fba13c800b 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -71,6 +71,8 @@ static inline int thread__set_comm(struct thread *thread, const char *comm,
return __thread__set_comm(thread, comm, timestamp, false);
}
+int thread__set_comm_from_proc(struct thread *thread);
+
int thread__comm_len(struct thread *thread);
struct comm *thread__comm(const struct thread *thread);
struct comm *thread__exec_comm(const struct thread *thread);
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 24/30] perf trace: Read thread's COMM from /proc when not set
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (22 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 23/30] perf thread: Introduce method to set comm from /proc/pid/self Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 25/30] perf probe: Fix offline module name missmatch issue Arnaldo Carvalho de Melo
` (6 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Borislav Petkov, David Ahern, Jiri Olsa, Milian Wolff,
Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We get notifications for threads that gets created while we're tracing,
but for preexisting threads we may end not having synthesized them, like
when tracing a 'perf trace' session that will use '--pid' to trace some
other thread.
And besides we should probably stop synthesizing those records and
instead read thread information in a lazy way, i.e. just when we need,
like done in this patch:
Now the 'pid_t' argument in 'perf_event_open' gets translated to a COMM:
# perf trace -e perf_event_open perf stat -e cycles -p 31601
0.027 ( 0.027 ms): perf/23393 perf_event_open(attr_uptr: 0x2fdd0d8, pid: 31601 (abrt-dump-journ), cpu: -1, group_fd: -1, flags: FD_CLOEXEC)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 3
^C
And in other syscalls containing pid_t without thread->comm_set at the
time of the formatting.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ioeps6dlwst17d6oozc9shtk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/pid.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/trace/beauty/pid.c b/tools/perf/trace/beauty/pid.c
index 111ae08d38f1..07486ea65ae3 100644
--- a/tools/perf/trace/beauty/pid.c
+++ b/tools/perf/trace/beauty/pid.c
@@ -3,9 +3,12 @@ static size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_a
int pid = arg->val;
struct trace *trace = arg->trace;
size_t printed = scnprintf(bf, size, "%d", pid);
- struct thread *thread = machine__find_thread(trace->host, pid, pid);
+ struct thread *thread = machine__findnew_thread(trace->host, pid, pid);
if (thread != NULL) {
+ if (!thread->comm_set)
+ thread__set_comm_from_proc(thread);
+
if (thread->comm_set)
printed += scnprintf(bf + printed, size - printed,
" (%s)", thread__comm_str(thread));
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 25/30] perf probe: Fix offline module name missmatch issue
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (23 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 24/30] perf trace: Read thread's COMM from /proc when not set Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 26/30] perf probe: Fix module probe issue if no dwarf support Arnaldo Carvalho de Melo
` (5 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Ravi Bangoria, Alexander Shishkin, Namhyung Kim,
Naveen N. Rao, Peter Zijlstra, Srikar Dronamraju, Wang Nan,
Arnaldo Carvalho de Melo
From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Perf can add a probe on kernel module which has not been loaded yet.
The current implementation finds the module name from path. But if the
filename is different from the actual module name then perf fails to
register a probe while loading module because of mismatch in the names.
For example, samples/kobject/kobject-example.ko is loaded as
kobject_example.
Before applying patch:
$ sudo ./perf probe -m /linux/samples/kobject/kobject-example.ko foo_show
Added new event:
probe:foo_show (on foo_show in kobject-example)
You can now use it in all perf tools, such as:
perf record -e probe:foo_show -aR sleep 1
$ cat /sys/kernel/debug/tracing/kprobe_events
p:probe/foo_show kobject-example:foo_show
$ insmod kobject-example.ko
$ lsmod
Module Size Used by
kobject_example 16384 0
Generate read to /sys/kernel/kobject_example/foo while recording data
with below command
$ sudo ./perf record -e probe:foo_show -a
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.093 MB perf.data ]
$./perf report --stdio -F overhead,comm,dso,sym
Error:
The perf.data.old file has no samples!
After applying patch:
$ sudo ./perf probe -m /linux/samples/kobject/kobject-example.ko foo_show
Added new event:
probe:foo_show (on foo_show in kobject_example)
You can now use it in all perf tools, such as:
perf record -e probe:foo_show -aR sleep 1
$ sudo cat /sys/kernel/debug/tracing/kprobe_events
p:probe/foo_show kobject_example:foo_show
$ insmod kobject-example.ko
$ lsmod
Module Size Used by
kobject_example 16384 0
Generate read to /sys/kernel/kobject_example/foo while recording data
with below command
$ sudo ./perf record -e probe:foo_show -a
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.097 MB perf.data (8 samples) ]
$ sudo ./perf report --stdio -F overhead,comm,dso,sym
...
# Samples: 8 of event 'probe:foo_show'
# Event count (approx.): 8
#
# Overhead Command Shared Object Symbol
# ........ ....... ................. ............
#
100.00% cat [kobject_example] [k] foo_show
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1461680741-12517-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 0de5d10dda71..bc2eb7cda2d1 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -588,32 +588,23 @@ static int add_module_to_probe_trace_events(struct probe_trace_event *tevs,
int ntevs, const char *module)
{
int i, ret = 0;
- char *tmp;
+ char *mod_name = NULL;
if (!module)
return 0;
- tmp = strrchr(module, '/');
- if (tmp) {
- /* This is a module path -- get the module name */
- module = strdup(tmp + 1);
- if (!module)
- return -ENOMEM;
- tmp = strchr(module, '.');
- if (tmp)
- *tmp = '\0';
- tmp = (char *)module; /* For free() */
- }
+ mod_name = find_module_name(module);
for (i = 0; i < ntevs; i++) {
- tevs[i].point.module = strdup(module);
+ tevs[i].point.module =
+ strdup(mod_name ? mod_name : module);
if (!tevs[i].point.module) {
ret = -ENOMEM;
break;
}
}
- free(tmp);
+ free(mod_name);
return ret;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 26/30] perf probe: Fix module probe issue if no dwarf support
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (24 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 25/30] perf probe: Fix offline module name missmatch issue Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 27/30] perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2 Arnaldo Carvalho de Melo
` (4 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Ravi Bangoria, Alexander Shishkin, Namhyung Kim,
Naveen N. Rao, Peter Zijlstra, Srikar Dronamraju, Wang Nan,
Arnaldo Carvalho de Melo
From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Perf is not able to register probe in kernel module when dwarf supprt
is not there(and so it goes for symtab). Perf passes full path of
module where only module name is required which is causing the problem.
This patch fixes this issue.
Before applying patch:
$ dpkg -s libdw-dev
dpkg-query: package 'libdw-dev' is not installed and no information is...
$ sudo ./perf probe -m /linux/samples/kprobes/kprobe_example.ko kprobe_init
Added new event:
probe:kprobe_init (on kprobe_init in /linux/samples/kprobes/kprobe_example.ko)
You can now use it in all perf tools, such as:
perf record -e probe:kprobe_init -aR sleep 1
$ sudo cat /sys/kernel/debug/tracing/kprobe_events
p:probe/kprobe_init /linux/samples/kprobes/kprobe_example.ko:kprobe_init
$ sudo ./perf record -a -e probe:kprobe_init
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.105 MB perf.data ]
$ sudo ./perf script # No output here
After applying patch:
$ sudo ./perf probe -m /linux/samples/kprobes/kprobe_example.ko kprobe_init
Added new event:
probe:kprobe_init (on kprobe_init in kprobe_example)
You can now use it in all perf tools, such as:
perf record -e probe:kprobe_init -aR sleep 1
$ sudo cat /sys/kernel/debug/tracing/kprobe_events
p:probe/kprobe_init kprobe_example:kprobe_init
$ sudo ./perf record -a -e probe:kprobe_init
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.105 MB perf.data (2 samples) ]
$ sudo ./perf script
insmod 13990 [002] 5961.216833: probe:kprobe_init: ...
insmod 13995 [002] 5962.889384: probe:kprobe_init: ...
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1461680741-12517-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 76 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 73 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index bc2eb7cda2d1..a9774628c6f6 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -265,6 +265,65 @@ static bool kprobe_warn_out_range(const char *symbol, unsigned long address)
return true;
}
+/*
+ * NOTE:
+ * '.gnu.linkonce.this_module' section of kernel module elf directly
+ * maps to 'struct module' from linux/module.h. This section contains
+ * actual module name which will be used by kernel after loading it.
+ * But, we cannot use 'struct module' here since linux/module.h is not
+ * exposed to user-space. Offset of 'name' has remained same from long
+ * time, so hardcoding it here.
+ */
+#ifdef __LP64__
+#define MOD_NAME_OFFSET 24
+#else
+#define MOD_NAME_OFFSET 12
+#endif
+
+/*
+ * @module can be module name of module file path. In case of path,
+ * inspect elf and find out what is actual module name.
+ * Caller has to free mod_name after using it.
+ */
+static char *find_module_name(const char *module)
+{
+ int fd;
+ Elf *elf;
+ GElf_Ehdr ehdr;
+ GElf_Shdr shdr;
+ Elf_Data *data;
+ Elf_Scn *sec;
+ char *mod_name = NULL;
+
+ fd = open(module, O_RDONLY);
+ if (fd < 0)
+ return NULL;
+
+ elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
+ if (elf == NULL)
+ goto elf_err;
+
+ if (gelf_getehdr(elf, &ehdr) == NULL)
+ goto ret_err;
+
+ sec = elf_section_by_name(elf, &ehdr, &shdr,
+ ".gnu.linkonce.this_module", NULL);
+ if (!sec)
+ goto ret_err;
+
+ data = elf_getdata(sec, NULL);
+ if (!data || !data->d_buf)
+ goto ret_err;
+
+ mod_name = strdup((char *)data->d_buf + MOD_NAME_OFFSET);
+
+ret_err:
+ elf_end(elf);
+elf_err:
+ close(fd);
+ return mod_name;
+}
+
#ifdef HAVE_DWARF_SUPPORT
static int kernel_get_module_dso(const char *module, struct dso **pdso)
@@ -2512,6 +2571,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
struct probe_trace_point *tp;
int num_matched_functions;
int ret, i, j, skipped = 0;
+ char *mod_name;
map = get_target_map(pev->target, pev->uprobes);
if (!map) {
@@ -2596,9 +2656,19 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
tp->realname = strdup_or_goto(sym->name, nomem_out);
tp->retprobe = pp->retprobe;
- if (pev->target)
- tev->point.module = strdup_or_goto(pev->target,
- nomem_out);
+ if (pev->target) {
+ if (pev->uprobes) {
+ tev->point.module = strdup_or_goto(pev->target,
+ nomem_out);
+ } else {
+ mod_name = find_module_name(pev->target);
+ tev->point.module =
+ strdup(mod_name ? mod_name : pev->target);
+ free(mod_name);
+ if (!tev->point.module)
+ goto nomem_out;
+ }
+ }
tev->uprobes = pev->uprobes;
tev->nargs = pev->nargs;
if (tev->nargs) {
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 27/30] perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (25 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 26/30] perf probe: Fix module probe issue if no dwarf support Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 28/30] perf bench: Remove one more die() call Arnaldo Carvalho de Melo
` (3 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Introduced in commit 4babf2c5efb7 ("x86: wire up preadv2 and pwritev2").
This will make 'perf trace' aware of them.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-vojoylgce2cetsy36446s5ny@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
index 2e5b565adacc..cac6d17ce5db 100644
--- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
@@ -333,6 +333,8 @@
324 common membarrier sys_membarrier
325 common mlock2 sys_mlock2
326 common copy_file_range sys_copy_file_range
+327 64 preadv2 sys_preadv2
+328 64 pwritev2 sys_pwritev2
#
# x32-specific system call numbers start at 512 to avoid cache impact
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 28/30] perf bench: Remove one more die() call
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (26 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 27/30] perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2 Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 29/30] perf core: Allow setting up max frame stack depth via sysctl Arnaldo Carvalho de Melo
` (2 subsequent siblings)
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
Hitoshi Mitake, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Propagate the error instead.
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
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-z6erjg35d1gekevwujoa0223@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bench/mem-functions.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index a91aa85d80ff..2b54d0f2672a 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -6,6 +6,7 @@
* Written by Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
*/
+#include "debug.h"
#include "../perf.h"
#include "../util/util.h"
#include <subcmd/parse-options.h>
@@ -63,14 +64,16 @@ static struct perf_event_attr cycle_attr = {
.config = PERF_COUNT_HW_CPU_CYCLES
};
-static void init_cycles(void)
+static int init_cycles(void)
{
cycles_fd = sys_perf_event_open(&cycle_attr, getpid(), -1, -1, perf_event_open_cloexec_flag());
- if (cycles_fd < 0 && errno == ENOSYS)
- die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
- else
- BUG_ON(cycles_fd < 0);
+ if (cycles_fd < 0 && errno == ENOSYS) {
+ pr_debug("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
+ return -1;
+ }
+
+ return cycles_fd;
}
static u64 get_cycles(void)
@@ -155,8 +158,13 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
argc = parse_options(argc, argv, options, info->usage, 0);
- if (use_cycles)
- init_cycles();
+ if (use_cycles) {
+ i = init_cycles();
+ if (i < 0) {
+ fprintf(stderr, "Failed to open cycles counter\n");
+ return i;
+ }
+ }
size = (size_t)perf_atoll((char *)size_str);
size_total = (double)size * nr_loops;
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 29/30] perf core: Allow setting up max frame stack depth via sysctl
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (27 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 28/30] perf bench: Remove one more die() call Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 30/30] perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack Arnaldo Carvalho de Melo
2016-04-27 15:03 ` [GIT PULL 00/30] perf/core improvements and fixes Ingo Molnar
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Alexander Shishkin, He Kuang, Jiri Olsa, Linus Torvalds,
Masami Hiramatsu, Milian Wolff, Namhyung Kim, Peter Zijlstra,
Stephane Eranian, Thomas Gleixner, Vince Weaver, Wang Nan,
Zefan Li
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The default remains 127, which is good for most cases, and not even hit
most of the time, but then for some cases, as reported by Brendan, 1024+
deep frames are appearing on the radar for things like groovy, ruby.
And in some workloads putting a _lower_ cap on this may make sense. One
that is per event still needs to be put in place tho.
The new file is:
# cat /proc/sys/kernel/perf_event_max_stack
127
Chaging it:
# echo 256 > /proc/sys/kernel/perf_event_max_stack
# cat /proc/sys/kernel/perf_event_max_stack
256
But as soon as there is some event using callchains we get:
# echo 512 > /proc/sys/kernel/perf_event_max_stack
-bash: echo: write error: Device or resource busy
#
Because we only allocate the callchain percpu data structures when there
is a user, which allows for changing the max easily, its just a matter
of having no callchain users at that point.
Reported-and-Tested-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/20160426002928.GB16708@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
Documentation/sysctl/kernel.txt | 14 ++++++++++++++
arch/arm/kernel/perf_callchain.c | 2 +-
arch/arm64/kernel/perf_callchain.c | 4 ++--
arch/metag/kernel/perf_callchain.c | 2 +-
arch/mips/kernel/perf_event.c | 4 ++--
arch/powerpc/perf/callchain.c | 4 ++--
arch/sparc/kernel/perf_event.c | 6 +++---
arch/x86/events/core.c | 4 ++--
arch/xtensa/kernel/perf_event.c | 4 ++--
include/linux/perf_event.h | 8 ++++++--
kernel/bpf/stackmap.c | 8 ++++----
kernel/events/callchain.c | 35 +++++++++++++++++++++++++++++++++--
kernel/sysctl.c | 12 ++++++++++++
13 files changed, 84 insertions(+), 23 deletions(-)
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 57653a44b128..260cde08e92e 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -60,6 +60,7 @@ show up in /proc/sys/kernel:
- panic_on_warn
- perf_cpu_time_max_percent
- perf_event_paranoid
+- perf_event_max_stack
- pid_max
- powersave-nap [ PPC only ]
- printk
@@ -654,6 +655,19 @@ users (without CAP_SYS_ADMIN). The default value is 1.
==============================================================
+perf_event_max_stack:
+
+Controls maximum number of stack frames to copy for (attr.sample_type &
+PERF_SAMPLE_CALLCHAIN) configured events, for instance, when using
+'perf record -g' or 'perf trace --call-graph fp'.
+
+This can only be done when no events are in use that have callchains
+enabled, otherwise writing to this file will return -EBUSY.
+
+The default value is 127.
+
+==============================================================
+
pid_max:
PID allocation wrap value. When the kernel's next PID value
diff --git a/arch/arm/kernel/perf_callchain.c b/arch/arm/kernel/perf_callchain.c
index 4e02ae5950ff..27563befa8a2 100644
--- a/arch/arm/kernel/perf_callchain.c
+++ b/arch/arm/kernel/perf_callchain.c
@@ -75,7 +75,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
tail = (struct frame_tail __user *)regs->ARM_fp - 1;
- while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
+ while ((entry->nr < sysctl_perf_event_max_stack) &&
tail && !((unsigned long)tail & 0x3))
tail = user_backtrace(tail, entry);
}
diff --git a/arch/arm64/kernel/perf_callchain.c b/arch/arm64/kernel/perf_callchain.c
index ff4665462a02..32c3c6e70119 100644
--- a/arch/arm64/kernel/perf_callchain.c
+++ b/arch/arm64/kernel/perf_callchain.c
@@ -122,7 +122,7 @@ void perf_callchain_user(struct perf_callchain_entry *entry,
tail = (struct frame_tail __user *)regs->regs[29];
- while (entry->nr < PERF_MAX_STACK_DEPTH &&
+ while (entry->nr < sysctl_perf_event_max_stack &&
tail && !((unsigned long)tail & 0xf))
tail = user_backtrace(tail, entry);
} else {
@@ -132,7 +132,7 @@ void perf_callchain_user(struct perf_callchain_entry *entry,
tail = (struct compat_frame_tail __user *)regs->compat_fp - 1;
- while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
+ while ((entry->nr < sysctl_perf_event_max_stack) &&
tail && !((unsigned long)tail & 0x3))
tail = compat_user_backtrace(tail, entry);
#endif
diff --git a/arch/metag/kernel/perf_callchain.c b/arch/metag/kernel/perf_callchain.c
index 315633461a94..252abc12a5a3 100644
--- a/arch/metag/kernel/perf_callchain.c
+++ b/arch/metag/kernel/perf_callchain.c
@@ -65,7 +65,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
--frame;
- while ((entry->nr < PERF_MAX_STACK_DEPTH) && frame)
+ while ((entry->nr < sysctl_perf_event_max_stack) && frame)
frame = user_backtrace(frame, entry);
}
diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
index c1cf9c6c3f77..5021c546ad07 100644
--- a/arch/mips/kernel/perf_event.c
+++ b/arch/mips/kernel/perf_event.c
@@ -35,7 +35,7 @@ static void save_raw_perf_callchain(struct perf_callchain_entry *entry,
addr = *sp++;
if (__kernel_text_address(addr)) {
perf_callchain_store(entry, addr);
- if (entry->nr >= PERF_MAX_STACK_DEPTH)
+ if (entry->nr >= sysctl_perf_event_max_stack)
break;
}
}
@@ -59,7 +59,7 @@ void perf_callchain_kernel(struct perf_callchain_entry *entry,
}
do {
perf_callchain_store(entry, pc);
- if (entry->nr >= PERF_MAX_STACK_DEPTH)
+ if (entry->nr >= sysctl_perf_event_max_stack)
break;
pc = unwind_stack(current, &sp, pc, &ra);
} while (pc);
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index e04a6752b399..22d9015c1acc 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -247,7 +247,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
sp = regs->gpr[1];
perf_callchain_store(entry, next_ip);
- while (entry->nr < PERF_MAX_STACK_DEPTH) {
+ while (entry->nr < sysctl_perf_event_max_stack) {
fp = (unsigned long __user *) sp;
if (!valid_user_sp(sp, 1) || read_user_stack_64(fp, &next_sp))
return;
@@ -453,7 +453,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
sp = regs->gpr[1];
perf_callchain_store(entry, next_ip);
- while (entry->nr < PERF_MAX_STACK_DEPTH) {
+ while (entry->nr < sysctl_perf_event_max_stack) {
fp = (unsigned int __user *) (unsigned long) sp;
if (!valid_user_sp(sp, 0) || read_user_stack_32(fp, &next_sp))
return;
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 6596f66ce112..a4b8b5aed21c 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1756,7 +1756,7 @@ void perf_callchain_kernel(struct perf_callchain_entry *entry,
}
}
#endif
- } while (entry->nr < PERF_MAX_STACK_DEPTH);
+ } while (entry->nr < sysctl_perf_event_max_stack);
}
static inline int
@@ -1790,7 +1790,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
pc = sf.callers_pc;
ufp = (unsigned long)sf.fp + STACK_BIAS;
perf_callchain_store(entry, pc);
- } while (entry->nr < PERF_MAX_STACK_DEPTH);
+ } while (entry->nr < sysctl_perf_event_max_stack);
}
static void perf_callchain_user_32(struct perf_callchain_entry *entry,
@@ -1822,7 +1822,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
ufp = (unsigned long)sf.fp;
}
perf_callchain_store(entry, pc);
- } while (entry->nr < PERF_MAX_STACK_DEPTH);
+ } while (entry->nr < sysctl_perf_event_max_stack);
}
void
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 041e442a3e28..41d93d0e972b 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -2277,7 +2277,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
fp = compat_ptr(ss_base + regs->bp);
pagefault_disable();
- while (entry->nr < PERF_MAX_STACK_DEPTH) {
+ while (entry->nr < sysctl_perf_event_max_stack) {
unsigned long bytes;
frame.next_frame = 0;
frame.return_address = 0;
@@ -2337,7 +2337,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
return;
pagefault_disable();
- while (entry->nr < PERF_MAX_STACK_DEPTH) {
+ while (entry->nr < sysctl_perf_event_max_stack) {
unsigned long bytes;
frame.next_frame = NULL;
frame.return_address = 0;
diff --git a/arch/xtensa/kernel/perf_event.c b/arch/xtensa/kernel/perf_event.c
index 54f01188c29c..a6b00b3af429 100644
--- a/arch/xtensa/kernel/perf_event.c
+++ b/arch/xtensa/kernel/perf_event.c
@@ -332,14 +332,14 @@ static int callchain_trace(struct stackframe *frame, void *data)
void perf_callchain_kernel(struct perf_callchain_entry *entry,
struct pt_regs *regs)
{
- xtensa_backtrace_kernel(regs, PERF_MAX_STACK_DEPTH,
+ xtensa_backtrace_kernel(regs, sysctl_perf_event_max_stack,
callchain_trace, NULL, entry);
}
void perf_callchain_user(struct perf_callchain_entry *entry,
struct pt_regs *regs)
{
- xtensa_backtrace_user(regs, PERF_MAX_STACK_DEPTH,
+ xtensa_backtrace_user(regs, sysctl_perf_event_max_stack,
callchain_trace, entry);
}
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 85749ae8cb5f..a090700cccca 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -58,7 +58,7 @@ struct perf_guest_info_callbacks {
struct perf_callchain_entry {
__u64 nr;
- __u64 ip[PERF_MAX_STACK_DEPTH];
+ __u64 ip[0]; /* /proc/sys/kernel/perf_event_max_stack */
};
struct perf_raw_record {
@@ -993,9 +993,11 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
extern int get_callchain_buffers(void);
extern void put_callchain_buffers(void);
+extern int sysctl_perf_event_max_stack;
+
static inline int perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
{
- if (entry->nr < PERF_MAX_STACK_DEPTH) {
+ if (entry->nr < sysctl_perf_event_max_stack) {
entry->ip[entry->nr++] = ip;
return 0;
} else {
@@ -1017,6 +1019,8 @@ extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
+int perf_event_max_stack_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos);
static inline bool perf_paranoid_tracepoint_raw(void)
{
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 499d9e933f8e..f5a19548be12 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -66,7 +66,7 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
/* check sanity of attributes */
if (attr->max_entries == 0 || attr->key_size != 4 ||
value_size < 8 || value_size % 8 ||
- value_size / 8 > PERF_MAX_STACK_DEPTH)
+ value_size / 8 > sysctl_perf_event_max_stack)
return ERR_PTR(-EINVAL);
/* hash table size must be power of 2 */
@@ -124,8 +124,8 @@ static u64 bpf_get_stackid(u64 r1, u64 r2, u64 flags, u64 r4, u64 r5)
struct perf_callchain_entry *trace;
struct stack_map_bucket *bucket, *new_bucket, *old_bucket;
u32 max_depth = map->value_size / 8;
- /* stack_map_alloc() checks that max_depth <= PERF_MAX_STACK_DEPTH */
- u32 init_nr = PERF_MAX_STACK_DEPTH - max_depth;
+ /* stack_map_alloc() checks that max_depth <= sysctl_perf_event_max_stack */
+ u32 init_nr = sysctl_perf_event_max_stack - max_depth;
u32 skip = flags & BPF_F_SKIP_FIELD_MASK;
u32 hash, id, trace_nr, trace_len;
bool user = flags & BPF_F_USER_STACK;
@@ -143,7 +143,7 @@ static u64 bpf_get_stackid(u64 r1, u64 r2, u64 flags, u64 r4, u64 r5)
return -EFAULT;
/* get_perf_callchain() guarantees that trace->nr >= init_nr
- * and trace-nr <= PERF_MAX_STACK_DEPTH, so trace_nr <= max_depth
+ * and trace-nr <= sysctl_perf_event_max_stack, so trace_nr <= max_depth
*/
trace_nr = trace->nr - init_nr;
diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c
index 343c22f5e867..b9325e7dcba1 100644
--- a/kernel/events/callchain.c
+++ b/kernel/events/callchain.c
@@ -18,6 +18,14 @@ struct callchain_cpus_entries {
struct perf_callchain_entry *cpu_entries[0];
};
+int sysctl_perf_event_max_stack __read_mostly = PERF_MAX_STACK_DEPTH;
+
+static inline size_t perf_callchain_entry__sizeof(void)
+{
+ return (sizeof(struct perf_callchain_entry) +
+ sizeof(__u64) * sysctl_perf_event_max_stack);
+}
+
static DEFINE_PER_CPU(int, callchain_recursion[PERF_NR_CONTEXTS]);
static atomic_t nr_callchain_events;
static DEFINE_MUTEX(callchain_mutex);
@@ -73,7 +81,7 @@ static int alloc_callchain_buffers(void)
if (!entries)
return -ENOMEM;
- size = sizeof(struct perf_callchain_entry) * PERF_NR_CONTEXTS;
+ size = perf_callchain_entry__sizeof() * PERF_NR_CONTEXTS;
for_each_possible_cpu(cpu) {
entries->cpu_entries[cpu] = kmalloc_node(size, GFP_KERNEL,
@@ -147,7 +155,8 @@ static struct perf_callchain_entry *get_callchain_entry(int *rctx)
cpu = smp_processor_id();
- return &entries->cpu_entries[cpu][*rctx];
+ return (((void *)entries->cpu_entries[cpu]) +
+ (*rctx * perf_callchain_entry__sizeof()));
}
static void
@@ -215,3 +224,25 @@ exit_put:
return entry;
}
+
+int perf_event_max_stack_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ int new_value = sysctl_perf_event_max_stack, ret;
+ struct ctl_table new_table = *table;
+
+ new_table.data = &new_value;
+ ret = proc_dointvec_minmax(&new_table, write, buffer, lenp, ppos);
+ if (ret || !write)
+ return ret;
+
+ mutex_lock(&callchain_mutex);
+ if (atomic_read(&nr_callchain_events))
+ ret = -EBUSY;
+ else
+ sysctl_perf_event_max_stack = new_value;
+
+ mutex_unlock(&callchain_mutex);
+
+ return ret;
+}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 725587f10667..c8b318663525 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -130,6 +130,9 @@ static int one_thousand = 1000;
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
+#ifdef CONFIG_PERF_EVENTS
+static int six_hundred_forty_kb = 640 * 1024;
+#endif
/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
@@ -1144,6 +1147,15 @@ static struct ctl_table kern_table[] = {
.extra1 = &zero,
.extra2 = &one_hundred,
},
+ {
+ .procname = "perf_event_max_stack",
+ .data = NULL, /* filled in by handler */
+ .maxlen = sizeof(sysctl_perf_event_max_stack),
+ .mode = 0644,
+ .proc_handler = perf_event_max_stack_handler,
+ .extra1 = &zero,
+ .extra2 = &six_hundred_forty_kb,
+ },
#endif
#ifdef CONFIG_KMEMCHECK
{
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 30/30] perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (28 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 29/30] perf core: Allow setting up max frame stack depth via sysctl Arnaldo Carvalho de Melo
@ 2016-04-27 14:31 ` Arnaldo Carvalho de Melo
2016-04-27 15:03 ` [GIT PULL 00/30] perf/core improvements and fixes Ingo Molnar
30 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-27 14:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Brendan Gregg, David Ahern, Frederic Weisbecker, Jiri Olsa,
Milian Wolff, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
There is an upper limit to what tooling considers a valid callchain,
and it was tied to the hardcoded value in the kernel,
PERF_MAX_STACK_DEPTH (127), now that this can be tuned via a sysctl,
make it read it and use that as the upper limit, falling back to
PERF_MAX_STACK_DEPTH for kernels where this sysctl isn't present.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-yjqsd30nnkogvj5oyx9ghir9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 2 +-
tools/perf/Documentation/perf-script.txt | 2 +-
tools/perf/Documentation/perf-top.txt | 2 +-
tools/perf/Documentation/perf-trace.txt | 2 +-
tools/perf/builtin-report.c | 4 ++--
tools/perf/builtin-script.c | 4 +++-
tools/perf/builtin-top.c | 4 ++--
tools/perf/builtin-trace.c | 4 ++--
tools/perf/perf.c | 5 +++++
tools/perf/tests/hists_cumulate.c | 2 +-
tools/perf/tests/hists_filter.c | 2 +-
tools/perf/tests/hists_output.c | 2 +-
tools/perf/util/machine.c | 6 +++---
tools/perf/util/scripting-engines/trace-event-perl.c | 2 +-
tools/perf/util/util.c | 2 ++
tools/perf/util/util.h | 1 +
16 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 496d42cdf02b..ebaf849e30ef 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -248,7 +248,7 @@ OPTIONS
Note that when using the --itrace option the synthesized callchain size
will override this value if the synthesized callchain size is bigger.
- Default: 127
+ Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
-G::
--inverted::
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index 4fc44c75263f..a856a1095893 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -267,7 +267,7 @@ include::itrace.txt[]
Note that when using the --itrace option the synthesized callchain size
will override this value if the synthesized callchain size is bigger.
- Default: 127
+ Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
--ns::
Use 9 decimal places when displaying time (i.e. show the nanoseconds)
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index 19f046f027cd..91d638df3a6b 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -177,7 +177,7 @@ Default is to monitor all CPUS.
between information loss and faster processing especially for
workloads that can have a very long callchain stack.
- Default: 127
+ Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
--ignore-callees=<regex>::
Ignore callees of the function(s) matching the given regex.
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
index c075c002eaa4..6afe20121bc0 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -143,7 +143,7 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
Implies '--call-graph dwarf' when --call-graph not present on the
command line, on systems where DWARF unwinding was built in.
- Default: 127
+ Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
--min-stack::
Set the stack depth limit when parsing the callchain, anything
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1d5be0bd426f..8d9b88af901d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -691,7 +691,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
.ordered_events = true,
.ordering_requires_timestamps = true,
},
- .max_stack = PERF_MAX_STACK_DEPTH,
+ .max_stack = sysctl_perf_event_max_stack,
.pretty_printing_style = "normal",
.socket_filter = -1,
};
@@ -744,7 +744,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_INTEGER(0, "max-stack", &report.max_stack,
"Set the maximum stack depth when parsing the callchain, "
"anything beyond the specified depth will be ignored. "
- "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
+ "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
OPT_BOOLEAN('G', "inverted", &report.inverted_callchain,
"alias for inverted call graph"),
OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f43b0c6f88f4..efca81679bb3 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2031,7 +2031,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_UINTEGER(0, "max-stack", &scripting_max_stack,
"Set the maximum stack depth when parsing the callchain, "
"anything beyond the specified depth will be ignored. "
- "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
+ "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
OPT_BOOLEAN('I', "show-info", &show_full_info,
"display extended information from perf.data file"),
OPT_BOOLEAN('\0', "show-kernel-path", &symbol_conf.show_kernel_path,
@@ -2067,6 +2067,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
NULL
};
+ scripting_max_stack = sysctl_perf_event_max_stack;
+
setup_scripting();
argc = parse_options_subcommand(argc, argv, options, script_subcommands, script_usage,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c130a11d3a0d..da18517b1d40 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1103,7 +1103,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
},
.proc_map_timeout = 500,
},
- .max_stack = PERF_MAX_STACK_DEPTH,
+ .max_stack = sysctl_perf_event_max_stack,
.sym_pcnt_filter = 5,
};
struct record_opts *opts = &top.record_opts;
@@ -1171,7 +1171,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
"Accumulate callchains of children and show total overhead as well"),
OPT_INTEGER(0, "max-stack", &top.max_stack,
"Set the maximum stack depth when parsing the callchain. "
- "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
+ "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
"ignore callees of these functions in call graphs",
report_parse_ignore_callees_opt),
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 48b00f042599..f4f3389c92c7 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -3106,7 +3106,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_UINTEGER(0, "max-stack", &trace.max_stack,
"Set the maximum stack depth when parsing the callchain, "
"anything beyond the specified depth will be ignored. "
- "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
+ "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout,
"per thread proc mmap processing timeout in ms"),
OPT_END()
@@ -3150,7 +3150,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
mmap_pages_user_set = false;
if (trace.max_stack == UINT_MAX) {
- trace.max_stack = PERF_MAX_STACK_DEPTH;
+ trace.max_stack = sysctl_perf_event_max_stack;
max_stack_user_set = false;
}
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 7b2df2b46525..83ffe7cd7330 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -17,6 +17,7 @@
#include <subcmd/parse-options.h>
#include "util/bpf-loader.h"
#include "util/debug.h"
+#include <api/fs/fs.h>
#include <api/fs/tracing_path.h>
#include <pthread.h>
#include <stdlib.h>
@@ -533,6 +534,7 @@ int main(int argc, const char **argv)
{
const char *cmd;
char sbuf[STRERR_BUFSIZE];
+ int value;
/* libsubcmd init */
exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT);
@@ -542,6 +544,9 @@ int main(int argc, const char **argv)
page_size = sysconf(_SC_PAGE_SIZE);
cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
+ if (sysctl__read_int("kernel/perf_event_max_stack", &value) == 0)
+ sysctl_perf_event_max_stack = value;
+
cmd = extract_argv0_path(argv[0]);
if (!cmd)
cmd = "perf-help";
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index ed5aa9eaeb6c..4a2bbff9b1ee 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -101,7 +101,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
if (machine__resolve(machine, &al, &sample) < 0)
goto out;
- if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
+ if (hist_entry_iter__add(&iter, &al, sysctl_perf_event_max_stack,
NULL) < 0) {
addr_location__put(&al);
goto out;
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index b825d24f8186..e846f8c42013 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -81,7 +81,7 @@ static int add_hist_entries(struct perf_evlist *evlist,
al.socket = fake_samples[i].socket;
if (hist_entry_iter__add(&iter, &al,
- PERF_MAX_STACK_DEPTH, NULL) < 0) {
+ sysctl_perf_event_max_stack, NULL) < 0) {
addr_location__put(&al);
goto out;
}
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index d3556fbe8c5c..7cd8738e842f 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -67,7 +67,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
if (machine__resolve(machine, &al, &sample) < 0)
goto out;
- if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
+ if (hist_entry_iter__add(&iter, &al, sysctl_perf_event_max_stack,
NULL) < 0) {
addr_location__put(&al);
goto out;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 656c1d7ee7d4..2cb95bbf9ea6 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1764,7 +1764,7 @@ static int resolve_lbr_callchain_sample(struct thread *thread,
*/
int mix_chain_nr = i + 1 + lbr_nr + 1;
- if (mix_chain_nr > PERF_MAX_STACK_DEPTH + PERF_MAX_BRANCH_DEPTH) {
+ if (mix_chain_nr > (int)sysctl_perf_event_max_stack + PERF_MAX_BRANCH_DEPTH) {
pr_warning("corrupted callchain. skipping...\n");
return 0;
}
@@ -1825,7 +1825,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
* Based on DWARF debug information, some architectures skip
* a callchain entry saved by the kernel.
*/
- if (chain->nr < PERF_MAX_STACK_DEPTH)
+ if (chain->nr < sysctl_perf_event_max_stack)
skip_idx = arch_skip_callchain_idx(thread, chain);
/*
@@ -1886,7 +1886,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
}
check_calls:
- if (chain->nr > PERF_MAX_STACK_DEPTH && (int)chain->nr > max_stack) {
+ if (chain->nr > sysctl_perf_event_max_stack && (int)chain->nr > max_stack) {
pr_warning("corrupted callchain. skipping...\n");
return 0;
}
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index ae1cebc307c5..62c7f6988e0e 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -265,7 +265,7 @@ static SV *perl_process_callchain(struct perf_sample *sample,
if (thread__resolve_callchain(al->thread, &callchain_cursor, evsel,
sample, NULL, NULL,
- PERF_MAX_STACK_DEPTH) != 0) {
+ sysctl_perf_event_max_stack) != 0) {
pr_err("Failed to resolve callchain. Skipping\n");
goto exit;
}
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 9473d46c00bb..619ba2061b62 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -33,6 +33,8 @@ struct callchain_param callchain_param = {
unsigned int page_size;
int cacheline_size;
+unsigned int sysctl_perf_event_max_stack = PERF_MAX_STACK_DEPTH;
+
bool test_attr__enabled;
bool perf_host = true;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 26a924651e7b..88f607af1f47 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -267,6 +267,7 @@ void sighandler_dump_stack(int sig);
extern unsigned int page_size;
extern int cacheline_size;
+extern unsigned int sysctl_perf_event_max_stack;
struct parse_tag {
char tag;
--
2.5.5
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (29 preceding siblings ...)
2016-04-27 14:31 ` [PATCH 30/30] perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack Arnaldo Carvalho de Melo
@ 2016-04-27 15:03 ` Ingo Molnar
30 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2016-04-27 15:03 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Alexander Shishkin, Alexei Starovoitov,
Ananth N Mavinakayanahalli, Andi Kleen, Andrey Ryabinin,
Borislav Petkov, Brendan Gregg, Chris Phlipot, Colin Ian King,
David Ahern, Davidlohr Bueso, Eric Engestrom, Frederic Weisbecker,
He Kuang, Hemant Kumar, Hitoshi Mitake, Jiri Olsa, Kan Liang,
Linus Torvalds, Masami Hiramatsu, Milian Wolff, Namhyung Kim,
Naveen N . Rao, Peter Zijlstra, pi3orama, Ravi Bangoria,
Srikar Dronamraju, Stephane Eranian, Thomas Gleixner, TJ,
Vince Weaver, Wang Nan, Zefan Li
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit 67d61296ffcc850bffdd4466430cb91e5328f39a:
>
> Merge tag 'perf-core-for-mingo-20160419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux (2016-04-23 14:50:39 +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-20160427
>
> for you to fetch changes up to 4cb93446c587d56e2a54f4f83113daba2c0b6dee:
>
> perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack (2016-04-27 10:29:07 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> - perf trace --pf maj/min/all works with --call-graph: (Arnaldo Carvalho de Melo)
>
> Tracing write syscalls and major page faults with callchains while starting
> firefox, limiting the stack to 5 frames:
>
> # perf trace -e write --pf maj --max-stack 5 firefox
> 589.549 ( 0.014 ms): firefox/15377 write(fd: 4, buf: 0x7fff80acc898, count: 151) = 151
> [0xfaed] (/usr/lib64/libpthread-2.22.so)
> fire_glxtest_process+0x5c (/usr/lib64/firefox/libxul.so)
> InstallGdkErrorHandler+0x41 (/usr/lib64/firefox/libxul.so)
> XREMain::XRE_mainInit+0x12c (/usr/lib64/firefox/libxul.so)
> XREMain::XRE_main+0x1e4 (/usr/lib64/firefox/libxul.so)
> 760.704 ( 0.000 ms): firefox/15332 majfault [gtk_tree_view_accessible_get_type+0x0] => /usr/lib64/libgtk-3.so.0.1800.9@0xa0850 (x.)
> gtk_tree_view_accessible_get_type+0x0 (/usr/lib64/libgtk-3.so.0.1800.9)
> gtk_tree_view_class_intern_init+0x1a54 (/usr/lib64/libgtk-3.so.0.1800.9)
> g_type_class_ref+0x6dd (/usr/lib64/libgobject-2.0.so.0.4600.2)
> [0x115378] (/usr/lib64/libgnutls.so.30.6.3)
>
> This automagically selects "--call-graph dwarf", use "--call-graph fp" on systems
> where -fno-omit-frame-pointer was used to built the components of interest, to
> incur in less overhead, or tune "--call-graph dwarf" appropriately, see 'perf record --help'.
>
> - Allow /proc/sys/kernel/perf_event_max_stack, that defaults to the old hard coded value
> of PERF_MAX_STACK_DEPTH (127), useful for huge callstacks for things like Groovy, Ruby, etc,
> and also to reduce overhead by limiting it to a smaller value, upcoming work will allow
> this to be done per-event (Arnaldo Carvalho de Melo)
>
> - Make 'perf trace --min-stack' be honoured by --pf and --event (Arnaldo Carvalho de Melo)
>
> - Make 'perf evlist -v' decode perf_event_attr->branch_sample_type (Arnaldo Carvalho de Melo)
>
> # perf record --call lbr usleep 1
> # perf evlist -v
> cycles:ppp: ... sample_type: IP|TID|TIME|CALLCHAIN|PERIOD|BRANCH_STACK, ...
> branch_sample_type: USER|CALL_STACK|NO_FLAGS|NO_CYCLES
> #
>
> - Clear dummy entry accumulated period, fixing such 'perf top/report' output
> as: (Kan Liang)
>
> 4769.98% 0.01% 0.00% 0.01% tchain_edit [kernel] [k] update_fast_timekeeper
>
> - System calls with pid_t arguments gets them augmented with the COMM event
> more thoroughly:
>
> # trace -e perf_event_open perf stat -e cycles -p 15608
> 6.876 ( 0.014 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15608 (hexchat), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
> 6.882 ( 0.005 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15639 (gmain), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 4
> 6.889 ( 0.005 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15640 (gdbus), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
> ^^^^^^^^^^^^^^^^^^
> ^C
>
> - Fix offline module name mismatch issue in 'perf probe' (Ravi Bangoria)
>
> - Fix module probe issue if no dwarf support in (Ravi Bangoria)
>
> Assorted fixes:
>
> - Fix off-by-one in write_buildid() (Andrey Ryabinin)
>
> - Fix segfault when printing callchains in 'perf script' (Chris Phlipot)
>
> - Replace assignment with comparison on assert check in 'perf test' entry (Colin Ian King)
>
> - Fix off-by-one comparison in intel-pt code (Colin Ian King)
>
> - Close target file on error path in 'perf probe' (Masami Hiramatsu)
>
> - Set default kprobe group name if not given in 'perf probe' (Masami Hiramatsu)
>
> - Avoid partial perf_event_header reads (Wang Nan)
>
> Infrastructure:
>
> - Update x86's syscall_64.tbl copy, adding preadv2 & pwritev2 (Arnaldo Carvalho de Melo)
>
> - Make the x86 clean quiet wrt syscall table removal (Jiri Olsa)
>
> Cleanups:
>
> - Simplify wrapper for LOCK_PI in 'perf bench futex' (Davidlohr Bueso)
>
> - Remove duplicate const qualifier (Eric Engestrom)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Andrey Ryabinin (1):
> perf buildid: Fix off-by-one in write_buildid()
>
> Arnaldo Carvalho de Melo (14):
> perf trace: Extract evsel contructor from perf_evlist__add_pgfault
> perf trace: Make --pf maj/min/all use callchains too
> perf trace: Make --event honour --min-stack too
> perf trace: Make --pf honour --min-stack too
> perf evlist: Decode perf_event_attr->branch_sample_type
> perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/
> perf trace: Do not beautify the 'pid' parameter as a simple integer
> tools lib api fs: Add helper to read string from procfs file
> perf thread: Introduce method to set comm from /proc/pid/self
> perf trace: Read thread's COMM from /proc when not set
> perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2
> perf bench: Remove one more die() call
> perf core: Allow setting up max frame stack depth via sysctl
> perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack
>
> Chris Phlipot (1):
> perf script: Fix segfault when printing callchains
>
> Colin Ian King (2):
> perf tests: Replace assignment with comparison on assert check
> perf intel-pt: Fix off-by-one comparison on maximum code
>
> Davidlohr Bueso (1):
> perf bench futex: Simplify wrapper for LOCK_PI
>
> Eric Engestrom (1):
> perf tools: Remove duplicate const qualifier
>
> Jiri Olsa (2):
> perf tools: Make the x86 clean quiet
> tools build: Fix perf_clean target
>
> Kan Liang (1):
> perf hists: Clear dummy entry accumulated period
>
> Masami Hiramatsu (4):
> perf probe: Close target file on error path
> perf tools: Add lsdir() helper to read a directory
> perf probe: Let probe_file__add_event return 0 if succeeded
> perf probe: Set default kprobe group name if it is not given
>
> Ravi Bangoria (2):
> perf probe: Fix offline module name missmatch issue
> perf probe: Fix module probe issue if no dwarf support
>
> Wang Nan (1):
> perf evlist: Enforce ring buffer reading
>
> Documentation/sysctl/kernel.txt | 14 ++
> arch/arm/kernel/perf_callchain.c | 2 +-
> arch/arm64/kernel/perf_callchain.c | 4 +-
> arch/metag/kernel/perf_callchain.c | 2 +-
> arch/mips/kernel/perf_event.c | 4 +-
> arch/powerpc/perf/callchain.c | 4 +-
> arch/sparc/kernel/perf_event.c | 6 +-
> arch/x86/events/core.c | 4 +-
> arch/xtensa/kernel/perf_event.c | 4 +-
> include/linux/perf_event.h | 8 +-
> kernel/bpf/stackmap.c | 8 +-
> kernel/events/callchain.c | 35 ++++-
> kernel/sysctl.c | 12 ++
> tools/Makefile | 3 +-
> tools/lib/api/fs/fs.c | 13 ++
> tools/lib/api/fs/fs.h | 2 +
> tools/perf/Documentation/perf-report.txt | 2 +-
> tools/perf/Documentation/perf-script.txt | 2 +-
> tools/perf/Documentation/perf-top.txt | 2 +-
> tools/perf/Documentation/perf-trace.txt | 2 +-
> tools/perf/arch/x86/Makefile | 2 +-
> tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 2 +
> tools/perf/bench/futex-lock-pi.c | 2 +-
> tools/perf/bench/futex.h | 6 +-
> tools/perf/bench/mem-functions.c | 22 ++-
> tools/perf/builtin-report.c | 4 +-
> tools/perf/builtin-script.c | 16 +-
> tools/perf/builtin-top.c | 4 +-
> tools/perf/builtin-trace.c | 174 +++++++++++----------
> tools/perf/perf.c | 5 +
> tools/perf/tests/event_update.c | 2 +-
> tools/perf/tests/hists_cumulate.c | 2 +-
> tools/perf/tests/hists_filter.c | 2 +-
> tools/perf/tests/hists_output.c | 2 +-
> tools/perf/trace/beauty/perf_event_open.c | 43 +++++
> tools/perf/trace/beauty/pid.c | 5 +-
> tools/perf/util/build-id.c | 6 +-
> tools/perf/util/evlist.c | 12 +-
> tools/perf/util/evsel.c | 18 ++-
> tools/perf/util/hist.c | 2 +
> .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +-
> tools/perf/util/machine.c | 6 +-
> tools/perf/util/probe-event.c | 114 +++++++++++---
> tools/perf/util/probe-file.c | 3 +-
> .../perf/util/scripting-engines/trace-event-perl.c | 2 +-
> tools/perf/util/thread.c | 21 ++-
> tools/perf/util/thread.h | 2 +
> tools/perf/util/util.c | 36 +++++
> tools/perf/util/util.h | 4 +
> 49 files changed, 475 insertions(+), 179 deletions(-)
> create mode 100644 tools/perf/trace/beauty/perf_event_open.c
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 44+ messages in thread
* [GIT PULL 00/30] perf/core improvements and fixes
@ 2017-06-30 22:24 Arnaldo Carvalho de Melo
2017-07-01 8:41 ` Ingo Molnar
0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-30 22:24 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Alexander Shishkin, Andi Kleen, Colin King, Dan Carpenter,
David Ahern, Hendrik Brueckner, Jiri Olsa, linux-s390,
Masami Hiramatsu, Namhyung Kim, Peter Zijlstra, Stephane Eranian,
Thomas Richter, Wang Nan, Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 8e70e8409102a37ab066bd91007b75fd5d113931:
Merge tag 'perf-core-for-mingo-4.13-20170621' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-06-21 20:11:53 +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.13-20170630
for you to fetch changes up to 644e0840ad4615e032d67adec6ee60f821b669fe:
perf auxtrace: Add CPU filter support (2017-06-30 11:50:55 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
Intel PT:
- Support "ptwrite" instructio, a way to stuff 32 or 64 bit values into
the Intel PT trace (Adrian Hunter)
- Support power events in Intel PT to report changes to C-state (Adrian
Hunter)
- Synthesize Intel PT events as PERF_RECORD_SAMPLE records with a
perf_event_attr.type (PERF_TYPE_SYNTH) just after the range used by the
kernel, i.e. right after what is allocated for PMUs, at INT_MAX + 1U,
attr.config will have the identification for the synthesized event and
the PERF_SAMPLE_RAW payload will have its fields (Adrian Hunter)
Infrastructure:
- Remove warning() and error(), using instead pr_warning() and
pr_error(), consolidating error reporting (Arnaldo Carvalho de Melo)
- Add platform dependency to 'perf test 15' (Thomas Richter)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Adrian Hunter (19):
x86/insn: perf tools: Add new ptwrite instruction
perf script: Add 'synth' event type for synthesized events
tools include: Add byte-swapping macros to kernel.h
perf auxtrace: Add itrace option to output ptwrite events
perf auxtrace: Add itrace option to output power events
perf script: Add 'synth' field for synthesized event payloads
perf script: Add synthesized Intel PT power and ptwrite events
perf intel-pt: Factor out common code synthesizing event samples
perf intel-pt: Remove unused instructions_sample_period
perf intel-pt: Join needlessly wrapped lines
perf intel-pt: Tidy Intel PT evsel lookup into separate function
perf intel-pt: Tidy messages into called function intel_pt_synth_event()
perf intel-pt: Factor out intel_pt_set_event_name()
perf intel-pt: Move code in intel_pt_synth_events() to simplify attr setting
perf intel-pt: Synthesize new power and "ptwrite" events
perf intel-pt: Add example script for power events and PTWRITE
perf intel-pt: Update documentation to include new ptwrite and power events
perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC
perf auxtrace: Add CPU filter support
Arnaldo Carvalho de Melo (9):
perf help: Introduce exec_failed() to avoid code duplication
perf help: Elliminate dup code for reporting
perf help: Use pr_warning()
perf config: Use pr_warning()
perf event-parse: Use pr_warning()
perf tools: Remove warning()
perf tools: Replace error() with pr_err()
perf config: Do not die when parsing u64 or int config values
perf tools: Kill die()
Colin Ian King (1):
perf jit: fix typo: "incalid" -> "invalid"
Thomas Richter (1):
perf tests: Add platform dependency to test 15
arch/x86/lib/x86-opcode-map.txt | 2 +-
tools/include/linux/kernel.h | 35 +-
tools/objtool/arch/x86/insn/x86-opcode-map.txt | 2 +-
tools/perf/Documentation/intel-pt.txt | 42 +-
tools/perf/Documentation/itrace.txt | 8 +-
tools/perf/Documentation/perf-script.txt | 6 +-
tools/perf/arch/x86/tests/insn-x86-dat-32.c | 12 +
tools/perf/arch/x86/tests/insn-x86-dat-64.c | 30 +
tools/perf/arch/x86/tests/insn-x86-dat-src.c | 30 +
tools/perf/builtin-c2c.c | 4 +-
tools/perf/builtin-diff.c | 5 +-
tools/perf/builtin-help.c | 48 +-
tools/perf/builtin-kmem.c | 4 +-
tools/perf/builtin-record.c | 4 +-
tools/perf/builtin-report.c | 8 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/builtin-script.c | 205 ++++++-
tools/perf/builtin-stat.c | 4 +-
tools/perf/builtin-top.c | 2 +-
tools/perf/jvmti/jvmti_agent.c | 2 +-
.../perf/scripts/python/bin/intel-pt-events-record | 13 +
.../perf/scripts/python/bin/intel-pt-events-report | 3 +
tools/perf/scripts/python/intel-pt-events.py | 128 +++++
tools/perf/tests/attr.c | 10 +-
tools/perf/tests/attr.py | 48 ++
tools/perf/tests/parse-events.c | 13 -
tools/perf/util/auxtrace.c | 18 +
tools/perf/util/auxtrace.h | 6 +
tools/perf/util/config.c | 43 +-
tools/perf/util/config.h | 4 +-
tools/perf/util/data-convert-bt.c | 6 +-
tools/perf/util/event.h | 121 ++++
tools/perf/util/help-unknown-cmd.c | 2 +-
.../perf/util/intel-pt-decoder/intel-pt-decoder.c | 14 +
.../perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +-
tools/perf/util/intel-pt.c | 623 +++++++++++++++------
tools/perf/util/sort.c | 22 +-
tools/perf/util/trace-event-parse.c | 4 +-
tools/perf/util/usage.c | 58 --
tools/perf/util/util.h | 4 -
40 files changed, 1228 insertions(+), 369 deletions(-)
create mode 100644 tools/perf/scripts/python/bin/intel-pt-events-record
create mode 100644 tools/perf/scripts/python/bin/intel-pt-events-report
create mode 100644 tools/perf/scripts/python/intel-pt-events.py
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.
# 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:rawhide: Ok
26 mageia:5: Ok
27 opensuse:13.2: Ok
28 opensuse:42.1: Ok
29 opensuse:tumbleweed: Ok
30 ubuntu:12.04.5: Ok
31 ubuntu:14.04.4: Ok
32 ubuntu:14.04.4-x-linaro-arm64: Ok
33 ubuntu:15.10: Ok
34 ubuntu:16.04: Ok
35 ubuntu:16.04-x-arm: Ok
36 ubuntu:16.04-x-arm64: Ok
37 ubuntu:16.04-x-powerpc: Ok
38 ubuntu:16.04-x-powerpc64: Ok
39 ubuntu:16.04-x-powerpc64el: Ok
40 ubuntu:16.04-x-s390: Ok
41 ubuntu:16.10: Ok
42 ubuntu:17.04: Ok
43 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_no_newt_O: make NO_NEWT=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_perf_o_O: make perf.o
make_no_libbpf_O: make NO_LIBBPF=1
make_util_map_o_O: make util/map.o
make_clean_all_O: make clean all
make_no_backtrace_O: make NO_BACKTRACE=1
make_install_O: make install
make_debug_O: make DEBUG=1
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_static_O: make LDFLAGS=-static
make_tags_O: make tags
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_with_babeltrace_O: make LIBBABELTRACE=1
make_no_gtk2_O: make NO_GTK2=1
make_help_O: make help
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_libelf_O: make NO_LIBELF=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_libperl_O: make NO_LIBPERL=1
make_no_demangle_O: make NO_DEMANGLE=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_pure_O: make
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_doc_O: make doc
make_install_bin_O: make install-bin
make_no_libunwind_O: make NO_LIBUNWIND=1
make_install_prefix_O: make install prefix=/tmp/krava
make_no_slang_O: make NO_SLANG=1
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'
$
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [GIT PULL 00/30] perf/core improvements and fixes
2017-06-30 22:24 Arnaldo Carvalho de Melo
@ 2017-07-01 8:41 ` Ingo Molnar
0 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2017-07-01 8:41 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, Alexander Shishkin, Andi Kleen,
Colin King, Dan Carpenter, David Ahern, Hendrik Brueckner,
Jiri Olsa, linux-s390, Masami Hiramatsu, Namhyung Kim,
Peter Zijlstra, Stephane Eranian, Thomas Richter, Wang Nan,
Arnaldo Carvalho de Melo
* 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 8e70e8409102a37ab066bd91007b75fd5d113931:
>
> Merge tag 'perf-core-for-mingo-4.13-20170621' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-06-21 20:11:53 +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.13-20170630
>
> for you to fetch changes up to 644e0840ad4615e032d67adec6ee60f821b669fe:
>
> perf auxtrace: Add CPU filter support (2017-06-30 11:50:55 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> Intel PT:
>
> - Support "ptwrite" instructio, a way to stuff 32 or 64 bit values into
> the Intel PT trace (Adrian Hunter)
>
> - Support power events in Intel PT to report changes to C-state (Adrian
> Hunter)
>
> - Synthesize Intel PT events as PERF_RECORD_SAMPLE records with a
> perf_event_attr.type (PERF_TYPE_SYNTH) just after the range used by the
> kernel, i.e. right after what is allocated for PMUs, at INT_MAX + 1U,
> attr.config will have the identification for the synthesized event and
> the PERF_SAMPLE_RAW payload will have its fields (Adrian Hunter)
>
> Infrastructure:
>
> - Remove warning() and error(), using instead pr_warning() and
> pr_error(), consolidating error reporting (Arnaldo Carvalho de Melo)
>
> - Add platform dependency to 'perf test 15' (Thomas Richter)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Adrian Hunter (19):
> x86/insn: perf tools: Add new ptwrite instruction
> perf script: Add 'synth' event type for synthesized events
> tools include: Add byte-swapping macros to kernel.h
> perf auxtrace: Add itrace option to output ptwrite events
> perf auxtrace: Add itrace option to output power events
> perf script: Add 'synth' field for synthesized event payloads
> perf script: Add synthesized Intel PT power and ptwrite events
> perf intel-pt: Factor out common code synthesizing event samples
> perf intel-pt: Remove unused instructions_sample_period
> perf intel-pt: Join needlessly wrapped lines
> perf intel-pt: Tidy Intel PT evsel lookup into separate function
> perf intel-pt: Tidy messages into called function intel_pt_synth_event()
> perf intel-pt: Factor out intel_pt_set_event_name()
> perf intel-pt: Move code in intel_pt_synth_events() to simplify attr setting
> perf intel-pt: Synthesize new power and "ptwrite" events
> perf intel-pt: Add example script for power events and PTWRITE
> perf intel-pt: Update documentation to include new ptwrite and power events
> perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC
> perf auxtrace: Add CPU filter support
>
> Arnaldo Carvalho de Melo (9):
> perf help: Introduce exec_failed() to avoid code duplication
> perf help: Elliminate dup code for reporting
> perf help: Use pr_warning()
> perf config: Use pr_warning()
> perf event-parse: Use pr_warning()
> perf tools: Remove warning()
> perf tools: Replace error() with pr_err()
> perf config: Do not die when parsing u64 or int config values
> perf tools: Kill die()
>
> Colin Ian King (1):
> perf jit: fix typo: "incalid" -> "invalid"
>
> Thomas Richter (1):
> perf tests: Add platform dependency to test 15
>
> arch/x86/lib/x86-opcode-map.txt | 2 +-
> tools/include/linux/kernel.h | 35 +-
> tools/objtool/arch/x86/insn/x86-opcode-map.txt | 2 +-
> tools/perf/Documentation/intel-pt.txt | 42 +-
> tools/perf/Documentation/itrace.txt | 8 +-
> tools/perf/Documentation/perf-script.txt | 6 +-
> tools/perf/arch/x86/tests/insn-x86-dat-32.c | 12 +
> tools/perf/arch/x86/tests/insn-x86-dat-64.c | 30 +
> tools/perf/arch/x86/tests/insn-x86-dat-src.c | 30 +
> tools/perf/builtin-c2c.c | 4 +-
> tools/perf/builtin-diff.c | 5 +-
> tools/perf/builtin-help.c | 48 +-
> tools/perf/builtin-kmem.c | 4 +-
> tools/perf/builtin-record.c | 4 +-
> tools/perf/builtin-report.c | 8 +-
> tools/perf/builtin-sched.c | 2 +-
> tools/perf/builtin-script.c | 205 ++++++-
> tools/perf/builtin-stat.c | 4 +-
> tools/perf/builtin-top.c | 2 +-
> tools/perf/jvmti/jvmti_agent.c | 2 +-
> .../perf/scripts/python/bin/intel-pt-events-record | 13 +
> .../perf/scripts/python/bin/intel-pt-events-report | 3 +
> tools/perf/scripts/python/intel-pt-events.py | 128 +++++
> tools/perf/tests/attr.c | 10 +-
> tools/perf/tests/attr.py | 48 ++
> tools/perf/tests/parse-events.c | 13 -
> tools/perf/util/auxtrace.c | 18 +
> tools/perf/util/auxtrace.h | 6 +
> tools/perf/util/config.c | 43 +-
> tools/perf/util/config.h | 4 +-
> tools/perf/util/data-convert-bt.c | 6 +-
> tools/perf/util/event.h | 121 ++++
> tools/perf/util/help-unknown-cmd.c | 2 +-
> .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 14 +
> .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +-
> tools/perf/util/intel-pt.c | 623 +++++++++++++++------
> tools/perf/util/sort.c | 22 +-
> tools/perf/util/trace-event-parse.c | 4 +-
> tools/perf/util/usage.c | 58 --
> tools/perf/util/util.h | 4 -
> 40 files changed, 1228 insertions(+), 369 deletions(-)
> create mode 100644 tools/perf/scripts/python/bin/intel-pt-events-record
> create mode 100644 tools/perf/scripts/python/bin/intel-pt-events-report
> create mode 100644 tools/perf/scripts/python/intel-pt-events.py
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 44+ messages in thread
* [GIT PULL 00/30] perf/core improvements and fixes
@ 2019-03-12 2:01 Arnaldo Carvalho de Melo
0 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-12 2:01 UTC (permalink / raw)
To: Ingo Molnar
Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, Adrian Hunter,
Andi Kleen, Joseph Qi, Martin Liška, Seeteena Thoufeek,
Stephane Eranian, Tony Jones, Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit b339da480315505aa28a723a983217ebcff95c86:
Merge tag 'perf-core-for-mingo-5.1-20190307' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2019-03-09 17:00:17 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-5.1-20190311
for you to fetch changes up to dfcbc2f2994b8a3af3605a26dc29c07ad7378bf4:
tools lib bpf: Fix the build by adding a missing stdarg.h include (2019-03-11 17:14:31 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
kernel:
Stephane Eranian :
- Restore mmap record type correctly when handling PERF_RECORD_MMAP2
events, as the same template is used for all the threads interested
in mmap events, some may want just PERF_RECORD_MMAP, while some
may want the extra info in MMAP2 records.
perf probe:
Adrian Hunter:
- Fix getting the kernel map, because since changes related to x86 PTI
entry trampolines handling, there are more than one kernel map.
perf script:
Andi Kleen:
- Support insn output for normal samples, i.e.:
perf script -F ip,sym,insn --xed
Will fetch the sample IP from the thread address space and feed it
to Intel's XED disassembler, producing lines such as:
ffffffffa4068804 native_write_msr wrmsr
ffffffffa415b95e __hrtimer_next_event_base movq 0x18(%rax), %rdx
That match 'perf annotate's output.
- Make the --cpu filter apply to PERF_RECORD_COMM/FORK/... events, in
addition to PERF_RECORD_SAMPLE.
perf report:
- Add a new --samples option to save a small random number of samples
per hist entry, using a reservoir technique to select a representative
number of samples.
Then allow browsing the samples using 'perf script' as part of the hist
entry context menu. This automatically adds the right filters, so only
the thread or CPU of the sample is displayed. Then we use less' search
functionality to directly jump to the time stamp of the selected sample.
It uses different menus for assembler and source display. Assembler
needs xed installed and source needs debuginfo.
- Fix the UI browser scripts pop up menu when there are many scripts
available.
perf report:
Andi Kleen:
- Add 'time' sort option. E.g.:
% perf report --sort time,overhead,symbol --time-quantum 1ms --stdio
...
0.67% 277061.87300 [.] _dl_start
0.50% 277061.87300 [.] f1
0.50% 277061.87300 [.] f2
0.33% 277061.87300 [.] main
0.29% 277061.87300 [.] _dl_lookup_symbol_x
0.29% 277061.87300 [.] dl_main
0.29% 277061.87300 [.] do_lookup_x
0.17% 277061.87300 [.] _dl_debug_initialize
0.17% 277061.87300 [.] _dl_init_paths
0.08% 277061.87300 [.] check_match
0.04% 277061.87300 [.] _dl_count_modids
1.33% 277061.87400 [.] f1
1.33% 277061.87400 [.] f2
1.33% 277061.87400 [.] main
1.17% 277061.87500 [.] main
1.08% 277061.87500 [.] f1
1.08% 277061.87500 [.] f2
1.00% 277061.87600 [.] main
0.83% 277061.87600 [.] f1
0.83% 277061.87600 [.] f2
1.00% 277061.87700 [.] main
tools headers:
Arnaldo Carvalho de Melo:
- Update x86's syscall_64.tbl, no change in tools/perf behaviour.
- Sync copies asm-generic/unistd.h and linux/in with the kernel sources.
perf data:
Jiri Olsa:
- Prep work to support having perf.data stored as a directory, with one
file per CPU, that ultimately will allow having one ring buffer reading
thread per CPU.
Vendor events:
Martin Liška:
- perf PMU events for AMD Family 17h.
perf script python:
Tony Jones:
- Add python3 support for the remaining Intel PT related scripts, with
these we should have a clean build of perf with python3 while still
supporting the build with python2.
libbpf:
Arnaldo Carvalho de Melo:
- Fix the build on uCLibc, adding the missing stdarg.h since we use
va_list in one typedef.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Adrian Hunter (1):
perf probe: Fix getting the kernel map
Andi Kleen (14):
perf script: Support insn output for normal samples
perf report: Support output in nanoseconds
perf time-utils: Add utility function to print time stamps in nanoseconds
perf report: Parse time quantum
perf report: Use less for scripts output
perf script: Filter COMM/FORK/.. events by CPU
perf report: Support time sort key
perf report: Support running scripts for current time range
perf report: Support builtin perf script in scripts menu
perf report: Implement browsing of individual samples
perf tools: Add some new tips describing the new options
perf script: Add array bound checking to list_scripts
perf ui browser: Fix ui popup argv browser for many entries
perf tools report: Add custom scripts to script menu
Arnaldo Carvalho de Melo (4):
perf tools: Update x86's syscall_64.tbl, no change in tools/perf behaviour
tools headers uapi: Sync copy of asm-generic/unistd.h with the kernel sources
tools headers uapi: Update linux/in.h copy
tools lib bpf: Fix the build by adding a missing stdarg.h include
Jiri Olsa (6):
perf data: Support having perf.data stored as a directory
perf data: Don't store auxtrace index for directory data file
perf data: Add perf_data__update_dir() function
perf data: Make perf_data__size() work over directory
perf header: Add DIR_FORMAT feature to describe directory data
perf session: Add process callback to reader object
Martin Liška (1):
perf vendor events amd: perf PMU events for AMD Family 17h
Stephane Eranian (1):
perf/core: Restore mmap record type correctly
Tony Jones (4):
perf script python: Add Python3 support to exported-sql-viewer.py
perf script python: Add Python3 support to export-to-postgresql.py
perf script python: Add Python3 support to export-to-sqlite.py
perf script python: Add printdate function to SQL exporters
kernel/events/core.c | 2 +
tools/arch/arm64/include/uapi/asm/unistd.h | 2 +
tools/include/uapi/asm-generic/unistd.h | 149 ++++++++---
tools/include/uapi/linux/in.h | 9 +-
tools/lib/bpf/libbpf.h | 1 +
tools/perf/Documentation/perf-config.txt | 14 +
tools/perf/Documentation/perf-report.txt | 13 +
tools/perf/Documentation/tips.txt | 7 +
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 6 +-
tools/perf/arch/x86/util/Build | 1 +
tools/perf/arch/x86/util/archinsn.c | 26 ++
tools/perf/builtin-record.c | 4 +-
tools/perf/builtin-report.c | 45 ++++
tools/perf/builtin-script.c | 111 +++++---
tools/perf/builtin.h | 3 +-
.../perf/pmu-events/arch/x86/amdfam17h/branch.json | 12 +
.../perf/pmu-events/arch/x86/amdfam17h/cache.json | 287 +++++++++++++++++++++
tools/perf/pmu-events/arch/x86/amdfam17h/core.json | 134 ++++++++++
.../arch/x86/amdfam17h/floating-point.json | 168 ++++++++++++
.../perf/pmu-events/arch/x86/amdfam17h/memory.json | 162 ++++++++++++
.../perf/pmu-events/arch/x86/amdfam17h/other.json | 65 +++++
tools/perf/pmu-events/arch/x86/mapfile.csv | 1 +
tools/perf/scripts/python/export-to-postgresql.py | 61 +++--
tools/perf/scripts/python/export-to-sqlite.py | 26 +-
tools/perf/scripts/python/exported-sql-viewer.py | 42 ++-
tools/perf/ui/browser.c | 10 +-
tools/perf/ui/browsers/Build | 1 +
tools/perf/ui/browsers/annotate.c | 2 +-
tools/perf/ui/browsers/hists.c | 141 ++++++++--
tools/perf/ui/browsers/res_sample.c | 91 +++++++
tools/perf/ui/browsers/scripts.c | 274 ++++++++++----------
tools/perf/util/archinsn.h | 12 +
tools/perf/util/data.c | 96 ++++++-
tools/perf/util/data.h | 12 +-
tools/perf/util/header.c | 44 +++-
tools/perf/util/header.h | 5 +
tools/perf/util/hist.c | 50 ++++
tools/perf/util/hist.h | 31 ++-
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/session.c | 27 +-
tools/perf/util/sort.c | 39 +++
tools/perf/util/sort.h | 10 +
tools/perf/util/symbol.c | 4 +
tools/perf/util/symbol_conf.h | 3 +
tools/perf/util/time-utils.c | 8 +
tools/perf/util/time-utils.h | 1 +
46 files changed, 1931 insertions(+), 287 deletions(-)
create mode 100644 tools/perf/arch/x86/util/archinsn.c
create mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/branch.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/cache.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/core.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/floating-point.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/memory.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/other.json
create mode 100644 tools/perf/ui/browsers/res_sample.c
create mode 100644 tools/perf/util/archinsn.h
Test results:
The first ones are container based builds of tools/perf with and without libelf
support. Where clang is available, it is also used to build perf with/without
libelf, and building with LIBCLANGLLVM=1 (built-in clang) with gcc and clang
when clang and its devel libraries are installed.
The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.
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.
# export PERF_TARBALL=http://192.168.124.1/perf/perf-5.0.0.tar.xz
1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0
2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822
3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0
4 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0
5 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0
6 alpine:3.9 : Ok gcc (Alpine 8.2.0) 8.2.0
7 alpine:edge : Ok gcc (Alpine 8.2.0) 8.2.0
8 amazonlinux:1 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
9 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
10 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
11 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
12 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
13 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
14 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
15 clearlinux:latest : Ok gcc (Clear Linux OS for Intel Architecture) 8.2.1 20180502
16 debian:7 : Ok gcc (Debian 4.7.2-5) 4.7.2
17 debian:8 : Ok gcc (Debian 4.9.2-10+deb8u2) 4.9.2
18 debian:9 : Ok gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
19 debian:experimental : Ok gcc (Debian 8.2.0-17) 8.2.1 20190204
20 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
21 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
22 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 8.2.0-16) 8.2.0
23 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
24 fedora:21 : Ok gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
25 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
26 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
27 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
28 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
29 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
30 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
31 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
32 fedora:28 : Ok gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)
33 fedora:29 : Ok gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)
34 fedora:30 : Ok gcc (GCC) 9.0.1 20190203 (Red Hat 9.0.1-0.3)
35 fedora:rawhide : Ok gcc (GCC) 9.0.1 20190209 (Red Hat 9.0.1-0.4)
36 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
37 mageia:5 : Ok gcc (GCC) 4.9.2
38 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0
39 opensuse:13.2 : Ok gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
40 opensuse:15.0 : Ok gcc (SUSE Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]
41 opensuse:15.1 : Ok gcc (SUSE Linux) 7.4.0
42 opensuse:42.1 : Ok gcc (SUSE Linux) 4.8.5
43 opensuse:42.2 : Ok gcc (SUSE Linux) 4.8.5
44 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5
45 opensuse:tumbleweed : Ok gcc (SUSE Linux) 8.2.1 20190103 [gcc-8-branch revision 267549]
46 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
47 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)
48 ubuntu:12.04.5 : Ok gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
49 ubuntu:14.04.4 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
50 ubuntu:14.04.4-x-linaro-arm64 : Ok aarch64-linux-gnu-gcc (Linaro GCC 5.5-2017.10) 5.5.0
51 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
52 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
53 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
54 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
55 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
56 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
57 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
58 ubuntu:17.10 : Ok gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
59 ubuntu:18.04 : Ok gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
60 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04) 7.3.0
61 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04) 7.3.0
62 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
63 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
64 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
65 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
66 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
67 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
68 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
69 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
70 ubuntu:18.10 : Ok gcc (Ubuntu 8.2.0-7ubuntu1) 8.2.0
71 ubuntu:19.04 : Ok gcc (Ubuntu 8.2.0-20ubuntu1) 8.2.0
72 ubuntu:19.04-x-alpha : Ok alpha-linux-gnu-gcc (Ubuntu 8.2.0-20ubuntu1) 8.2.0
73 ubuntu:19.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.2.0-20ubuntu1) 8.2.0
74 ubuntu:19.04-x-hppa : Ok hppa-linux-gnu-gcc (Ubuntu 8.2.0-20ubuntu1) 8.2.0
#
# uname -a
Linux quaco 5.0.0+ #1 SMP Thu Mar 7 10:32:55 -03 2019 x86_64 x86_64 x86_64 GNU/Linux
# git log --oneline -1
dfcbc2f2994b tools lib bpf: Fix the build by adding a missing stdarg.h include
# perf version --build-options
perf version 5.0.gdfcbc2
dwarf: [ on ] # HAVE_DWARF_SUPPORT
dwarf_getlocations: [ on ] # HAVE_DWARF_GETLOCATIONS_SUPPORT
glibc: [ on ] # HAVE_GLIBC_SUPPORT
gtk2: [ on ] # HAVE_GTK2_SUPPORT
syscall_table: [ on ] # HAVE_SYSCALL_TABLE_SUPPORT
libbfd: [ on ] # HAVE_LIBBFD_SUPPORT
libelf: [ on ] # HAVE_LIBELF_SUPPORT
libnuma: [ on ] # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on ] # HAVE_LIBNUMA_SUPPORT
libperl: [ on ] # HAVE_LIBPERL_SUPPORT
libpython: [ on ] # HAVE_LIBPYTHON_SUPPORT
libslang: [ on ] # HAVE_SLANG_SUPPORT
libcrypto: [ on ] # HAVE_LIBCRYPTO_SUPPORT
libunwind: [ on ] # HAVE_LIBUNWIND_SUPPORT
libdw-dwarf-unwind: [ on ] # HAVE_DWARF_SUPPORT
zlib: [ on ] # HAVE_ZLIB_SUPPORT
lzma: [ on ] # HAVE_LZMA_SUPPORT
get_cpuid: [ on ] # HAVE_AUXTRACE_SUPPORT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
# 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: Test data source output : Ok
6: Parse event definition strings : Ok
7: Simple expression parser : Ok
8: PERF_RECORD_* events & perf_sample fields : Ok
9: Parse perf pmu format : Ok
10: DSO data read : Ok
11: DSO data cache : Ok
12: DSO data reopen : Ok
13: Roundtrip evsel->name : Ok
14: Parse sched tracepoints fields : Ok
15: syscalls:sys_enter_openat event fields : Ok
16: Setup struct perf_event_attr : Ok
17: Match and link multiple hists : Ok
18: 'import perf' in python : Ok
19: Breakpoint overflow signal handler : Ok
20: Breakpoint overflow sampling : Ok
21: Breakpoint accounting : Ok
22: Watchpoint :
22.1: Read Only Watchpoint : Skip
22.2: Write Only Watchpoint : Ok
22.3: Read / Write Watchpoint : Ok
22.4: Modify Watchpoint : Ok
23: Number of exit events of a simple workload : Ok
24: Software clock events period values : Ok
25: Object code reading : Ok
26: Sample parsing : Ok
27: Use a dummy software event to keep tracking : Ok
28: Parse with no sample_id_all bit set : Ok
29: Filter hist entries : Ok
30: Lookup mmap thread : Ok
31: Share thread mg : Ok
32: Sort output of hist entries : Ok
33: Cumulate child hist entries : Ok
34: Track with sched_switch : Ok
35: Filter fds with revents mask in a fdarray : Ok
36: Add fd to a fdarray, making it autogrow : Ok
37: kmod_path__parse : Ok
38: Thread map : Ok
39: LLVM search and compile :
39.1: Basic BPF llvm compile : Ok
39.2: kbuild searching : Ok
39.3: Compile source for BPF prologue generation : Ok
39.4: Compile source for BPF relocation : Ok
40: Session topology : Ok
41: BPF filter :
41.1: Basic BPF filtering : Ok
41.2: BPF pinning : Ok
41.3: BPF prologue generation : Ok
41.4: BPF relocation checker : Ok
42: Synthesize thread map : Ok
43: Remove thread map : Ok
44: Synthesize cpu map : Ok
45: Synthesize stat config : Ok
46: Synthesize stat : Ok
47: Synthesize stat round : Ok
48: Synthesize attr update : Ok
49: Event times : Ok
50: Read backward ring buffer : Ok
51: Print cpu map : Ok
52: Probe SDT events : Ok
53: is_printable_array : Ok
54: Print bitmap : Ok
55: perf hooks : Ok
56: builtin clang support : Skip (not compiled in)
57: unit_number__scnprintf : Ok
58: mem2node : Ok
59: x86 rdpmc : Ok
60: Convert perf time to TSC : Ok
61: DWARF unwind : Ok
62: x86 instruction decoder - new instructions : Ok
63: x86 bp modify : Ok
64: probe libc's inet_pton & backtrace it with ping : Ok
65: Use vfs_getname probe to get syscall args filenames : Ok
66: Add vfs_getname probe to get syscall args filenames : Ok
67: Check open filename arg using perf trace + vfs_getname: Ok
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/perf/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_no_libnuma_O: make NO_LIBNUMA=1
make_clean_all_O: make clean all
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_newt_O: make NO_NEWT=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_no_gtk2_O: make NO_GTK2=1
make_no_slang_O: make NO_SLANG=1
make_debug_O: make DEBUG=1
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_no_libaudit_O: make NO_LIBAUDIT=1
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_libelf_O: make NO_LIBELF=1
make_help_O: make help
make_pure_O: make
make_static_O: make LDFLAGS=-static
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_install_bin_O: make install-bin
make_no_libunwind_O: make NO_LIBUNWIND=1
make_perf_o_O: make perf.o
make_no_libbpf_O: make NO_LIBBPF=1
make_no_libperl_O: make NO_LIBPERL=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_tags_O: make tags
make_install_O: make install
make_no_libbionic_O: make NO_LIBBIONIC=1
make_util_map_o_O: make util/map.o
make_no_libpython_O: make NO_LIBPYTHON=1
make_doc_O: make doc
make_cscope_O: make cscope
make_no_demangle_O: make NO_DEMANGLE=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
OK
make: Leaving directory '/home/acme/git/perf/tools/perf'
$
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2019-03-12 2:02 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27 14:30 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 01/30] perf buildid: Fix off-by-one in write_buildid() Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 02/30] perf trace: Extract evsel contructor from perf_evlist__add_pgfault Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 04/30] perf script: Fix segfault when printing callchains Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 05/30] perf trace: Make --event honour --min-stack too Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 06/30] perf trace: Make --pf " Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 07/30] perf evlist: Decode perf_event_attr->branch_sample_type Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 08/30] perf tools: Make the x86 clean quiet Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 09/30] tools build: Fix perf_clean target Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 10/30] perf tools: Remove duplicate const qualifier Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 11/30] perf tests: Replace assignment with comparison on assert check Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 12/30] perf bench futex: Simplify wrapper for LOCK_PI Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 13/30] perf intel-pt: Fix off-by-one comparison on maximum code Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 14/30] perf hists: Clear dummy entry accumulated period Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 15/30] perf evlist: Enforce ring buffer reading Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 16/30] perf probe: Close target file on error path Arnaldo Carvalho de Melo
2016-04-27 14:30 ` [PATCH 17/30] perf tools: Add lsdir() helper to read a directory Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 18/30] perf probe: Let probe_file__add_event return 0 if succeeded Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 19/30] perf probe: Set default kprobe group name if it is not given Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 20/30] perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/ Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 21/30] perf trace: Do not beautify the 'pid' parameter as a simple integer Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 22/30] tools lib api fs: Add helper to read string from procfs file Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 23/30] perf thread: Introduce method to set comm from /proc/pid/self Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 24/30] perf trace: Read thread's COMM from /proc when not set Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 25/30] perf probe: Fix offline module name missmatch issue Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 26/30] perf probe: Fix module probe issue if no dwarf support Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 27/30] perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2 Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 28/30] perf bench: Remove one more die() call Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 29/30] perf core: Allow setting up max frame stack depth via sysctl Arnaldo Carvalho de Melo
2016-04-27 14:31 ` [PATCH 30/30] perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack Arnaldo Carvalho de Melo
2016-04-27 15:03 ` [GIT PULL 00/30] perf/core improvements and fixes Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2019-03-12 2:01 Arnaldo Carvalho de Melo
2017-06-30 22:24 Arnaldo Carvalho de Melo
2017-07-01 8:41 ` Ingo Molnar
2015-05-08 20:56 Arnaldo Carvalho de Melo
2015-05-09 6:22 ` Ingo Molnar
2015-05-11 5:09 ` Namhyung Kim
2015-05-11 14:06 ` Arnaldo Carvalho de Melo
2015-05-14 8:23 ` Namhyung Kim
2015-05-14 13:18 ` Arnaldo Carvalho de Melo
2015-05-15 2:08 ` Namhyung Kim
2015-05-18 16:21 ` Arnaldo Carvalho de Melo
2012-09-24 15:59 Arnaldo Carvalho de Melo
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).