perf changes for v3.10
Subsystems (11)
Linus,
Please pull the latest perf-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-core-for-linus
HEAD: 5ac2b5c2721501a8f5c5e1cd4116cbc31ace6886 perf/x86/intel/P4: Robistify P4 PMU types
This was another active development cycle for instrumentation:
130 files changed, 5670 insertions(+), 1708 deletions(-)
Features:
* Add "uretprobes" - an optimization to uprobes, like kretprobes are an optimization to kprobes. "perf probe -x file sym%return" now works like kretprobes. By Oleg Nesterov.
* Introduce per core aggregation in 'perf stat', from Stephane Eranian.
* Add memory profiling via PEBS, from Stephane Eranian.
* Event group view for 'annotate' in --stdio, --tui and --gtk, from Namhyung Kim.
* Add support for AMD NB and L2I "uncore" counters, by Jacob Shin.
* Add Ivy Bridge-EP uncore support, by Zheng Yan
* IBM zEnterprise EC12 oprofile support patchlet from Robert Richter.
* Add perf test entries for checking breakpoint overflow signal handler issues, from Jiri Olsa.
* Add perf test entry for for checking number of EXIT events, from Namhyung Kim.
* Add perf test entries for checking --cpu in record and stat, from Jiri Olsa.
* Introduce perf stat --repeat forever, from Frederik Deweerdt.
* Add --no-demangle to report/top, from Namhyung Kim.
* PowerPC fixes plus a couple of cleanups/optimizations in uprobes and trace_uprobes, by Oleg Nesterov.
Various fixes and refactorings:
* Fix dependency of the python binding wrt libtraceevent, from Naohiro Aota.
* Simplify some perf_evlist methods and to allow 'stat' to share code with 'record' and 'trace', by Arnaldo Carvalho de Melo.
* Remove dead code in related to libtraceevent integration, from Namhyung Kim.
* Revert "perf sched: Handle PERF_RECORD_EXIT events" to get 'perf sched lat' back working, by Arnaldo Carvalho de Melo
* We don't use Newt anymore, just plain libslang, by Arnaldo Carvalho de Melo.
* Kill a bunch of die() calls, from Namhyung Kim.
* Fix build on non-glibc systems due to libio.h absence, from Cody P Schafer.
* Remove some perf_session and tracing dead code, from David Ahern.
* Honor parallel jobs, fix from Borislav Petkov
* Introduce tools/lib/lk library, initially just removing duplication among tools/perf and tools/vm. from Borislav Petkov
... and many more I missed to list, see the shortlog and git log for more details.
Thanks,
Ingo
------------------>
Ananth N Mavinakayanahalli (3):
uprobes: Add trap variant helper uprobes/powerpc: Teach uprobes to ignore gdb breakpoints uprobes/powerpc: Remove additional trap instruction check
Andi Kleen (4):
perf/x86: Support CPU specific sysfs events perf/core: Add weighted samples
perf tools: Add support for weight v7 (modified) perf/x86: Add Sandy Bridge constraints for CYCLE_ACTIVITY.*
Andreas Krebbel (1):
oprofile, s390: Add support for IBM zEnterprise EC12
Anton Arapov (9):
uretprobes: Introduce uprobe_consumer->ret_handler()
uretprobes: Reserve the first slot in xol_vma for trampoline uretprobes/x86: Hijack return address uretprobes/powerpc: Hijack return address
uretprobes: Return probe entry, prepare_uretprobe()
uretprobes: Return probe exit, invoke handlers
uretprobes: Limit the depth of return probe nestedness
uretprobes: Remove -ENOSYS as return probes implemented
uretprobes: Documentation update
Arnaldo Carvalho de Melo (6):
perf stat: Introduce evlist methods to allocate/free the stats Revert "perf sched: Handle PERF_RECORD_EXIT events" perf tools: Convert needless static variable to local perf map browser: Use ui_browser__input_window() perf tools: Remove dependency on libnewt
perf map browser: Exit just on well known key presses
Borislav Petkov (7):
perf tools: Remove a write-only variable in the debugfs code perf tools: Honor parallel jobs
perf tools: Correct Makefile.include
perf tools: Introduce tools/lib/lk library
perf tools: Extract perf-specific stuff from debugfs.c tools/vm: Switch to liblk library
tools lib lk: Fix _FORTIFY_SOURCE builds
Cody P Schafer (1):
perf tools: Fix build on non-glibc systems due to libio.h absence
David Ahern (3):
perf tools: Remove unused tracing functions
perf session: Remove unused perf_session__remove_thread method perf machine: Move machine__remove_thread and make static
Frederik Deweerdt (1):
perf stat: Introduce --repeat forever
George Dunlap (1):
perf/x86: Check all MSRs before passing hw check
Ingo Molnar (1):
perf/x86/intel/P4: Robistify P4 PMU types
Jacob Shin (3):
perf/x86/amd: Add support for AMD NB and L2I "uncore" counters perf/x86/amd: Remove old-style NB counter support from perf_event_amd.c perf/x86/amd: Fix AMD NB and L2I "uncore" support
Jiri Olsa (6):
perf tests: Make attr script verbose friendly perf tests: Make attr script test event cpu
perf tests: Add attr record -C cpu test
perf tests: Add attr stat -C cpu test
perf tests: Test breakpoint overflow signal handler perf tests: Test breakpoint overflow signal handler counts
Li Zefan (1):
perf: Remove include of cgroup.h from perf_event.h
Masami Hiramatsu (2):
kprobes: Move __kprobes definition into compiler.h
kprobes/x86: Just return error for sanity check failure instead of using BUG_ON
Namhyung Kim (46):
perf evlist: Remove cpus and threads arguments from perf_evlist__new() perf evlist: Use cpu_map__nr() helper
perf evlist: Add thread_map__nr() helper
perf evlist: Pass struct perf_target to perf_evlist__prepare_workload() perf evlist: Do not pass struct record_opts to perf_evlist__prepare_workload() perf evlist: Add want_signal parameter to perf_evlist__prepare_workload() perf stat: Use perf_evlist__prepare/start_workload()
perf annotate: Pass evsel instead of evidx on annotation functions perf annotate: Add a comment on the symbol__parse_objdump_line() perf annotate: Factor out disasm__calc_percent()
perf annotate: Cleanup disasm__calc_percent()
perf annotate: Add basic support to event group view
perf evsel: Introduce perf_evsel__is_group_event() helper
perf annotate: Factor out struct source_line_percent
perf annotate: Support event group view for --print-line
perf annotate browser: Make browser_disasm_line->percent an array perf annotate browser: Use disasm__calc_percent()
perf annotate/gtk: Support event group view on GTK
perf annotate browser: Support event group view on TUI
perf trace: Get rid of a duplicate code
perf tools: Remove unused trace_read_data function
perf tools: Remove unused struct definitions
perf tools: Remove unnecessary calc_data_size variable
perf tools: Remove unused macro definitions
perf tools: Remove duplicated page_size definition
perf evsel: Cleanup perf_evsel__exit()
perf evlist: Introduce perf_evlist__close()
perf trace: Free evlist resources properly on return path
perf record: Fixup return path of cmd_record()
perf tests: Fixup return path of open-syscall-tp-fields test case perf tests: Fixup return path of perf record test case
perf test: Add test case for checking number of EXIT events perf/cgroup: Add __percpu annotation to perf_cgroup->info
perf tests: Add a test case for checking sw clock event frequency perf tools: Get rid of redundant _FILE_OFFSET_BITS definition perf tools: Let get_tracing_file() return NULL to indicate failure. perf tools: Get rid of malloc_or_die() in trace-event-info.c perf tools: Get rid of write_or_die() from trace-event-info.c perf tools: Get rid of die() calls from trace-event-info.c
perf tools: Handle failure case in trace_report()
perf tools: Get rid of malloc_or_die() in trace-event-read.c perf tools: Get rid of read_or_die() in trace-event-read.c
perf tools: Get rid of die() calls in trace-data-read.c
perf tools: Cleanup calc_data_size logic
perf report: Add --no-demangle option
perf tools: Fix output of symbol_daddr offset
Naohiro Aota (1):
perf python: Fix dependency for python/perf.so
Oleg Nesterov (18):
uprobes: Use file_inode()
uprobes: Turn copy_opcode() into copy_from_page()
uprobes: Change __copy_insn() to use copy_from_page()
uprobes: Kill the unnecesary filp != NULL check in __copy_insn()
uprobes: Introduce copy_to_page()
uprobes: Change write_opcode() to use copy_*page() uprobes/tracing: Kill the pointless task_pt_regs() calls uprobes/tracing: Kill the pointless seq_print_ip_sym() call uprobes/tracing: Kill the pointless local_save_flags/preempt_count calls uprobes/tracing: Generalize struct uprobe_trace_entry_head uprobes/tracing: Introduce uprobe_{trace,perf}_print() helpers uprobes/tracing: Introduce is_ret_probe() and uretprobe_dispatcher() uprobes/tracing: Make uprobe_{trace,perf}_print() uretprobe-friendly uprobes/tracing: Make register_uprobe_event() paths uretprobe-friendly uprobes/tracing: Make seq_printf() code uretprobe-friendly uprobes/tracing: Change create_trace_uprobe() to support uretprobes uprobes/tracing: Don't pass addr=ip to perf_trace_buf_submit() uprobes/perf: Avoid perf_trace_buf_prepare/submit if ->perf_events is empty
Stephane Eranian (16):
perf stat: Refactor aggregation code
perf stat: Rename --aggr-socket to --per-socket perf stat: Add per-core aggregation
perf/x86: Improve sysfs event mapping with event string perf/x86: Add flags to event constraints
perf: Add generic memory sampling interface perf/x86: Add memory profiling via PEBS Load Latency perf/x86: Export PEBS load latency threshold register to sysfs perf/x86: Add support for PEBS Precise Store
perf: Add PERF_RECORD_MISC_MMAP_DATA to RECORD_MMAP perf tools: Add mem access sampling core support perf record: Add support for mem access profiling perf report: Add support for mem access profiling perf tools: Add new mem command for memory access profiling perf machine: Detect data vs. text mappings
perf: Fix comments in PERF_MEM_LVL bitmask
Wei Yongjun (1):
perf report: Remove duplicated include
Yan, Zheng (3):
perf/x86: Avoid kfree() in CPU_{STARTING,DYING} perf/x86/intel: Fix SNB-EP CBO and PCU uncore PMU filter management perf/x86/intel: Add Ivy Bridge-EP uncore support
anish kumar (1):
watchdog: Add comments to explain the watchdog_disabled variable
liguang (1):
perf tools: Sort command-list.txt alphabetically
Documentation/trace/uprobetracer.txt | 114 ++--
Makefile | 4 +-
arch/powerpc/include/asm/uprobes.h | 1 +
arch/powerpc/kernel/uprobes.c | 29 +-
arch/s390/oprofile/init.c | 1 +
arch/x86/include/asm/cpufeature.h | 2 +
arch/x86/include/asm/perf_event_p4.h | 62 +-
arch/x86/include/asm/uprobes.h | 1 +
arch/x86/include/uapi/asm/msr-index.h | 5 +
arch/x86/kernel/cpu/Makefile | 2 +-
arch/x86/kernel/cpu/perf_event.c | 89 ++-
arch/x86/kernel/cpu/perf_event.h | 56 +-
arch/x86/kernel/cpu/perf_event_amd.c | 138 +---
arch/x86/kernel/cpu/perf_event_amd_uncore.c | 547 ++++++++++++++++
arch/x86/kernel/cpu/perf_event_intel.c | 38 +-
arch/x86/kernel/cpu/perf_event_intel_ds.c | 182 +++++-
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 876 +++++++++++++++++++++++---
arch/x86/kernel/cpu/perf_event_intel_uncore.h | 64 +-
arch/x86/kernel/cpu/perf_event_p4.c | 9 +-
arch/x86/kernel/kprobes/core.c | 6 +-
arch/x86/kernel/uprobes.c | 29 +
include/linux/compiler.h | 6 +
include/linux/kprobes.h | 6 +-
include/linux/perf_event.h | 24 +-
include/linux/uprobes.h | 8 +
include/uapi/linux/perf_event.h | 71 ++-
kernel/events/core.c | 30 +
kernel/events/uprobes.c | 300 +++++++--
kernel/trace/trace.h | 5 -
kernel/trace/trace_uprobe.c | 203 ++++--
kernel/watchdog.c | 5 +
tools/Makefile | 16 +-
tools/lib/lk/Makefile | 35 +
tools/{perf/util => lib/lk}/debugfs.c | 49 +-
tools/lib/lk/debugfs.h | 29 +
tools/perf/Documentation/perf-annotate.txt | 3 +
tools/perf/Documentation/perf-mem.txt | 48 ++
tools/perf/Documentation/perf-record.txt | 6 +
tools/perf/Documentation/perf-report.txt | 6 +-
tools/perf/Documentation/perf-stat.txt | 12 +-
tools/perf/Documentation/perf-top.txt | 2 +-
tools/perf/MANIFEST | 1 +
tools/perf/Makefile | 61 +-
tools/perf/arch/arm/util/dwarf-regs.c | 5 +-
tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +-
tools/perf/arch/s390/util/dwarf-regs.c | 2 +-
tools/perf/arch/sh/util/dwarf-regs.c | 2 +-
tools/perf/arch/sparc/util/dwarf-regs.c | 2 +-
tools/perf/arch/x86/util/dwarf-regs.c | 2 +-
tools/perf/builtin-annotate.c | 25 +-
tools/perf/builtin-diff.c | 7 +-
tools/perf/builtin-kvm.c | 2 +-
tools/perf/builtin-mem.c | 242 +++++++
tools/perf/builtin-probe.c | 2 +-
tools/perf/builtin-record.c | 15 +-
tools/perf/builtin-report.c | 150 ++++-
tools/perf/builtin-sched.c | 1 -
tools/perf/builtin-stat.c | 398 +++++++-----
tools/perf/builtin-top.c | 9 +-
tools/perf/builtin-trace.c | 28 +-
tools/perf/builtin.h | 1 +
tools/perf/command-list.txt | 15 +-
tools/perf/config/feature-tests.mak | 12 +-
tools/perf/perf.c | 12 +-
tools/perf/perf.h | 1 +
tools/perf/tests/attr.c | 9 +-
tools/perf/tests/attr.py | 5 +-
tools/perf/tests/attr/base-record | 1 +
tools/perf/tests/attr/base-stat | 1 +
tools/perf/tests/attr/test-record-C0 | 13 +
tools/perf/tests/attr/test-stat-C0 | 9 +
tools/perf/tests/bp_signal.c | 186 ++++++
tools/perf/tests/bp_signal_overflow.c | 126 ++++
tools/perf/tests/builtin-test.c | 16 +
tools/perf/tests/evsel-roundtrip-name.c | 4 +-
tools/perf/tests/hists_link.c | 6 +-
tools/perf/tests/mmap-basic.c | 4 +-
tools/perf/tests/open-syscall-tp-fields.c | 10 +-
tools/perf/tests/parse-events.c | 4 +-
tools/perf/tests/perf-record.c | 9 +-
tools/perf/tests/sw-clock.c | 119 ++++
tools/perf/tests/task-exit.c | 123 ++++
tools/perf/tests/tests.h | 4 +
tools/perf/ui/browser.c | 9 +-
tools/perf/ui/browser.h | 1 +
tools/perf/ui/browsers/annotate.c | 158 +++--
tools/perf/ui/browsers/hists.c | 7 +-
tools/perf/ui/browsers/map.c | 60 +-
tools/perf/ui/browsers/scripts.c | 1 -
tools/perf/ui/gtk/annotate.c | 26 +-
tools/perf/ui/gtk/hists.c | 7 +-
tools/perf/ui/hist.c | 7 +-
tools/perf/ui/tui/setup.c | 21 +-
tools/perf/ui/ui.h | 2 +-
tools/perf/util/annotate.c | 262 ++++++--
tools/perf/util/annotate.h | 51 +-
tools/perf/util/cpumap.c | 86 ++-
tools/perf/util/cpumap.h | 12 +
tools/perf/util/debugfs.h | 12 -
tools/perf/util/event.h | 9 +
tools/perf/util/evlist.c | 73 ++-
tools/perf/util/evlist.h | 9 +-
tools/perf/util/evsel.c | 32 +-
tools/perf/util/evsel.h | 25 +
tools/perf/util/header.c | 15 +-
tools/perf/util/hist.c | 110 +++-
tools/perf/util/hist.h | 28 +-
tools/perf/util/machine.c | 64 +-
tools/perf/util/machine.h | 4 +-
tools/perf/util/parse-events.c | 2 +-
tools/perf/util/probe-event.c | 2 +-
tools/perf/util/python-ext-sources | 1 -
tools/perf/util/session.c | 20 +-
tools/perf/util/session.h | 1 -
tools/perf/util/setup.py | 3 +-
tools/perf/util/sort.c | 414 +++++++++++-
tools/perf/util/sort.h | 12 +-
tools/perf/util/symbol-elf.c | 9 +-
tools/perf/util/symbol.c | 1 +
tools/perf/util/symbol.h | 9 +-
tools/perf/util/thread_map.h | 5 +
tools/perf/util/trace-event-info.c | 380 +++++++----
tools/perf/util/trace-event-parse.c | 37 --
tools/perf/util/trace-event-read.c | 473 ++++++--------
tools/perf/util/trace-event.h | 6 +-
tools/perf/util/util.c | 27 +
tools/perf/util/util.h | 9 +-
tools/scripts/Makefile.include | 6 +-
tools/vm/Makefile | 17 +-
tools/vm/page-types.c | 85 +--
130 files changed, 5670 insertions(+), 1708 deletions(-)
create mode 100644 arch/x86/kernel/cpu/perf_event_amd_uncore.c
create mode 100644 tools/lib/lk/Makefile
rename tools/{perf/util => lib/lk}/debugfs.c (68%)
create mode 100644 tools/lib/lk/debugfs.h
create mode 100644 tools/perf/Documentation/perf-mem.txt
create mode 100644 tools/perf/builtin-mem.c
create mode 100644 tools/perf/tests/attr/test-record-C0
create mode 100644 tools/perf/tests/attr/test-stat-C0
create mode 100644 tools/perf/tests/bp_signal.c
create mode 100644 tools/perf/tests/bp_signal_overflow.c
create mode 100644 tools/perf/tests/sw-clock.c
create mode 100644 tools/perf/tests/task-exit.c
delete mode 100644 tools/perf/util/debugfs.hDocumentation/trace/uprobetracer.txt +67 -47
@@ -1,6 +1,8 @@ - Uprobe-tracer: Uprobe-based Event Tracing - ========================================= - Documentation written by Srikar Dronamraju + Uprobe-tracer: Uprobe-based Event Tracing + ========================================= + + Documentation written by Srikar Dronamraju + Overview --------
@@ -13,78 +15,94 @@ current_tracer. Instead of that, add probe points via /sys/kernel/debug/tracing/events/uprobes/<EVENT>/enabled. However unlike kprobe-event tracer, the uprobe event interface expects the -user to calculate the offset of the probepoint in the object +user to calculate the offset of the probepoint in the object. Synopsis of uprobe_tracer ------------------------- - p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a probe + p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a uprobe + r[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a return uprobe (uretprobe) + -:[GRP/]EVENT : Clear uprobe or uretprobe event - GRP : Group name. If omitted, use "uprobes" for it. - EVENT : Event name. If omitted, the event name is generated - based on SYMBOL+offs. - PATH : path to an executable or a library. - SYMBOL[+offs] : Symbol+offset where the probe is inserted. + GRP : Group name. If omitted, "uprobes" is the default value. + EVENT : Event name. If omitted, the event name is generated based + on SYMBOL+offs. + PATH : Path to an executable or a library. + SYMBOL[+offs] : Symbol+offset where the probe is inserted. - FETCHARGS : Arguments. Each probe can have up to 128 args. - %REG : Fetch register REG + FETCHARGS : Arguments. Each probe can have up to 128 args. + %REG : Fetch register REG Event Profiling --------------- - You can check the total number of probe hits and probe miss-hits via +You can check the total number of probe hits and probe miss-hits via /sys/kernel/debug/tracing/uprobe_profile. - The first column is event name, the second is the number of probe hits, +The first column is event name, the second is the number of probe hits, the third is the number of probe miss-hits. Usage examples -------------- -To add a probe as a new event, write a new definition to uprobe_events -as below. + * Add a probe as a new uprobe event, write a new definition to uprobe_events +as below: (sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash) + + echo 'p: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events + + * Add a probe as a new uretprobe event: + + echo 'r: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events + + * Unset registered event: - echo 'p: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events + echo '-:bash_0x4245c0' >> /sys/kernel/debug/tracing/uprobe_events - This sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash + * Print out the events that are registered: - echo > /sys/kernel/debug/tracing/uprobe_events + cat /sys/kernel/debug/tracing/uprobe_events - This clears all probe points. + * Clear all events: -The following example shows how to dump the instruction pointer and %ax -a register at the probed text address. Here we are trying to probe -function zfree in /bin/zsh + echo > /sys/kernel/debug/tracing/uprobe_events + +Following example shows how to dump the instruction pointer and %ax register +at the probed text address. Probe zfree function in /bin/zsh: # cd /sys/kernel/debug/tracing/ - # cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp + # cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp 00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh # objdump -T /bin/zsh | grep -w zfree 0000000000446420 g DF .text 0000000000000012 Base zfree -0x46420 is the offset of zfree in object /bin/zsh that is loaded at -0x00400000. Hence the command to probe would be : + 0x46420 is the offset of zfree in object /bin/zsh that is loaded at + 0x00400000. Hence the command to uprobe would be: + + # echo 'p:zfree_entry /bin/zsh:0x46420 %ip %ax' > uprobe_events + + And the same for the uretprobe would be: - # echo 'p /bin/zsh:0x46420 %ip %ax' > uprobe_events + # echo 'r:zfree_exit /bin/zsh:0x46420 %ip %ax' >> uprobe_events -Please note: User has to explicitly calculate the offset of the probepoint +Please note: User has to explicitly calculate the offset of the probe-point in the object. We can see the events that are registered by looking at the uprobe_events file. # cat uprobe_events - p:uprobes/p_zsh_0x46420 /bin/zsh:0x00046420 arg1=%ip arg2=%ax + p:uprobes/zfree_entry /bin/zsh:0x00046420 arg1=%ip arg2=%ax + r:uprobes/zfree_exit /bin/zsh:0x00046420 arg1=%ip arg2=%ax -The format of events can be seen by viewing the file events/uprobes/p_zsh_0x46420/format +Format of events can be seen by viewing the file events/uprobes/zfree_entry/format - # cat events/uprobes/p_zsh_0x46420/format - name: p_zsh_0x46420 + # cat events/uprobes/zfree_entry/format + name: zfree_entry ID: 922 format: - field:unsigned short common_type; offset:0; size:2; signed:0; - field:unsigned char common_flags; offset:2; size:1; signed:0; - field:unsigned char common_preempt_count; offset:3; size:1; signed:0; - field:int common_pid; offset:4; size:4; signed:1; - field:int common_padding; offset:8; size:4; signed:1; + field:unsigned short common_type; offset:0; size:2; signed:0; + field:unsigned char common_flags; offset:2; size:1; signed:0; + field:unsigned char common_preempt_count; offset:3; size:1; signed:0; + field:int common_pid; offset:4; size:4; signed:1; + field:int common_padding; offset:8; size:4; signed:1; - field:unsigned long __probe_ip; offset:12; size:4; signed:0; - field:u32 arg1; offset:16; size:4; signed:0; - field:u32 arg2; offset:20; size:4; signed:0; + field:unsigned long __probe_ip; offset:12; size:4; signed:0; + field:u32 arg1; offset:16; size:4; signed:0; + field:u32 arg2; offset:20; size:4; signed:0; print fmt: "(%lx) arg1=%lx arg2=%lx", REC->__probe_ip, REC->arg1, REC->arg2
@@ -94,6 +112,7 @@ events, you need to enable it by: # echo 1 > events/uprobes/enable Lets disable the event after sleeping for some time. + # sleep 20 # echo 0 > events/uprobes/enable
@@ -104,10 +123,11 @@ And you can see the traced information via /sys/kernel/debug/tracing/trace. # # TASK-PID CPU# TIMESTAMP FUNCTION # | | | | | - zsh-24842 [006] 258544.995456: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - zsh-24842 [007] 258545.000270: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - zsh-24842 [002] 258545.043929: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - zsh-24842 [004] 258547.046129: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - -Each line shows us probes were triggered for a pid 24842 with ip being -0x446421 and contents of ax register being 79. + zsh-24842 [006] 258544.995456: zfree_entry: (0x446420) arg1=446420 arg2=79 + zsh-24842 [007] 258545.000270: zfree_exit: (0x446540 <- 0x446420) arg1=446540 arg2=0 + zsh-24842 [002] 258545.043929: zfree_entry: (0x446420) arg1=446420 arg2=79 + zsh-24842 [004] 258547.046129: zfree_exit: (0x446540 <- 0x446420) arg1=446540 arg2=0 + +Output shows us uprobe was triggered for a pid 24842 with ip being 0x446420 +and contents of ax register being 79. And uretprobe was triggered with ip at +0x446540 with counterpart function entry at 0x446420.
Makefile +2 -2
@@ -1331,11 +1331,11 @@ kernelversion: # Clear a bunch of variables before executing the submake tools/: FORCE $(Q)mkdir -p $(objtree)/tools - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ tools/%: FORCE $(Q)mkdir -p $(objtree)/tools - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $* + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ $* # Single targets # ---------------------------------------------------------------------------
arch/powerpc/include/asm/uprobes.h +1 -0
@@ -51,4 +51,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);extern bool arch_uprobe_xol_was_trapped (struct task_struct *tsk);extern int arch_uprobe_exception_notify (struct notifier_block *self,unsigned long val,void *data);extern void arch_uprobe_abort_xol (struct arch_uprobe *aup,struct pt_regs *regs); +extern unsigned long arch_uretprobe_hijack_return_addr (unsigned long trampoline_vaddr,struct pt_regs *regs);#endif /* _ASM_UPROBES_H */
arch/powerpc/kernel/uprobes.c +23 -6
@@ -31,6 +31,16 @@#define UPROBE_TRAP_NR UINT_MAX/** +* is_trap_insn - check if the instruction is a trap variant +* @insn: instruction to be checked. +* Returns true if @insn is a trap variant. +*/ +bool is_trap_insn (uprobe_opcode_t *insn) +{ +return (is_trap (*insn)); +} + +/** * arch_uprobe_analyze_insn * @mm: the probed address space. * @arch_uprobe: the probepoint information.
@@ -43,12 +53,6 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,if (addr &0x03 )return -EINVAL ; -/* -* We currently don't support a uprobe on an already -* existing breakpoint instruction underneath -*/ -if (is_trap (auprobe->ainsn)) -return -ENOTSUPP ;return 0 ; }
@@ -188,3 +192,16 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)return false; } + +unsigned long +arch_uretprobe_hijack_return_addr (unsigned long trampoline_vaddr,struct pt_regs *regs) +{ +unsigned long orig_ret_vaddr; + + orig_ret_vaddr = regs->link; + +/* Replace the return addr with trampoline addr */ + regs->link = trampoline_vaddr; + +return orig_ret_vaddr; +}
arch/s390/oprofile/init.c +1 -0
@@ -440,6 +440,7 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)switch (id.machine) {case 0x2097 :case 0x2098 : ops->cpu_type ="s390/z10" ;break ;case 0x2817 :case 0x2818 : ops->cpu_type ="s390/z196" ;break ; +case 0x2827 : ops->cpu_type ="s390/zEC12" ;break ;default :return -ENODEV ; } }
arch/x86/include/asm/cpufeature.h +2 -0
@@ -168,6 +168,7 @@#define X86_FEATURE_TOPOEXT (6*32+22)/* topology extensions CPUID leafs */ #define X86_FEATURE_PERFCTR_CORE (6*32+23)/* core performance counter extensions */ #define X86_FEATURE_PERFCTR_NB (6*32+24)/* NB performance counter extensions */ +#define X86_FEATURE_PERFCTR_L2 (6*32+28)/* L2 performance counter extensions */ /* * Auxiliary flags: Linux defined - For features scattered in various
@@ -311,6 +312,7 @@ extern const char * const x86_power_flags[32];#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ)#define cpu_has_perfctr_core boot_cpu_has(X86_FEATURE_PERFCTR_CORE)#define cpu_has_perfctr_nb boot_cpu_has(X86_FEATURE_PERFCTR_NB) +#define cpu_has_perfctr_l2 boot_cpu_has(X86_FEATURE_PERFCTR_L2)#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8)#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16)#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU)
arch/x86/include/asm/perf_event_p4.h +31 -31
100 lines not on this page · raw message
arch/x86/include/asm/uprobes.h +1 -0
@@ -55,4 +55,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);extern bool arch_uprobe_xol_was_trapped (struct task_struct *tsk);extern int arch_uprobe_exception_notify (struct notifier_block *self,unsigned long val,void *data);extern void arch_uprobe_abort_xol (struct arch_uprobe *aup,struct pt_regs *regs); +extern unsigned long arch_uretprobe_hijack_return_addr (unsigned long trampoline_vaddr,struct pt_regs *regs);#endif /* _ASM_UPROBES_H */
arch/x86/include/uapi/asm/msr-index.h +5 -0
@@ -72,6 +72,7 @@#define MSR_IA32_PEBS_ENABLE 0x000003f1#define MSR_IA32_DS_AREA 0x00000600#define MSR_IA32_PERF_CAPABILITIES 0x00000345 +#define MSR_PEBS_LD_LAT_THRESHOLD 0x000003f6#define MSR_MTRRfix64K_00000 0x00000250#define MSR_MTRRfix16K_80000 0x00000258
@@ -195,6 +196,10 @@#define MSR_AMD64_IBSBRTARGET 0xc001103b#define MSR_AMD64_IBS_REG_COUNT_MAX 8/* includes MSR_AMD64_IBSBRTARGET */ +/* Fam 16h MSRs */ +#define MSR_F16H_L2I_PERF_CTL 0xc0010230 +#define MSR_F16H_L2I_PERF_CTR 0xc0010231 +/* Fam 15h MSRs */ #define MSR_F15H_PERF_CTL 0xc0010200#define MSR_F15H_PERF_CTR 0xc0010201
arch/x86/kernel/cpu/Makefile +1 -1
@@ -31,7 +31,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o ifdef CONFIG_PERF_EVENTS -obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o +obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o perf_event_amd_uncore.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o
arch/x86/kernel/cpu/perf_event.c +68 -21
153 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event.h +52 -4
126 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_amd.c +5 -133
236 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_amd_uncore.c new file +547 -0
547 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_intel.c +37 -1
@@ -81,6 +81,7 @@ static struct event_constraint intel_nehalem_event_constraints[] __read_mostly =static struct extra_reg intel_nehalem_extra_regs[]__read_mostly = {INTEL_EVENT_EXTRA_REG (0xb7 ,MSR_OFFCORE_RSP_0 ,0xffff ,RSP_0 ), +INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x100b ),EVENT_EXTRA_END };
@@ -108,6 +109,8 @@ static struct event_constraint intel_snb_event_constraints[] __read_mostly =INTEL_EVENT_CONSTRAINT (0x48 ,0x4 ),/* L1D_PEND_MISS.PENDING */ INTEL_UEVENT_CONSTRAINT (0x01c0 ,0x2 ),/* INST_RETIRED.PREC_DIST */ INTEL_EVENT_CONSTRAINT (0xcd ,0x8 ),/* MEM_TRANS_RETIRED.LOAD_LATENCY */ +INTEL_UEVENT_CONSTRAINT (0x04a3 ,0xf ),/* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */ +INTEL_UEVENT_CONSTRAINT (0x02a3 ,0x4 ),/* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ EVENT_CONSTRAINT_END };
@@ -136,6 +139,7 @@ static struct extra_reg intel_westmere_extra_regs[] __read_mostly = {INTEL_EVENT_EXTRA_REG (0xb7 ,MSR_OFFCORE_RSP_0 ,0xffff ,RSP_0 ),INTEL_EVENT_EXTRA_REG (0xbb ,MSR_OFFCORE_RSP_1 ,0xffff ,RSP_1 ), +INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x100b ), EVENT_EXTRA_END };
@@ -155,6 +159,8 @@ static struct event_constraint intel_gen_event_constraints[] __read_mostly =static struct extra_reg intel_snb_extra_regs[]__read_mostly = {INTEL_EVENT_EXTRA_REG (0xb7 ,MSR_OFFCORE_RSP_0 ,0x3f807f8fffull ,RSP_0 ),INTEL_EVENT_EXTRA_REG (0xbb ,MSR_OFFCORE_RSP_1 ,0x3f807f8fffull ,RSP_1 ), +INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x01cd ), +INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x01cd ),EVENT_EXTRA_END };
@@ -164,6 +170,21 @@ static struct extra_reg intel_snbep_extra_regs[] __read_mostly = { EVENT_EXTRA_END }; +EVENT_ATTR_STR (mem-loads, mem_ld_nhm,"event=0x0b,umask=0x10,ldlat=3" ); +EVENT_ATTR_STR (mem-loads, mem_ld_snb,"event=0xcd,umask=0x1,ldlat=3" ); +EVENT_ATTR_STR (mem-stores, mem_st_snb,"event=0xcd,umask=0x2" ); + +struct attribute *nhm_events_attrs[] = { +EVENT_PTR (mem_ld_nhm), +NULL , +}; + +struct attribute *snb_events_attrs[] = { +EVENT_PTR (mem_ld_snb), +EVENT_PTR (mem_st_snb), +NULL , +}; +static u64 intel_pmu_event_map (int hw_event) {return intel_perfmon_event_map[hw_event];
@@ -1398,8 +1419,11 @@ x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)if (x86_pmu.event_constraints) {for_each_event_constraint (c, x86_pmu.event_constraints) { -if ((event->hw.config & c->cmask) == c->code) +if ((event->hw.config & c->cmask) == c->code) { +/* hw.flags zeroed at initialization */ + event->hw.flags |= c->flags;return c; + } } }
@@ -1444,6 +1468,7 @@ intel_put_shared_regs_event_constraints(struct cpu_hw_events *cpuc,static void intel_put_event_constraints (struct cpu_hw_events *cpuc,struct perf_event *event) { + event->hw.flags =0 ;intel_put_shared_regs_event_constraints (cpuc, event); }
@@ -1767,6 +1792,8 @@ static void intel_pmu_flush_branch_stack(void)PMU_FORMAT_ATTR (offcore_rsp,"config1:0-63" ); +PMU_FORMAT_ATTR (ldlat,"config1:0-15" ); +static struct attribute *intel_arch3_formats_attr[] = { &format_attr_event.attr, &format_attr_umask.attr,
@@ -1777,6 +1804,7 @@ static struct attribute *intel_arch3_formats_attr[] = { &format_attr_cmask.attr, &format_attr_offcore_rsp.attr,/* XXX do NHM/WSM + SNB breakout */ + &format_attr_ldlat.attr,/* PEBS load latency */ NULL, };
@@ -2037,6 +2065,8 @@ __init int intel_pmu_init(void) x86_pmu.enable_all = intel_pmu_nhm_enable_all; x86_pmu.extra_regs = intel_nehalem_extra_regs; + x86_pmu.cpu_events = nhm_events_attrs; +/* UOPS_ISSUED.STALLED_CYCLES */ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ] = X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
@@ -2080,6 +2110,8 @@ __init int intel_pmu_init(void) x86_pmu.extra_regs = intel_westmere_extra_regs; x86_pmu.er_flags |=ERF_HAS_RSP_1 ; + x86_pmu.cpu_events = nhm_events_attrs; +/* UOPS_ISSUED.STALLED_CYCLES */ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ] = X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
@@ -2111,6 +2143,8 @@ __init int intel_pmu_init(void) x86_pmu.er_flags |=ERF_HAS_RSP_1 ; x86_pmu.er_flags |=ERF_NO_HT_SHARING ; + x86_pmu.cpu_events = snb_events_attrs; +/* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ] = X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
@@ -2140,6 +2174,8 @@ __init int intel_pmu_init(void) x86_pmu.er_flags |=ERF_HAS_RSP_1 ; x86_pmu.er_flags |=ERF_NO_HT_SHARING ; + x86_pmu.cpu_events = snb_events_attrs; +/* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */ intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ] = X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
arch/x86/kernel/cpu/perf_event_intel_ds.c +173 -9
241 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_intel_uncore.c +787 -89
1,119 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_intel_uncore.h +62 -2
81 lines not on this page · raw message
include/uapi/linux/perf_event.h +70 -1
71 lines not on this page · raw message
kernel/events/uprobes.c +251 -49
300 lines not on this page · raw message
kernel/trace/trace_uprobe.c +146 -57
203 lines not on this page · raw message
tools/lib/lk/debugfs.c renamed from tools/perf/util/debugfs.c +18 -31
49 lines not on this page · raw message
tools/perf/Documentation/perf-annotate.txt +3 -0
Lines of this file are not shown. View the raw message.
tools/perf/Documentation/perf-mem.txt new file +48 -0
48 lines not on this page · raw message
tools/perf/Documentation/perf-record.txt +6 -0
Lines of this file are not shown. View the raw message.
tools/perf/Documentation/perf-report.txt +5 -1
Lines of this file are not shown. View the raw message.
tools/perf/Makefile +46 -15
61 lines not on this page · raw message
tools/perf/arch/powerpc/util/dwarf-regs.c +1 -4
Lines of this file are not shown. View the raw message.
tools/perf/arch/sparc/util/dwarf-regs.c +1 -1
Lines of this file are not shown. View the raw message.
tools/perf/builtin-mem.c new file +242 -0
242 lines not on this page · raw message
tools/perf/builtin-report.c +140 -10
150 lines not on this page · raw message
tools/perf/builtin-stat.c +232 -166
398 lines not on this page · raw message
tools/perf/tests/attr/test-record-C0 new file +13 -0
Lines of this file are not shown. View the raw message.
tools/perf/tests/attr/test-stat-C0 new file +9 -0
Lines of this file are not shown. View the raw message.
tools/perf/tests/bp_signal.c new file +186 -0
186 lines not on this page · raw message
tools/perf/tests/bp_signal_overflow.c new file +126 -0
126 lines not on this page · raw message
tools/perf/tests/evsel-roundtrip-name.c +2 -2
Lines of this file are not shown. View the raw message.
tools/perf/tests/open-syscall-tp-fields.c +7 -3
Lines of this file are not shown. View the raw message.
tools/perf/tests/sw-clock.c new file +119 -0
119 lines not on this page · raw message
tools/perf/tests/task-exit.c new file +123 -0
123 lines not on this page · raw message
tools/perf/ui/browsers/annotate.c +98 -60
158 lines not on this page · raw message
tools/perf/ui/browsers/map.c +18 -42
60 lines not on this page · raw message
tools/perf/util/annotate.c +199 -63
262 lines not on this page · raw message
tools/perf/util/annotate.h +31 -20
51 lines not on this page · raw message
tools/perf/util/cpumap.c +74 -12
86 lines not on this page · raw message
tools/perf/util/evlist.c +44 -29
73 lines not on this page · raw message
tools/perf/util/hist.c +100 -10
110 lines not on this page · raw message
tools/perf/util/machine.c +52 -12
64 lines not on this page · raw message
tools/perf/util/sort.c +408 -6
414 lines not on this page · raw message
tools/perf/util/trace-event-info.c +242 -138
380 lines not on this page · raw message
tools/perf/util/trace-event-read.c +177 -296
473 lines not on this page · raw message
tools/vm/page-types.c +7 -78
85 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.