04 Sep, 2015
20 commits
-
Showing actual trace event when adding perf events is only needed in
perf probe command. But the add functionality itself can be used by
other places. So move the printing code into the cmd_probe().Also it combines the output if more than one event is added.
Before:
$ sudo perf probe -a do_fork -a do_exit
Added new event:
probe:do_fork (on do_fork)You can now use it in all perf tools, such as:
perf record -e probe:do_fork -aR sleep 1
Added new events:
probe:do_exit (on do_exit)
probe:do_exit_1 (on do_exit)You can now use it in all perf tools, such as:
perf record -e probe:do_exit_1 -aR sleep 1
After:
$ sudo perf probe -a do_fork -a do_exit
Added new events:
probe:do_fork (on do_fork)
probe:do_exit (on do_exit)
probe:do_exit_1 (on do_exit)You can now use it in all perf tools, such as:
perf record -e probe:do_exit_1 -aR sleep 1
Signed-off-by: Namhyung Kim
Tested-by: Arnaldo Carvalho de Melo
Acked-by: Masami Hiramatsu
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Wang Nan
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441368963-11565-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
This patch drops struct __event_package structure. Instead, it adds a
'struct trace_probe_event' pointer to 'struct perf_probe_event'.The trace_probe_event information gives further patches a chance to
access actual probe points and actual arguments.Using them, 'perf probe' can get the whole list of added probes and
print them at once.Other users like the upcoming bpf_loader will be able to attach one bpf
program to different probing points of an inline function (which has
multiple probing points) and glob functions.Moreover, by reading the arguments information, bpf code for reading
those arguments can be generated.Signed-off-by: Wang Nan
Acked-by: Masami Hiramatsu
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441368963-11565-2-git-send-email-namhyung@kernel.org
[namhyung: extract necessary part from the existing patch]
Signed-off-by: Namhyung Kim
Signed-off-by: Arnaldo Carvalho de Melo -
The add_perf_probe_events() does 3 things:
1. convert all perf events to trace events
2. add all trace events to kernel
3. cleanup all trace eventsBut sometimes we need to do something with the trace events. So split
the funtion into three, so that it can access intermediate trace events
via struct __event_package if needed.Signed-off-by: Namhyung Kim
Acked-by: Masami Hiramatsu
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Wang Nan
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441368963-11565-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Add support for selecting and processing PERF_RECORD_SWITCH events for
use by Intel PT. If they are available, they will be used in preference
to sched_switch events.This enables an unprivileged user to trace multi-threaded or
multi-process workloads with any level of perf_event_paranoid. However
it depends on kernel support for PERF_RECORD_SWITCH.Without this patch, tracing a multi-threaded workload will decode
without error but all the data will be attributed to the main thread.Without this patch, tracing a multi-process workload will result in
decoder errors because the decoder will not know which executable is
executing.Signed-off-by: Adrian Hunter
Cc: Jiri Olsa
Link: http://lkml.kernel.org/r/1439458857-30636-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Need to check evsel before passing it to dump_sample().
Signed-off-by: Kan Liang
Cc: Adrian Hunter
Cc: Andi Kleen
Cc: Andy Lutomirski
Cc: Jiri Olsa
Cc: Mark Rutland
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Stephane Eranian
Link: http://lkml.kernel.org/r/1441283463-51050-5-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Add xsavec, xsaves and xrstors to the op code map and the perf tools new
instructions test. To run the test:$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep 'xsave\|xrst'
For information about xsavec, xsaves and xrstors, refer the Intel SDM.
Signed-off-by: Adrian Hunter
Acked-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-8-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Add rdpkru and wrpkru to the op code map and the perf tools new
instructions test. In the case of the test, only the bytes can be
tested at the moment since binutils doesn't support the instructions
yet. To run the test:$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep pkru
For information about rdpkru and wrpkru, refer the Intel SDM.
Signed-off-by: Adrian Hunter
Acked-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-7-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Intel Architecture Instruction Set Extensions Programing Reference (Oct
2014) describes 3 new memory instructions, namely clflushopt, clwb and
pcommit. Add them to the op code map and the perf tools new
instructions test. e.g.$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins"
Signed-off-by: Adrian Hunter
Acked-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-6-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Intel SHA Extensions are explained in the Intel Architecture
Instruction Set Extensions Programing Reference (Oct 2014).
There are 7 new instructions. Add them to the op code map
and the perf tools new instructions test. e.g.$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep sha
Committer note:
3 lines of details, for the curious:
$ perf test -v "x86 ins" 2>&1 | grep sha256msg1 | tail -3
Decoded ok: 0f 38 cc 84 08 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,1),%xmm0
Decoded ok: 0f 38 cc 84 c8 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,8),%xmm0
Decoded ok: 44 0f 38 cc bc c8 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,8),%xmm15
$Signed-off-by: Adrian Hunter
Acked-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-5-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
The MPX instructions are presently not described in the SDM
opcode maps, and there are not encoding characters for bnd
registers, address method or operand type. So the kernel
opcode map is using 'Gv' for bnd registers and 'Ev' for
everything else. That is fine because the instruction
decoder does not use that information anyway, except as
an indication that there is a ModR/M byte.Nevertheless, in some cases the 'Gv' and 'Ev' are the wrong
way around, BNDLDX and BNDSTX have 2 operands not 3, and it
wouldn't hurt to identify the mandatory prefixes.This has no effect on the decoding of valid instructions,
but the addition of the mandatory prefixes will cause some
invalid instructions to error out that wouldn't have
previously.Note that perf tools has a copy of the instruction decoder
and provides a test for new instructions which includes MPX
instructions e.g.$ perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ perf test -v "x86 ins"
Commiter notes:
And to see these MPX instructions specifically:
$ perf test -v "x86 ins" 2>&1 | grep bndldx | head -3
Decoded ok: 0f 1a 00 bndldx (%eax),%bnd0
Decoded ok: 0f 1a 05 78 56 34 12 bndldx 0x12345678,%bnd0
Decoded ok: 0f 1a 18 bndldx (%eax),%bnd3
$ perf test -v "x86 ins" 2>&1 | grep bndstx | head -3
Decoded ok: 0f 1b 00 bndstx %bnd0,(%eax)
Decoded ok: 0f 1b 05 78 56 34 12 bndstx %bnd0,0x12345678
Decoded ok: 0f 1b 18 bndstx %bnd3,(%eax)
$Signed-off-by: Adrian Hunter
Acked-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-4-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Add a new test titled:
Test x86 instruction decoder - new instructions
The purpose of this test is to check the instruction decoder after new
instructions have been added. Initially, MPX instructions are tested
which are already supported, but the definitions in x86-opcode-map.txt
will be tweaked in a subsequent patch, after which this test can be run
to verify those changes.The data for the test comes from assembly language instructions in
insn-x86-dat-src.c which is converted into bytes by the scripts
gen-insn-x86-dat.sh and gen-insn-x86-dat.awk, and included into the test
program insn-x86.c as insn-x86-dat-32.c and insn-x86-dat-64.c.The conversion is not done as part of the perf tools build because the
test data must be under (git) change control in order for the test to be
repeatably-correct. Also it may require a recent version of binutils.Commiter notes:
Using it:
# perf test decoder
39: Test x86 instruction decoder - new instructions : Ok
# perf test -v decoder
39: Test x86 instruction decoder - new instructions :
--- start ---
test child forked, pid 21970
Decoded ok: 0f 31 rdtsc
Decoded ok: f3 0f 1b 00 bndmk (%eax),%bnd0
Decoded ok: f3 0f 1b 05 78 56 34 12 bndmk 0x12345678,%bnd0
Decoded ok: f3 0f 1b 18 bndmk (%eax),%bnd3
Decoded ok: f2 e9 00 00 00 00 bnd jmpq 402
Decoded ok: f2 e9 00 00 00 00 bnd jmpq 408
Decoded ok: 67 f2 ff 21 bnd jmpq *(%ecx)
Decoded ok: f2 0f 85 00 00 00 00 bnd jne 413
test child finished with 0
---- end ----
Test x86 instruction decoder - new instructions: Ok
#Signed-off-by: Adrian Hunter
Acked-by: Masami Hiramatsu
Tested-by: Arnaldo Carvalho de Melo
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
perf tools has a copy of the x86 instruction decoder used by the kernel.
The expectation is that the copy will be kept more-or-less in-synch with
the kernel version. Consequently it is helpful to know if there are
differences.This patch adds a check into the perf tools build so that a diff is done
on the sources, and a warning is printed if they are different. Note
that the warning is not fatal and the build continues as normal.The check is done as part of building the instruction decoder, so, like
a compiler warning, it is not seen unless the instruction decoder has to
be re-compiled. e.g.$ make -C tools/perf >/dev/null
$ echo "/* blah */" >> tools/perf/util/intel-pt-decoder/inat_types.h
$ make -C tools/perf >/dev/null
Warning: Intel PT: x86 instruction decoder differs from kernel
$ make -C tools/perf >/dev/null
$Signed-off-by: Adrian Hunter
Tested-by: Arnaldo Carvalho de Melo
Acked-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: Andy Lutomirski
Cc: Dave Hansen
Cc: Denys Vlasenko
Cc: Jiri Olsa
Cc: Peter Zijlstra
Cc: Qiaowei Ren
Cc: Thomas Gleixner
Link: http://lkml.kernel.org/r/1441196131-20632-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Add FSTYPE__configured() (where FSTYPE is one of sysfs, procfs, debugfs,
tracefs) interface that returns bool state of the filesystem mount:true - mounted, false - not mounted
It will not try to mount the filesystem.
Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-13-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Adding FSTYPE__mount (where FSTYPE is, as of now, one of sysfs, procfs,
debugfs, tracefs) method that tries to mount the filesystem in case no
mount of FSTYPE is found.Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-12-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Adding tracefs support into fs.c framework. It'll replace the tracefs
object functionality in following patches.Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-11-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Adding debugfs support into fs.c framework. It'll replace the debugfs
object functionality in following patches.Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
There's no need to export SYSFS_MAGIC PROC_SUPER_MAGIC in fs.h. Leave
them in the fs.c.Link: http://lkml.kernel.org/n/tip-b2cd1bb7yvbazq5oua24oz18@git.kernel.org
Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-9-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
We're going to get rid of findfs.h in following patches, but we'll still
need these macros.Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Moving debugfs__strerror_open out of api/fs/debugfs.c, because it's not
debugfs specific. It'll be changed to consider tracefs mount as well in
following patches.Renaming it into tracing_path__strerror_open_tp to fit into the
namespace. No functional change is intended.Signed-off-by: Jiri Olsa
Reviewed-by: Matt Fleming
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Moving tracing_path interface into api/fs/tracing_path.c out of util.c.
It seems generic enough to be used by others, and I couldn't think of
better place.Signed-off-by: Jiri Olsa
Reviewed-by: Matt Fleming
Reviewed-by: Raphael Beamonte
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
03 Sep, 2015
8 commits
-
Renaming all functions touching tracing_path under same namespace. New
interface is:char tracing_path[];
- tracing mount pathchar tracing_events_path[];
- tracing mount/events pathvoid tracing_path_set(const char *mountpoint);
- setting directly tracing_path(_events), used by --debugfs-dir optionconst char *tracing_path_mount(void);
- initial setup of tracing_(events)_path, called from perf.c
mounts debugfs/tracefs if needed and possiblechar *get_tracing_file(const char *name);
void put_tracing_file(char *file);
- get/put tracing file pathSigned-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
It's not used by any caller. We either detect the mountpoint or use
hardcoded one.Signed-off-by: Jiri Olsa
Cc: Raphael Beamonte
Cc: David Ahern
Cc: Matt Fleming
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1441180605-24737-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Since 3b3eb0445 running perf stat on a system without
backend-stalled-cycles spits out ugly warnings by default.Since that is quite common, make the message a debug message only.
We know anyways that the counter wasn't read by the normal
output.Signed-off-by: Andi Kleen
Acked-by: Jiri Olsa
Link: http://lkml.kernel.org/r/1441147966-14917-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo -
This patch stores the cpu socket_id and core_id in a perf.data header,
and reads them into the perf_env struct when processing perf.data files.The changes modifies the CPU_TOPOLOGY section, making sure it is
backward/forward compatible.The patch checks the section size before reading the core and socket ids.
It never reads data crossing the section boundary. An old perf binary
without this patch can also correctly read the perf.data from a new perf
with this patch.Because the new info is added at the end of the cpu_topology section, an
old perf tool ignores the extra data.Examples:
1. New perf with this patch read perf.data from an old perf without the
patch:$ perf_new report -i perf_old.data --header-only -I
......
# sibling threads : 33
# sibling threads : 34
# sibling threads : 35
# Core ID and Socket ID information is not available
# node0 meminfo : total = 32823872 kB, free = 29315548 kB
# node0 cpu list : 0-17,36-53
......2. Old perf without the patch reads perf.data from a new perf with the
patch:$ perf_old report -i perf_new.data --header-only -I
......
# sibling threads : 33
# sibling threads : 34
# sibling threads : 35
# node0 meminfo : total = 32823872 kB, free = 29190932 kB
# node0 cpu list : 0-17,36-53
......3. New perf read new perf.data:
$ perf_new report -i perf_new.data --header-only -I
......
# sibling threads : 33
# sibling threads : 34
# sibling threads : 35
# CPU 0: Core ID 0, Socket ID 0
# CPU 1: Core ID 1, Socket ID 0
......
# CPU 61: Core ID 10, Socket ID 1
# CPU 62: Core ID 11, Socket ID 1
# CPU 63: Core ID 16, Socket ID 1
# node0 meminfo : total = 32823872 kB, free = 29190932 kB
# node0 cpu list : 0-17,36-53Signed-off-by: Kan Liang
Cc: Andi Kleen
Cc: Jiri Olsa
Link: http://lkml.kernel.org/r/1441115893-22006-2-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
This patch moves the code which reads core_id and socket_id into
separate functions.Signed-off-by: Kan Liang
Cc: Andi Kleen
Cc: Jiri Olsa
Link: http://lkml.kernel.org/r/1441115893-22006-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo -
Support helper function __get_dynamic_array_len() in libtraceevent, this
function is used accompany with __print_array() or __print_hex(), but
currently it is not an available function in the function list of
process_function().The total allocated length of the dynamic array is embedded in the top
half of __data_loc_##item field. This patch adds new arg type
PRINT_DYNAMIC_ARRAY_LEN to return the length to eval_num_arg(),Signed-off-by: He Kuang
Acked-by: Namhyung Kim
Cc: Alexei Starovoitov
Cc: Jiri Olsa
Cc: Masami Hiramatsu
Cc: Peter Zijlstra
Cc: Steven Rostedt
Cc: Wang Nan
Cc: Zefan Li
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1440822125-52691-32-git-send-email-wangnan0@huawei.com
Signed-off-by: Wang Nan
Signed-off-by: Arnaldo Carvalho de Melo -
This patch copies filter.h from include/linux/kernel.h to
tools/include/linux/filter.h to enable other libraries to use macros in it,
like libbpf which will be introduced by further patches.Currently, the filter.h copy only contains the useful macros needed by
libbpf for not introducing too much dependence.tools/perf/MANIFEST is also updated for 'make perf-*-src-pkg'.
One change:
The 'imm' field of BPF_EMIT_CALL becomes ((FUNC) - BPF_FUNC_unspec) to
suit user space code generator.Signed-off-by: He Kuang
Cc: David Ahern
Cc: Alexei Starovoitov
Cc: Brendan Gregg
Cc: Daniel Borkmann
Cc: David Ahern
Cc: Jiri Olsa
Cc: Kaixu Xia
Cc: Masami Hiramatsu
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Wang Nan
Cc: Zefan Li
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1440822125-52691-22-git-send-email-wangnan0@huawei.com
Signed-off-by: Wang Nan
[ Removed stylistic changes, so that a diff to the original file gets reduced ]
Signed-off-by: Arnaldo Carvalho de Melo -
When profiling the kernel with the 'srcfile' sort key it's common to
"get stuck" in include. For example a lot of code uses current or other
inlines, so they get accounted to some random include file. This is not
very useful as a high level categorization.For example just profiling the idle loop usually shows mostly inlines,
so you never see the actual cpuidle file.This patch changes the 'srcfile' sort key to always unwind the inline
stack using BFD/DWARF. So we always account to the base function that
called the inline.In a few cases include is still shown (for example for MSR accesses),
but that is because they get inlining expanded as part of assigning to a
global function pointer. For the majority it works fine though.v2: Use simpler while loop. Add maximum iteration count.
Signed-off-by: Andi Kleen
Cc: Jiri Olsa
Link: http://lkml.kernel.org/r/1441133239-31254-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo
02 Sep, 2015
3 commits
-
…it/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
- Fix link time error with sample_reg_masks on non-x86. (Stephane Eranian)
- Fix potential array out of bounds access. (Wang Nan)
- Fix Intel PT instruction decoder dependency problem. (Wang Nan)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org> -
This patch makes perf compile on non x86 platforms by defining a weak
symbol for sample_reg_masks[] in util/perf_regs.c.The patch also moves the REG() and REG_END() macros into the
util/per_regs.h header file. The macros are renamed to
SMPL_REG/SMPL_REG_END to avoid clashes with other header files.Signed-off-by: Stephane Eranian
Acked-by: Jiri Olsa
Cc: Adrian Hunter
Cc: Andi Kleen
Cc: David Ahern
Cc: Kan Liang
Cc: Namhyung Kim
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1441099814-26783-1-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo -
I hit following building error randomly:
...
/bin/sh: /path/to/kernel/buildperf/util/intel-pt-decoder/inat-tables.c: No such file or directory
...
LINK /path/to/kernel/buildperf/plugin_mac80211.so
LINK /path/to/kernel/buildperf/plugin_kmem.so
LINK /path/to/kernel/buildperf/plugin_xen.so
LINK /path/to/kernel/buildperf/plugin_hrtimer.so
In file included from util/intel-pt-decoder/intel-pt-insn-decoder.c:25:0:
util/intel-pt-decoder/inat.c:24:25: fatal error: inat-tables.c: No such file or directory
#include "inat-tables.c"
^
compilation terminated.
make[4]: *** [/path/to/kernel/buildperf/util/intel-pt-decoder/intel-pt-insn-decoder.o] Error 1
make[4]: *** Waiting for unfinished jobs....
LINK /path/to/kernel/buildperf/plugin_function.soThis is caused by tools/perf/util/intel-pt-decoder/Build that, it tries
to generate $(OUTPUT)util/intel-pt-decoder/inat-tables.c atomatically
but forget to ensure the existance of $(OUTPUT)util/intel-pt-decoder
directory.This patch fixes it by adding $(call rule_mkdir) like other similar rules.
Signed-off-by: Wang Nan
Acked-by: Adrian Hunter
Acked-by: Jiri Olsa
Cc: Zefan Li
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441087005-107540-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo
01 Sep, 2015
9 commits
-
There is a problem in the dwarf-regs.c files for sh, sparc and x86 where
it is possible to make an out-of-bounds array access when searching for
register names.This patch fixes it by replacing '
Reviewed-by: Matt Fleming
Acked-by: Jiri Olsa
Acked-by: Masami Hiramatsu
Cc: David S. Miller
Cc: Zefan Li
Cc: pi3orama@huawei.com
Link: http://lkml.kernel.org/r/1441078184-105038-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo -
…/acme/linux into perf/urgent
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Add ability to specify to select which registers to record,
to reduce the size of perf.data files, and also allow printing
the registers in 'perf script': (Stephane Eranian)# perf record --intr-regs=AX,SP usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.016 MB perf.data (8 samples) ]
# perf script -F ip,sym,iregs | tail -5
ffffffff8105f42a native_write_msr_safe AX:0xf SP:0xffff8802629c3c00
ffffffff8105f42a native_write_msr_safe AX:0xf SP:0xffff8802629c3c00
ffffffff81761ac0 _raw_spin_lock AX:0xffff8801bfcf8020 SP:0xffff8802629c3ce8
ffffffff81202bf8 __vma_adjust_trans_huge AX:0x7ffc75200000 SP:0xffff8802629c3b30
ffffffff8122b089 dput AX:0x101 SP:0xffff8802629c3c78
#Infrastructure changes:
- Open event on evsel cpus and threads. (Kan Liang)
- Add new bpf API to get name from a BPF object. (Wang Nan)
Build fixes:
- Fix build on powerpc broken by pt/bts. (Adrian Hunter)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org> -
Pull NOHZ updates from Ingo Molnar:
"The main changes, mostly written by Frederic Weisbecker, include:- Fix some jiffies based cputime assumptions. (No real harm because
the concerned code isn't used by full dynticks.)- Simplify jiffies usecs conversions. Remove dead code.
- Remove early hacks on nohz full code that avoided messing up idle
nohz internals. Now nohz integrates well full and idle and such
hack have become needless.- Restart nohz full tick from irq exit. (A simplification and a
preparation for future optimization on scheduler kick to nohz
full)- Code cleanups.
- Tile driver isolation enhancement on top of nohz. (Chris Metcalf)"
* 'timers-nohz-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
nohz: Remove useless argument on tick_nohz_task_switch()
nohz: Move tick_nohz_restart_sched_tick() above its users
nohz: Restart nohz full tick from irq exit
nohz: Remove idle task special case
nohz: Prevent tilegx network driver interrupts
alpha: Fix jiffies based cputime assumption
apm32: Fix cputime == jiffies assumption
jiffies: Remove HZ > USEC_PER_SEC special case -
Pull scheduler fix from Ingo Molnar:
"This is a leftover scheduler fix from the v4.2 cycle"* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched: Fix cpu_active_mask/cpu_online_mask race -
Pull scheduler updates from Ingo Molnar:
"The biggest change in this cycle is the rewrite of the main SMP load
balancing metric: the CPU load/utilization. The main goal was to make
the metric more precise and more representative - see the changelog of
this commit for the gory details:9d89c257dfb9 ("sched/fair: Rewrite runnable load and utilization average tracking")
It is done in a way that significantly reduces complexity of the code:
5 files changed, 249 insertions(+), 494 deletions(-)
and the performance testing results are encouraging. Nevertheless we
need to keep an eye on potential regressions, since this potentially
affects every SMP workload in existence.This work comes from Yuyang Du.
Other changes:
- SCHED_DL updates. (Andrea Parri)
- Simplify architecture callbacks by removing finish_arch_switch().
(Peter Zijlstra et al)- cputime accounting: guarantee stime + utime == rtime. (Peter
Zijlstra)- optimize idle CPU wakeups some more - inspired by Facebook server
loads. (Mike Galbraith)- stop_machine fixes and updates. (Oleg Nesterov)
- Introduce the 'trace_sched_waking' tracepoint. (Peter Zijlstra)
- sched/numa tweaks. (Srikar Dronamraju)
- misc fixes and small cleanups"
* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (44 commits)
sched/deadline: Fix comment in enqueue_task_dl()
sched/deadline: Fix comment in push_dl_tasks()
sched: Change the sched_class::set_cpus_allowed() calling context
sched: Make sched_class::set_cpus_allowed() unconditional
sched: Fix a race between __kthread_bind() and sched_setaffinity()
sched: Ensure a task has a non-normalized vruntime when returning back to CFS
sched/numa: Fix NUMA_DIRECT topology identification
tile: Reorganize _switch_to()
sched, sparc32: Update scheduler comments in copy_thread()
sched: Remove finish_arch_switch()
sched, tile: Remove finish_arch_switch
sched, sh: Fold finish_arch_switch() into switch_to()
sched, score: Remove finish_arch_switch()
sched, avr32: Remove finish_arch_switch()
sched, MIPS: Get rid of finish_arch_switch()
sched, arm: Remove finish_arch_switch()
sched/fair: Clean up load average references
sched/fair: Provide runnable_load_avg back to cfs_rq
sched/fair: Remove task and group entity load when they are dead
sched/fair: Init cfs_rq's sched_entity load average
... -
Pull RAS updates from Ingo Molnar:
"MCE handling updates, but also some generic drivers/edac/ changes to
better organize the Kconfig space"* 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/ras: Move AMD MCE injector to arch/x86/ras/
x86/mce: Add a wrapper around mce_log() for injection
x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check()
RAS: Add a menuconfig option with descriptive text
x86/mce: Reenable CMCI banks when swiching back to interrupt mode
x86/mce: Clear Local MCE opt-in before kexec
x86/mce: Remove unused function declarations
x86/mce: Kill drain_mcelog_buffer()
x86/mce: Avoid potential deadlock due to printk() in MCE context
x86/mce: Remove the MCE ring for Action Optional errors
x86/mce: Don't use percpu workqueues
x86/mce: Provide a lockless memory pool to save error records
x86/mce: Reuse one of the u16 padding fields in 'struct mce' -
Pull perf updates from Ingo Molnar:
"Main perf kernel side changes:- uprobes updates/fixes. (Oleg Nesterov)
- Add PERF_RECORD_SWITCH to indicate context switches and use it in
tooling. (Adrian Hunter)- Support BPF programs attached to uprobes and first steps for BPF
tooling support. (Wang Nan)- x86 generic x86 MSR-to-perf PMU driver. (Andy Lutomirski)
- x86 Intel PT, LBR and BTS updates. (Alexander Shishkin)
- x86 Intel Skylake support. (Andi Kleen)
- x86 Intel Knights Landing (KNL) RAPL support. (Dasaratharaman
Chandramouli)- x86 Intel Broadwell-DE uncore support. (Kan Liang)
- x86 hw breakpoints robustization (Andy Lutomirski)
Main perf tooling side changes:
- Support Intel PT in several tools, enabling the use of the
processor trace feature introduced in Intel Broadwell processors:
(Adrian Hunter)# dmesg | grep Performance
# [0.188477] Performance Events: PEBS fmt2+, 16-deep LBR, Broadwell events, full-width counters, Intel PMU driver.
# perf record -e intel_pt//u -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.216 MB perf.data ]
# perf script # then navigate in the tool output to some area, like this one:
184 1030 dl_main (/usr/lib64/ld-2.17.so) => 7f21ba661440 dl_main (/usr/lib64/ld-2.17.so)
185 1457 dl_main (/usr/lib64/ld-2.17.so) => 7f21ba669f10 _dl_new_object (/usr/lib64/ld-2.17.so)
186 9f37 _dl_new_object (/usr/lib64/ld-2.17.so) => 7f21ba677b90 strlen (/usr/lib64/ld-2.17.so)
187 7ba3 strlen (/usr/lib64/ld-2.17.so) => 7f21ba677c75 strlen (/usr/lib64/ld-2.17.so)
188 7c78 strlen (/usr/lib64/ld-2.17.so) => 7f21ba669f3c _dl_new_object (/usr/lib64/ld-2.17.so)
189 9f8a _dl_new_object (/usr/lib64/ld-2.17.so) => 7f21ba65fab0 calloc@plt (/usr/lib64/ld-2.17.so)
190 fab0 calloc@plt (/usr/lib64/ld-2.17.so) => 7f21ba675e70 calloc (/usr/lib64/ld-2.17.so)
191 5e87 calloc (/usr/lib64/ld-2.17.so) => 7f21ba65fa90 malloc@plt (/usr/lib64/ld-2.17.so)
192 fa90 malloc@plt (/usr/lib64/ld-2.17.so) => 7f21ba675e60 malloc (/usr/lib64/ld-2.17.so)
193 5e68 malloc (/usr/lib64/ld-2.17.so) => 7f21ba65fa80 __libc_memalign@plt (/usr/lib64/ld-2.17.so)
194 fa80 __libc_memalign@plt (/usr/lib64/ld-2.17.so) => 7f21ba675d50 __libc_memalign (/usr/lib64/ld-2.17.so)
195 5d63 __libc_memalign (/usr/lib64/ld-2.17.so) => 7f21ba675e20 __libc_memalign (/usr/lib64/ld-2.17.so)
196 5e40 __libc_memalign (/usr/lib64/ld-2.17.so) => 7f21ba675d73 __libc_memalign (/usr/lib64/ld-2.17.so)
197 5d97 __libc_memalign (/usr/lib64/ld-2.17.so) => 7f21ba675e18 __libc_memalign (/usr/lib64/ld-2.17.so)
198 5e1e __libc_memalign (/usr/lib64/ld-2.17.so) => 7f21ba675df9 __libc_memalign (/usr/lib64/ld-2.17.so)
199 5e10 __libc_memalign (/usr/lib64/ld-2.17.so) => 7f21ba669f8f _dl_new_object (/usr/lib64/ld-2.17.so)
200 9fc2 _dl_new_object (/usr/lib64/ld-2.17.so) => 7f21ba678e70 memcpy (/usr/lib64/ld-2.17.so)
201 8e8c memcpy (/usr/lib64/ld-2.17.so) => 7f21ba678ea0 memcpy (/usr/lib64/ld-2.17.so)- Add support for using several Intel PT features (CYC, MTC packets),
the relevant documentation was updated in:
tools/perf/Documentation/intel-pt.txt
briefly describing those packets, its purposes, how to configure
them in the event config terms and relevant external documentation
for further reading. (Adrian Hunter)- Introduce support for probing at an absolute address, for user and
kernel 'perf probe's, useful when one have the symbol maps on a
developer machine but not on an embedded system. (Wang Nan)- Add Intel BTS support, with a call-graph script to show it and PT
in use in a GUI using 'perf script' python scripting with
postgresql and Qt. (Adrian Hunter)- Allow selecting the type of callchains per event, including
disabling callchains in all but one entry in an event list, to save
space, and also to ask for the callchains collected in one event to
be used in other events. (Kan Liang)- Beautify more syscall arguments in 'perf trace': (Arnaldo Carvalho
de Melo)
* A bunch more translate file/pathnames from pointers to strings.
* Convert numbers to strings for the 'keyctl' syscall 'option'
arg.
* Add missing 'clockid' entries.- Introduce 'srcfile' sort key: (Andi Kleen)
# perf record -F 10000 usleep 1
# perf report --stdio --dsos '[kernel.vmlinux]' -s srcfile
# Overhead Source File
26.49% copy_page_64.S
5.49% signal.c
0.51% msr.h
#It can be combined with other fields, for instance, experiment with
'-s srcfile,symbol'.There are some oddities in some distros and with some specific
DSOs, being investigated, so your mileage may vary.- Support per-event 'freq' term: (Namhyung Kim)
$ perf record -e 'cpu/instructions,freq=1234/',cycles -c 1000 sleep 1
$ perf evlist -F
cpu/instructions,freq=1234/: sample_freq=1234
cycles: sample_period=1000
$- Deref sys_enter pointer args with contents from probe:vfs_getname,
showing pathnames instead of pointers in many syscalls in 'perf
trace'. (Arnaldo Carvalho de Melo)- Stop collecting /proc/kallsyms in perf.data files, saving about
4.5MB on a typical x86-64 system, use the the symbol resolution
routines used in all the other tools (report, top, etc) now that we
can ask libtraceevent to use perf's symbol resolution code.
(Arnaldo Carvalho de Melo)- Allow filtering out of perf's PID via 'perf record --exclude-perf'.
(Wang Nan)- 'perf trace' now supports syscall groups, like strace, i.e:
$ trace -e file touch file
Will expand 'file' into multiple, file related, syscalls. More
work needed to add extra groups for other syscall groups, and also
to complement what was added for the 'file' group, included as a
proof of concept. (Arnaldo Carvalho de Melo)- Add lock_pi stresser to 'perf bench futex', to test the kernel code
related to FUTEX_(UN)LOCK_PI. (Davidlohr Bueso)- Let user have timestamps with per-thread recording in 'perf record'
(Adrian Hunter)- ... and tons of other changes, see the shortlog and the Git log for
details"* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (240 commits)
perf evlist: Add backpointer for perf_env to evlist
perf tools: Rename perf_session_env to perf_env
perf tools: Do not change lib/api/fs/debugfs directly
perf tools: Add tracing_path and remove unneeded functions
perf buildid: Introduce sysfs/filename__sprintf_build_id
perf evsel: Add a backpointer to the evlist a evsel is in
perf trace: Add header with copyright and background info
perf scripts python: Add new compaction-times script
perf stat: Get correct cpu id for print_aggr
tools lib traceeveent: Allow for negative numbers in print format
perf script: Add --[no-]-demangle/--[no-]-demangle-kernel
tracing/uprobes: Do not print '0x (null)' when offset is 0
perf probe: Support probing at absolute address
perf probe: Fix error reported when offset without function
perf probe: Fix list result when address is zero
perf probe: Fix list result when symbol can't be found
tools build: Allow duplicate objects in the object list
perf tools: Remove export.h from MANIFEST
perf probe: Prevent segfault when reading probe point with absolute address
perf tools: Update Intel PT documentation
... -
Pull x86/kasan changes from Ingo Molnar:
"These are two KASAN changes that factor out (and generalize) x86
specific KASAN code from x86 to mm"* 'mm-kasan-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/kasan, mm: Introduce generic kasan_populate_zero_shadow()
x86/kasan: Define KASAN_SHADOW_OFFSET per architecture -
Pull liblockdep fixes from Ingo Molnar:
"Three liblockdep fixes left over from the v4.2 cycle"* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
tools/liblockdep: Use the rbtree header provided by common tools headers
tools/liblockdep: Correct macro for WARN
tools: Restore export.h