perf changes for v3.16
Subsystems (5)
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: e450f90e8c7d0bf70519223c1b848446ae63f313 Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core
Tooling changes, maintained by Jiri Olsa until Arnaldo is on vacation:
User visible changes:
* Add -F option for specifying output fields (Namhyung Kim)
* Propagate exit status of a command line workload for record command (Namhyung Kim)
* Use tid for finding thread (Namhyung Kim)
* Clarify the output of perf sched map plus small sched command fixies (Dongsheng Yang)
* Wire up perf_regs and unwind support for ARM64 (Jean Pihet)
* Factor hists statistics counts processing which in turn also fixes several bugs in TUI report command (Namhyung Kim)
* Add --percentage option to control absolute/relative percentage output (Namhyung Kim)
* Add --list-cmds to 'kmem', 'mem', 'lock' and 'sched', for use by completion scripts (Ramkumar Ramachandra)
Development/infrastructure changes and fixes:
* Android related fixes for pager and map dso resolving (Michael Lentine)
* Add libdw DWARF post unwind support for ARM (Jean Pihet)
* Consolidate types.h for ARM and ARM64 (Jean Pihet)
* Fix possible null pointer dereference in session.c (Masanari Iida)
* Cleanup, remove unused variables in map_switch_event() (Dongsheng Yang)
* Remove nr_state_machine_bugs in perf latency (Dongsheng Yang)
* Remove usage of trace_sched_wakeup(.success) (Peter Zijlstra)
* Cleanups for perf.h header (Jiri Olsa)
* Consolidate types.h and export.h within tools (Borislav Petkov)
* Move u64_swap union to its single user's header, evsel.h (Borislav Petkov)
* Fix for s390 to properly parse tracepoints plus test code (Alexander Yarygin)
* Handle EINTR error for readn/writen (Namhyung Kim)
* Add a test case for hists filtering (Namhyung Kim)
* Share map_groups among threads of the same group (Arnaldo Carvalho de Melo, Jiri Olsa)
* Making some code (cpu node map and report parse callchain callback) global to be usable by upcomming changes (Don Zickus)
* Fix pmu object compilation error (Jiri Olsa)
Kernel side changes:
* intrusive uprobes fixes from Oleg Nesterov. Since the interface is admin-only, and the bug only affects user-space ("any probed jmp/call can kill the application"), we queued these fixes via the development tree, as a special exception.
* more fuzzer motivated race fixes and related
refactorings/robustization.
* allow PMU drivers to be built as modules. (No actual module yet, because the x86 Intel uncore module wasn't ready in time for this.)
Thanks,
Ingo
------------------>
Alexander Yarygin (3):
perf tools: Parse tracepoints with '-' in system name perf tests: Add numeric identifier to evlist_test perf tests: Add a test of kvm-390: trace event
Arnaldo Carvalho de Melo (2):
perf tools: Allocate thread map_groups's dynamically perf tools: Reference count map_groups objects
Borislav Petkov (4):
perf tools: Move u64_swap union
tools: Unify export.h
tools: Consolidate types.h perf/events/core: Drop unused variable after cleanup
Don Zickus (4):
perf tools: Allow ability to map cpus to nodes easily perf tools: Use cpu/possible instead of cpu/kernel_max perf kmem: Utilize the new generic cpunode_map
perf callchain: Add generic report parse callchain callback function
Dongsheng (3):
perf tools: Add missing event for perf sched record.
perf tools: Adapt the TASK_STATE_TO_CHAR_STR to new value in kernel space. perf tools: Clarify the output of perf sched map.
Dongsheng Yang (2):
perf sched: Remove nr_state_machine_bugs in perf latency perf sched: Cleanup, remove unused variables in map_switch_event()
Jean Pihet (5):
perf tools ARM64: Wire up perf_regs and unwind support perf tools: Consolidate types.h for ARM and ARM64 perf tests: Introduce perf_regs_load function on ARM perf tests: Add dwarf unwind test on ARM
perf tools: Add libdw DWARF post unwind support for ARM
Jiri Olsa (14):
perf tools: Fix pmu object compilation error
perf tests: Add thread maps lookup automated tests perf tools: Share map_groups among threads of the same group perf tests: Add map groups sharing with thread object test perf tools: Remove MAX_COUNTERS define from perf.h perf tools: Remove unlikely define from perf.h
perf tools: Remove min define from perf.h
perf tools: Remove asmlinkage define from perf.h perf tools: Remove PR_TASK_PERF_EVENTS_* from perf.h perf tools: Move sample data structures from perf.h perf tools: Move perf_call_graph_mode enum from perf.h perf tools: Move syscall and arch specific defines from perf.h perf tools: Move sys_perf_event_open function from perf.h perf tools: Move ACCESS_ONCE from perf.h header
Masanari Iida (1):
perf session: Fix possible null pointer dereference in session.c
Michael Lentine (2):
perf tools: Add cat as fallback pager
perf tools: Add automatic remapping of Android libraries
Namhyung Kim (44):
perf hists: Add support for showing relative percentage
perf report: Add --percentage option
perf top: Add --percentage option
perf diff: Add --percentage option
perf tools: Add hist.percentage config option
perf ui/tui: Add 'F' hotkey to toggle percentage output
perf tools: Show absolute percentage by default
perf report: Count number of entries separately
perf hists: Rename hists__inc_stats()
perf hists: Move column length calculation out of hists__inc_stats() perf hists: Add a couple of hists stat helper functions
perf hists: Collapse expanded callchains after filter is applied perf tools: Account entry stats when it's added to the output tree perf hists: Add missing update on filtered stats in hists__decay_entries() perf ui/tui: Fix off-by-one in hist_browser__update_nr_entries() perf ui/tui: Rename hist_browser__update_nr_entries()
perf top/tui: Update nr_entries properly after a filter is applied perf hists/tui: Count callchain rows separately
perf tests: Factor out fake_setup_machine()
perf tests: Add a test case for hists filtering
perf tools: Handle EINTR error for readn/writen
perf record: Propagate exit status of a command line workload perf tools: Get rid of on_exit() feature test
perf tools: Use tid for finding thread
perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt perf tools: Convert sort entries to hpp formats
perf tools: Use hpp formats to sort hist entries
perf tools: Support event grouping in hpp ->sort()
perf tools: Use hpp formats to sort final output
perf tools: Consolidate output field handling to hpp format routines perf ui: Get rid of callback from __hpp__fmt()
perf tools: Allow hpp fields to be sort keys
perf tools: Consolidate management of default sort orders perf tools: Call perf_hpp__init() before setting up GUI browsers perf report: Add -F option to specify output fields
perf tools: Add ->sort() member to struct sort_entry
perf report/tui: Fix a bug when --fields/sort is given
perf top: Add --fields option to specify output fields
perf tools: Skip elided sort entries
perf hists: Reset width of output fields with header length perf tools: Get rid of obsolete hist_entry__sort_list
perf tools: Introduce reset_output_field()
perf tests: Factor out print_hists_*()
perf tests: Add a testcase for histogram output sorting
Oleg Nesterov (15):
uprobes: Kill UPROBE_SKIP_SSTEP and can_skip_sstep()
uprobes/x86: Fold prepare_fixups() into arch_uprobe_analyze_insn()
uprobes/x86: Kill the "ia32_compat" check in handle_riprel_insn(), remove "mm" arg uprobes/x86: Gather "riprel" functions together
uprobes/x86: move the UPROBE_FIX_{RIP,IP,CALL} code at the end of pre/post hooks uprobes/x86: Introduce uprobe_xol_ops and arch_uprobe->ops
uprobes/x86: Conditionalize the usage of handle_riprel_insn()
uprobes/x86: Send SIGILL if arch_uprobe_post_xol() fails
uprobes/x86: Teach arch_uprobe_post_xol() to restart if possible
uprobes/x86: Introduce sizeof_long(), cleanup adjust_ret_addr() and arch_uretprobe_hijack_return_addr() uprobes/x86: Emulate unconditional relative jmp's
uprobes/x86: Emulate nop's using ops->emulate()
uprobes/x86: Emulate relative call's
uprobes/x86: Emulate relative conditional "short" jmp's
uprobes/x86: Emulate relative conditional "near" jmp's
Peter Zijlstra (7):
perf: Ensure consistent inherit state in groups
perf: Always destroy groups on exit
perf: Validate locking assumption
perf: Rework free paths
perf: Simplify perf_event_exit_task_context() perf tools: Remove usage of trace_sched_wakeup(.success)
perf: Fix perf_event_open(.flags) test
Ramkumar Ramachandra (4):
perf kmem: Introduce --list-cmds for use by scripts perf mem: Introduce --list-cmds for use by scripts perf lock: Introduce --list-cmds for use by scripts perf sched: Introduce --list-cmds for use by scripts
Stephane Eranian (1):
fix Haswell precise store data source encoding
Yan, Zheng (3):
perf: Allow building PMU drivers as modules
hrtimer: Export __hrtimer_start_range_ns()
perf/x86: Export perf_assign_events()
arch/x86/include/asm/uprobes.h | 16 +-
arch/x86/kernel/cpu/perf_event.c | 1 +
arch/x86/kernel/cpu/perf_event_intel_ds.c | 22 +-
arch/x86/kernel/uprobes.c | 551 +++++++++++-------
include/linux/perf_event.h | 1 +
include/uapi/linux/perf_event.h | 8 +-
kernel/events/core.c | 117 ++--
kernel/events/uprobes.c | 31 +-
kernel/hrtimer.c | 1 +
tools/include/linux/compiler.h | 2 +
tools/{virtio => include}/linux/export.h | 5 +
.../lockdep/uinclude => include}/linux/types.h | 29 +-
tools/lib/lockdep/Makefile | 2 +-
tools/lib/lockdep/uinclude/linux/export.h | 7 -
tools/perf/Documentation/perf-diff.txt | 26 +-
tools/perf/Documentation/perf-report.txt | 43 +-
tools/perf/Documentation/perf-top.txt | 32 +-
tools/perf/MANIFEST | 2 +
tools/perf/Makefile.perf | 12 +-
tools/perf/arch/arm/Makefile | 7 +
tools/perf/arch/arm/include/perf_regs.h | 7 +-
tools/perf/arch/arm/tests/dwarf-unwind.c | 60 ++
tools/perf/arch/arm/tests/regs_load.S | 58 ++
tools/perf/arch/arm/util/unwind-libdw.c | 36 ++
tools/perf/arch/arm64/Makefile | 7 +
tools/perf/arch/arm64/include/perf_regs.h | 88 +++
tools/perf/arch/arm64/util/dwarf-regs.c | 80 +++
tools/perf/arch/arm64/util/unwind-libunwind.c | 82 +++
tools/perf/arch/x86/include/perf_regs.h | 2 +-
tools/perf/arch/x86/tests/dwarf-unwind.c | 2 +-
tools/perf/arch/x86/util/tsc.c | 2 +-
tools/perf/arch/x86/util/tsc.h | 2 +-
tools/perf/builtin-annotate.c | 3 +-
tools/perf/builtin-diff.c | 50 +-
tools/perf/builtin-inject.c | 2 +-
tools/perf/builtin-kmem.c | 88 +--
tools/perf/builtin-lock.c | 10 +-
tools/perf/builtin-mem.c | 15 +-
tools/perf/builtin-record.c | 158 ++----
tools/perf/builtin-report.c | 196 ++-----
tools/perf/builtin-sched.c | 80 ++-
tools/perf/builtin-top.c | 28 +-
tools/perf/config/Makefile | 20 +-
tools/perf/config/feature-checks/Makefile | 4 -
tools/perf/config/feature-checks/test-all.c | 5 -
tools/perf/config/feature-checks/test-on-exit.c | 16 -
tools/perf/perf-completion.sh | 4 +-
tools/perf/perf-sys.h | 190 +++++++
tools/perf/perf.h | 248 +--------
tools/perf/tests/attr.c | 7 -
tools/perf/tests/builtin-test.c | 18 +-
tools/perf/tests/code-reading.c | 5 +-
tools/perf/tests/dso-data.c | 2 +-
tools/perf/tests/dwarf-unwind.c | 2 +-
tools/perf/tests/evsel-tp-sched.c | 3 -
tools/perf/tests/hists_common.c | 205 +++++++
tools/perf/tests/hists_common.h | 47 ++
tools/perf/tests/hists_filter.c | 290 ++++++++++
tools/perf/tests/hists_link.c | 173 +-----
tools/perf/tests/hists_output.c | 618 +++++++++++++++++++++
tools/perf/tests/keep-tracking.c | 2 +-
tools/perf/tests/mmap-thread-lookup.c | 233 ++++++++
tools/perf/tests/parse-events.c | 142 +++--
tools/perf/tests/parse-no-sample-id-all.c | 2 +-
tools/perf/tests/perf-time-to-tsc.c | 3 +-
tools/perf/tests/rdpmc.c | 2 +-
tools/perf/tests/sample-parsing.c | 2 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/tests/thread-mg-share.c | 90 +++
tools/perf/ui/browser.h | 4 +-
tools/perf/ui/browsers/hists.c | 233 ++++----
tools/perf/ui/gtk/hists.c | 52 +-
tools/perf/ui/hist.c | 252 +++++++--
tools/perf/ui/progress.h | 2 +-
tools/perf/ui/setup.c | 2 -
tools/perf/ui/stdio/hist.c | 81 ++-
tools/perf/util/annotate.h | 2 +-
tools/perf/util/build-id.c | 2 +-
tools/perf/util/build-id.h | 2 +-
tools/perf/util/callchain.c | 78 +++
tools/perf/util/callchain.h | 8 +
tools/perf/util/config.c | 4 +
tools/perf/util/cpumap.c | 160 ++++++
tools/perf/util/cpumap.h | 35 ++
tools/perf/util/dso.h | 2 +-
tools/perf/util/event.c | 4 +-
tools/perf/util/event.h | 24 +
tools/perf/util/evsel.h | 9 +-
tools/perf/util/header.h | 4 +-
tools/perf/util/hist.c | 187 ++++---
tools/perf/util/hist.h | 46 +-
tools/perf/util/include/linux/bitmap.h | 3 +
tools/perf/util/include/linux/export.h | 6 -
tools/perf/util/include/linux/list.h | 1 +
tools/perf/util/include/linux/types.h | 29 -
tools/perf/util/machine.c | 11 +
tools/perf/util/map.c | 118 +++-
tools/perf/util/map.h | 14 +-
tools/perf/util/pager.c | 12 +-
tools/perf/util/parse-events.h | 3 +-
tools/perf/util/parse-events.y | 14 +-
tools/perf/util/perf_regs.h | 2 +-
tools/perf/util/pmu.c | 6 +-
tools/perf/util/pmu.h | 2 +-
tools/perf/util/session.c | 5 +-
tools/perf/util/sort.c | 436 ++++++++++++++-
tools/perf/util/sort.h | 6 +
tools/perf/util/stat.h | 2 +-
tools/perf/util/svghelper.c | 2 +-
tools/perf/util/svghelper.h | 2 +-
tools/perf/util/symbol.h | 4 +-
tools/perf/util/thread.c | 52 +-
tools/perf/util/thread.h | 3 +-
tools/perf/util/top.h | 2 +-
tools/perf/util/types.h | 24 -
tools/perf/util/unwind-libdw.c | 2 +-
tools/perf/util/unwind.h | 2 +-
tools/perf/util/util.c | 2 +
tools/perf/util/util.h | 2 +-
tools/perf/util/values.h | 2 +-
tools/virtio/Makefile | 2 +-
tools/virtio/linux/kernel.h | 7 -
tools/virtio/linux/types.h | 28 -
123 files changed, 4591 insertions(+), 1718 deletions(-)
rename tools/{virtio => include}/linux/export.h (70%)
rename tools/{lib/lockdep/uinclude => include}/linux/types.h (63%)
delete mode 100644 tools/lib/lockdep/uinclude/linux/export.h
create mode 100644 tools/perf/arch/arm/tests/dwarf-unwind.c
create mode 100644 tools/perf/arch/arm/tests/regs_load.S
create mode 100644 tools/perf/arch/arm/util/unwind-libdw.c
create mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/include/perf_regs.h
create mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c
create mode 100644 tools/perf/arch/arm64/util/unwind-libunwind.c
delete mode 100644 tools/perf/config/feature-checks/test-on-exit.c
create mode 100644 tools/perf/perf-sys.h
create mode 100644 tools/perf/tests/hists_common.c
create mode 100644 tools/perf/tests/hists_common.h
create mode 100644 tools/perf/tests/hists_filter.c
create mode 100644 tools/perf/tests/hists_output.c
create mode 100644 tools/perf/tests/mmap-thread-lookup.c
create mode 100644 tools/perf/tests/thread-mg-share.c
delete mode 100644 tools/perf/util/include/linux/export.h
delete mode 100644 tools/perf/util/include/linux/types.h
delete mode 100644 tools/perf/util/types.h
delete mode 100644 tools/virtio/linux/types.harch/x86/include/asm/uprobes.h +14 -2
@@ -33,15 +33,27 @@ typedef u8 uprobe_opcode_t;#define UPROBE_SWBP_INSN 0xcc#define UPROBE_SWBP_INSN_SIZE 1 +struct uprobe_xol_ops ; +struct arch_uprobe { -u16 fixups;union {u8 insn[MAX_UINSN_BYTES ];u8 ixol[MAX_UINSN_BYTES ]; }; + +u16 fixups; +const struct uprobe_xol_ops *ops; + +union {#ifdef CONFIG_X86_64 -unsigned long rip_rela_target_address; +unsigned long rip_rela_target_address;#endif +struct { +s32 offs; +u8 ilen; +u8 opc1; + } branch; + }; };struct arch_uprobe_task {
arch/x86/kernel/cpu/perf_event.c +1 -0
@@ -721,6 +721,7 @@ int perf_assign_events(struct perf_event **events, int n,return sched.state.unassigned; } +EXPORT_SYMBOL_GPL (perf_assign_events);int x86_schedule_events (struct cpu_hw_events *cpuc,int n,int *assign) {
arch/x86/kernel/cpu/perf_event_intel_ds.c +19 -3
@@ -108,15 +108,31 @@ static u64 precise_store_data(u64 status)return val; } -static u64 precise_store_data_hsw (u64 status) +static u64 precise_store_data_hsw (struct perf_event *event,u64 status) {union perf_mem_data_src dse; +u64 cfg = event->hw.config &INTEL_ARCH_EVENT_MASK ; dse.val =0 ; dse.mem_op =PERF_MEM_OP_STORE ; dse.mem_lvl =PERF_MEM_LVL_NA ; + +/* +* L1 info only valid for following events: +* +* MEM_UOPS_RETIRED.STLB_MISS_STORES +* MEM_UOPS_RETIRED.LOCK_STORES +* MEM_UOPS_RETIRED.SPLIT_STORES +* MEM_UOPS_RETIRED.ALL_STORES +*/ +if (cfg !=0x12d0 && cfg !=0x22d0 && cfg !=0x42d0 && cfg !=0x82d0 ) +return dse.mem_lvl; +if (status &1 ) - dse.mem_lvl =PERF_MEM_LVL_L1 ; + dse.mem_lvl =PERF_MEM_LVL_L1 |PERF_MEM_LVL_HIT ; +else + dse.mem_lvl =PERF_MEM_LVL_L1 |PERF_MEM_LVL_MISS ; +/* Nothing else supported. Sorry. */ return dse.val; }
@@ -887,7 +903,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event, data.data_src.val =load_latency_data (pebs->dse); else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW) data.data_src.val = -precise_store_data_hsw (pebs->dse); +precise_store_data_hsw (event, pebs->dse); else data.data_src.val = precise_store_data(pebs->dse); }
arch/x86/kernel/uprobes.c +349 -202
676 lines not on this page · raw message
include/linux/perf_event.h +1 -0
@@ -172,6 +172,7 @@ struct perf_event;struct pmu {struct list_head entry; +struct module *module;struct device *dev;const struct attribute_group **attr_groups;const char *name;
include/uapi/linux/perf_event.h +4 -4
@@ -722,10 +722,10 @@ enum perf_callchain_context { PERF_CONTEXT_MAX = (__u64)-4095, }; -#define PERF_FLAG_FD_NO_GROUP (1U << 0) -#define PERF_FLAG_FD_OUTPUT (1U << 1) -#define PERF_FLAG_PID_CGROUP (1U << 2)/* pid=cgroup id, per-cpu mode only */ -#define PERF_FLAG_FD_CLOEXEC (1U << 3)/* O_CLOEXEC */ +#define PERF_FLAG_FD_NO_GROUP (1UL << 0) +#define PERF_FLAG_FD_OUTPUT (1UL << 1) +#define PERF_FLAG_PID_CGROUP (1UL << 2)/* pid=cgroup id, per-cpu mode only */ +#define PERF_FLAG_FD_CLOEXEC (1UL << 3)/* O_CLOEXEC */ union perf_mem_data_src {__u64 val;
kernel/events/core.c +70 -47
238 lines not on this page · raw message
kernel/events/uprobes.c +9 -22
@@ -60,8 +60,6 @@ static struct percpu_rw_semaphore dup_mmap_sem;/* Have a copy of original instruction */ #define UPROBE_COPY_INSN 0 -/* Can skip singlestep */ -#define UPROBE_SKIP_SSTEP 1struct uprobe {struct rb_node rb_node;/* node in the rb tree */
@@ -491,12 +489,9 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset) uprobe->offset = offset;init_rwsem (&uprobe->register_rwsem);init_rwsem (&uprobe->consumer_rwsem); -/* For now assume that the instruction need not be single-stepped */ -__set_bit (UPROBE_SKIP_SSTEP , &uprobe->flags);/* add to uprobes_tree, sorted on inode:offset */ cur_uprobe =insert_uprobe (uprobe); -/* a uprobe exists for this inode:offset combination */ if (cur_uprobe) {kfree (uprobe);
@@ -1628,20 +1623,6 @@ bool uprobe_deny_signal(void)return true; } -/* -* Avoid singlestepping the original instruction if the original instruction -* is a NOP or can be emulated. -*/ -static bool can_skip_sstep (struct uprobe *uprobe,struct pt_regs *regs) -{ -if (test_bit (UPROBE_SKIP_SSTEP , &uprobe->flags)) { -if (arch_uprobe_skip_sstep (&uprobe->arch, regs)) -return true; -clear_bit (UPROBE_SKIP_SSTEP , &uprobe->flags); - } -return false; -} -static void mmf_recalc_uprobes (struct mm_struct *mm) {struct vm_area_struct *vma;
@@ -1868,13 +1849,13 @@ static void handle_swbp(struct pt_regs *regs)handler_chain (uprobe, regs); -if (can_skip_sstep (uprobe, regs)) +if (arch_uprobe_skip_sstep (&uprobe->arch, regs)) goto out;if (!pre_ssout (uprobe, regs, bp_vaddr))return ; -/* can_skip_sstep() succeeded, or restart if can't singlestep */ +/* arch_uprobe_skip_sstep() succeeded, or restart if can't singlestep */ out:put_uprobe (uprobe); }
@@ -1886,10 +1867,11 @@ out:static void handle_singlestep (struct uprobe_task *utask,struct pt_regs *regs) {struct uprobe *uprobe; +int err =0 ; uprobe = utask->active_uprobe;if (utask->state ==UTASK_SSTEP_ACK ) -arch_uprobe_post_xol (&uprobe->arch, regs); + err =arch_uprobe_post_xol (&uprobe->arch, regs);else if (utask->state ==UTASK_SSTEP_TRAPPED )arch_uprobe_abort_xol (&uprobe->arch, regs);else
@@ -1903,6 +1885,11 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs)spin_lock_irq (¤t->sighand->siglock);recalc_sigpending ();/* see uprobe_deny_signal() */ spin_unlock_irq (¤t->sighand->siglock); + +if (unlikely (err)) { +uprobe_warn (current,"execute the probed insn, sending SIGILL." ); +force_sig_info (SIGILL ,SEND_SIG_FORCED , current); + } }/*
kernel/hrtimer.c +1 -0
@@ -1039,6 +1039,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,return ret; } +EXPORT_SYMBOL_GPL (__hrtimer_start_range_ns);/** * hrtimer_start_range_ns - (re)start an hrtimer on the current CPU
tools/include/linux/compiler.h +2 -0
@@ -35,4 +35,6 @@# define unlikely (x) __builtin_expect(!!(x), 0)#endif +#define ACCESS_ONCE (x) (*(volatile typeof(x) *)&(x)) +#endif /* _TOOLS_LINUX_COMPILER_H */
tools/include/linux/export.h renamed from tools/virtio/linux/export.h +5 -0
@@ -1,5 +1,10 @@ +#ifndef _TOOLS_LINUX_EXPORT_H_ +#define _TOOLS_LINUX_EXPORT_H_ +#define EXPORT_SYMBOL (sym)#define EXPORT_SYMBOL_GPL (sym)#define EXPORT_SYMBOL_GPL_FUTURE (sym)#define EXPORT_UNUSED_SYMBOL (sym)#define EXPORT_UNUSED_SYMBOL_GPL (sym) + +#endif
tools/include/linux/types.h renamed from tools/lib/lockdep/uinclude/linux/types.h +23 -6
@@ -1,8 +1,9 @@ -#ifndef _LIBLOCKDEP_LINUX_TYPES_H_ -#define _LIBLOCKDEP_LINUX_TYPES_H_ +#ifndef _TOOLS_LINUX_TYPES_H_ +#define _TOOLS_LINUX_TYPES_H_#include <stdbool.h> #include <stddef.h> +#include <stdint.h> #define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ #include <asm/types.h>
@@ -10,10 +11,22 @@struct page ;struct kmem_cache ; -typedef unsigned gfp_t ; +typedef enum { +GFP_KERNEL , +GFP_ATOMIC , + __GFP_HIGHMEM, + __GFP_HIGH +}gfp_t ; -typedef __u64 u64 ; -typedef __s64 s64 ; +/* +* We define u64 as uint64_t for every architecture +* so that we can print it with "%"PRIx64 without getting warnings. +* +* typedef __u64 u64; +* typedef __s64 s64; +*/ +typedef uint64_t u64 ; +typedef int64_t s64 ;typedef __u32 u32 ;typedef __s32 s32 ;
@@ -35,6 +48,10 @@ typedef __s8 s8;#define __bitwise#endif +#define __force +#define __user +#define __must_check +#define __coldtypedef __u16 __bitwise __le16 ;typedef __u16 __bitwise __be16 ;
@@ -55,4 +72,4 @@ struct hlist_node { struct hlist_node *next, **pprev; }; -#endif +#endif /* _TOOLS_LINUX_TYPES_H_ */
tools/lib/lockdep/Makefile +1 -1
@@ -105,7 +105,7 @@ N = export Q VERBOSE -INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES) +INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include -I../../include $(CONFIG_INCLUDES) # Set compile option CFLAGS if not set elsewhere CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
tools/lib/lockdep/uinclude/linux/export.h deleted +0 -7
@@ -1,7 +0,0 @@ -#ifndef _LIBLOCKDEP_LINUX_EXPORT_H_ -#define _LIBLOCKDEP_LINUX_EXPORT_H_ - -#define EXPORT_SYMBOL (sym) -#define EXPORT_SYMBOL_GPL (sym) - -#endif
tools/perf/Documentation/perf-diff.txt +21 -5
@@ -33,21 +33,25 @@ OPTIONS -d:: --dsos=:: Only consider symbols in these dsos. CSV that understands - file://filename entries. + file://filename entries. This option will affect the percentage + of the Baseline/Delta column. See --percentage for more info. -C:: --comms=:: Only consider symbols in these comms. CSV that understands - file://filename entries. + file://filename entries. This option will affect the percentage + of the Baseline/Delta column. See --percentage for more info. -S:: --symbols=:: Only consider these symbols. CSV that understands - file://filename entries. + file://filename entries. This option will affect the percentage + of the Baseline/Delta column. See --percentage for more info. -s:: --sort=:: - Sort by key(s): pid, comm, dso, symbol. + Sort by key(s): pid, comm, dso, symbol, cpu, parent, srcline. + Please see description of --sort in the perf-report man page. -t:: --field-separator=::
@@ -89,6 +93,14 @@ OPTIONS --order:: Specify compute sorting column number. +--percentage:: + Determine how to display the overhead percentage of filtered entries. + Filters can be applied by --comms, --dsos and/or --symbols options. + + "relative" means it's relative to filtered entries only so that the + sum of shown entries will be always 100%. "absolute" means it retains + the original value before and after the filter is applied. + COMPARISON ---------- The comparison is governed by the baseline file. The baseline perf.data
@@ -157,6 +169,10 @@ with: - period_percent being the % of the hist entry period value within single data file + - with filtering by -C, -d and/or -S, period_percent might be changed + relative to how entries are filtered. Use --percentage=absolute to + prevent such fluctuation. + ratio ~~~~~ If specified the 'Ratio' column is displayed with value 'r' computed as:
@@ -187,4 +203,4 @@ If specified the 'Weighted diff' column is displayed with value 'd' computed as: SEE ALSO -------- -linkperf:perf-record[1] +linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/Documentation/perf-report.txt +37 -6
76 lines not on this page · raw message
tools/perf/Documentation/perf-top.txt +27 -5
@@ -113,7 +113,17 @@ Default is to monitor all CPUS. -s:: --sort:: Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight, - local_weight, abort, in_tx, transaction + local_weight, abort, in_tx, transaction, overhead, sample, period. + Please see description of --sort in the perf-report man page. + +--fields=:: + Specify output field - multiple keys can be specified in CSV format. + Following fields are available: + overhead, overhead_sys, overhead_us, sample and period. + Also it can contain any sort key(s). + + By default, every sort keys not specified in --field will be appended + automatically. -n:: --show-nr-samples::
@@ -123,13 +133,16 @@ Default is to monitor all CPUS. Show a column with the sum of periods. --dsos:: - Only consider symbols in these dsos. + Only consider symbols in these dsos. This option will affect the + percentage of the overhead column. See --percentage for more info. --comms:: - Only consider symbols in these comms. + Only consider symbols in these comms. This option will affect the + percentage of the overhead column. See --percentage for more info. --symbols:: - Only consider these symbols. + Only consider these symbols. This option will affect the + percentage of the overhead column. See --percentage for more info. -M:: --disassembler-style=:: Set disassembler style for objdump.
@@ -165,6 +178,15 @@ Default is to monitor all CPUS. Do not show entries which have an overhead under that percent. (Default: 0). +--percentage:: + Determine how to display the overhead percentage of filtered entries. + Filters can be applied by --comms, --dsos and/or --symbols options and + Zoom operations on the TUI (thread, dso, etc). + + "relative" means it's relative to filtered entries only so that the + sum of shown entries will be always 100%. "absolute" means it retains + the original value before and after the filter is applied. + INTERACTIVE PROMPTING KEYS --------------------------
@@ -200,4 +222,4 @@ Pressing any unmapped key displays a menu, and prompts for input. SEE ALSO -------- -linkperf:perf-stat[1], linkperf:perf-list[1] +linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-report[1]
tools/perf/MANIFEST +2 -0
@@ -7,6 +7,8 @@ tools/lib/symbol/kallsyms.h tools/include/asm/bug.h tools/include/linux/compiler.h tools/include/linux/hash.h +tools/include/linux/export.h +tools/include/linux/types.h include/linux/const.h include/linux/perf_event.h include/linux/rbtree.h
tools/perf/Makefile.perf +8 -4
@@ -222,12 +222,12 @@ LIB_H += util/include/linux/const.h LIB_H += util/include/linux/ctype.h LIB_H += util/include/linux/kernel.h LIB_H += util/include/linux/list.h -LIB_H += util/include/linux/export.h +LIB_H += ../include/linux/export.h LIB_H += util/include/linux/poison.h LIB_H += util/include/linux/rbtree.h LIB_H += util/include/linux/rbtree_augmented.h LIB_H += util/include/linux/string.h -LIB_H += util/include/linux/types.h +LIB_H += ../include/linux/types.h LIB_H += util/include/linux/linkage.h LIB_H += util/include/asm/asm-offsets.h LIB_H += ../include/asm/bug.h
@@ -252,7 +252,6 @@ LIB_H += util/event.h LIB_H += util/evsel.h LIB_H += util/evlist.h LIB_H += util/exec_cmd.h -LIB_H += util/types.h LIB_H += util/levenshtein.h LIB_H += util/machine.h LIB_H += util/map.h
@@ -397,7 +396,10 @@ LIB_OBJS += $(OUTPUT)tests/rdpmc.o LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o LIB_OBJS += $(OUTPUT)tests/pmu.o +LIB_OBJS += $(OUTPUT)tests/hists_common.o LIB_OBJS += $(OUTPUT)tests/hists_link.o +LIB_OBJS += $(OUTPUT)tests/hists_filter.o +LIB_OBJS += $(OUTPUT)tests/hists_output.o LIB_OBJS += $(OUTPUT)tests/python-use.o LIB_OBJS += $(OUTPUT)tests/bp_signal.o LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
@@ -410,10 +412,12 @@ LIB_OBJS += $(OUTPUT)tests/code-reading.o LIB_OBJS += $(OUTPUT)tests/sample-parsing.o LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o ifndef NO_DWARF_UNWIND -ifeq ($(ARCH),x86) +ifeq ($(ARCH),$(filter $(ARCH),x86 arm)) LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o endif endif +LIB_OBJS += $(OUTPUT)tests/mmap-thread-lookup.o +LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
tools/perf/arch/arm/Makefile +7 -0
@@ -5,3 +5,10 @@ endif ifndef NO_LIBUNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o endif +ifndef NO_LIBDW_DWARF_UNWIND +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o +endif +ifndef NO_DWARF_UNWIND +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o +endif
tools/perf/arch/arm/include/perf_regs.h +6 -1
@@ -2,10 +2,15 @@#define ARCH_PERF_REGS_H #include <stdlib.h> -#include "../../util/types.h" +#include <linux/types.h> #include <asm/perf_regs.h> +void perf_regs_load (u64 *regs); +#define PERF_REGS_MASK ((1ULL << PERF_REG_ARM_MAX) - 1) +#define PERF_REGS_MAX PERF_REG_ARM_MAX +#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32 +#define PERF_REG_IP PERF_REG_ARM_PC#define PERF_REG_SP PERF_REG_ARM_SP
tools/perf/arch/arm/tests/dwarf-unwind.c new file +60 -0
60 lines not on this page · raw message
tools/perf/arch/arm/tests/regs_load.S new file +58 -0
58 lines not on this page · raw message
tools/perf/arch/arm/util/unwind-libdw.c new file +36 -0
@@ -0,0 +1,36 @@ +#include <elfutils/libdwfl.h> +#include "../../util/unwind-libdw.h" +#include "../../util/perf_regs.h" + +bool libdw__arch_set_initial_registers (Dwfl_Thread *thread,void *arg) +{ +struct unwind_info *ui = arg; +struct regs_dump *user_regs = &ui->sample->user_regs; +Dwarf_Word dwarf_regs[PERF_REG_ARM_MAX ]; + +#define REG (r) ({ \ + Dwarf_Word val = 0; \ + perf_reg_value(&val, user_regs, PERF_REG_ARM_##r); \ + val; \ +}) + + dwarf_regs[0 ] =REG (R0 ); + dwarf_regs[1 ] =REG (R1 ); + dwarf_regs[2 ] =REG (R2 ); + dwarf_regs[3 ] =REG (R3 ); + dwarf_regs[4 ] =REG (R4 ); + dwarf_regs[5 ] =REG (R5 ); + dwarf_regs[6 ] =REG (R6 ); + dwarf_regs[7 ] =REG (R7 ); + dwarf_regs[8 ] =REG (R8 ); + dwarf_regs[9 ] =REG (R9 ); + dwarf_regs[10 ] =REG (R10 ); + dwarf_regs[11 ] =REG (FP ); + dwarf_regs[12 ] =REG (IP ); + dwarf_regs[13 ] =REG (SP ); + dwarf_regs[14 ] =REG (LR ); + dwarf_regs[15 ] =REG (PC ); + +return dwfl_thread_state_registers (thread,0 ,PERF_REG_ARM_MAX , + dwarf_regs); +}
tools/perf/arch/arm64/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +ifndef NO_DWARF +PERF_HAVE_DWARF_REGS := 1 +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o +endif +ifndef NO_LIBUNWIND +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o +endif
tools/perf/arch/arm64/include/perf_regs.h new file +88 -0
88 lines not on this page · raw message
tools/perf/arch/arm64/util/dwarf-regs.c new file +80 -0
80 lines not on this page · raw message
tools/perf/arch/arm64/util/unwind-libunwind.c new file +82 -0
82 lines not on this page · raw message
tools/perf/arch/x86/include/perf_regs.h +1 -1
@@ -2,7 +2,7 @@#define ARCH_PERF_REGS_H #include <stdlib.h> -#include "../../util/types.h" +#include <linux/types.h> #include <asm/perf_regs.h> void perf_regs_load (u64 *regs);
tools/perf/arch/x86/tests/dwarf-unwind.c +1 -1
@@ -23,7 +23,7 @@ static int sample_ustack(struct perf_sample *sample, sp = (unsigned long ) regs[PERF_REG_X86_SP ]; - map =map_groups__find (&thread->mg,MAP__VARIABLE , (u64 ) sp); + map =map_groups__find (thread->mg,MAP__VARIABLE , (u64 ) sp);if (!map) {pr_debug ("failed to get stack map\n" );free (buf);
tools/perf/arch/x86/util/tsc.c +1 -1
@@ -4,7 +4,7 @@#include <linux/perf_event.h> #include "../../perf.h" -#include "../../util/types.h" +#include <linux/types.h> #include "../../util/debug.h" #include "tsc.h"
tools/perf/arch/x86/util/tsc.h +1 -1
@@ -1,7 +1,7 @@ #ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ #define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ -#include "../../util/types.h" +#include <linux/types.h> struct perf_tsc_conversion { u16 time_shift;
tools/perf/builtin-annotate.c +1 -2
@@ -46,7 +46,7 @@ struct perf_annotate { };static int perf_evsel__add_sample (struct perf_evsel *evsel, -struct perf_sample *sample, +struct perf_sample *sample__maybe_unused ,struct addr_location *al,struct perf_annotate *ann) {
@@ -70,7 +70,6 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,return -ENOMEM ; ret =hist_entry__inc_addr_samples (he, evsel->idx, al->addr); - evsel->hists.stats.total_period += sample->period;hists__inc_nr_events (&evsel->hists,PERF_RECORD_SAMPLE );return ret; }
tools/perf/builtin-diff.c +36 -14
125 lines not on this page · raw message
tools/perf/builtin-inject.c +1 -1
@@ -209,7 +209,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, cpumode = event->header.misc &PERF_RECORD_MISC_CPUMODE_MASK ; - thread =machine__findnew_thread (machine, sample->pid, sample->pid); + thread =machine__findnew_thread (machine, sample->pid, sample->tid);if (thread ==NULL ) {pr_err ("problem processing %d event, skipping it.\n" , event->header.type);
tools/perf/builtin-kmem.c +9 -79
132 lines not on this page · raw message
tools/perf/builtin-lock.c +6 -4
@@ -961,8 +961,10 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)"perf lock info [<options>]" ,NULL }; -const char *const lock_usage[] = { -"perf lock [<options>] {record|report|script|info}" , +const char *const lock_subcommands[] = {"record" ,"report" ,"script" , +"info" ,NULL }; +const char *lock_usage[] = { +NULL ,NULL }; const char * const report_usage[] = {
@@ -976,8 +978,8 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)for (i =0 ; i <LOCKHASH_SIZE ; i++)INIT_LIST_HEAD (lockhash_table + i); - argc =parse_options (argc, argv, lock_options, lock_usage, -PARSE_OPT_STOP_AT_NON_OPTION ); + argc =parse_options_subcommand (argc, argv, lock_options, lock_subcommands, + lock_usage,PARSE_OPT_STOP_AT_NON_OPTION );if (!argc)usage_with_options (lock_usage, lock_options);
tools/perf/builtin-mem.c +8 -7
@@ -21,11 +21,6 @@ struct perf_mem {DECLARE_BITMAP (cpu_bitmap,MAX_NR_CPUS ); }; -static const char *const mem_usage[] = { -"perf mem [<options>] {record <command> |report}" , -NULL -}; -static int __cmd_record (int argc,const char **argv) {int rec_argc, i =0 , j;
@@ -220,9 +215,15 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused) " between columns '.' is reserved."), OPT_END() }; +const char *const mem_subcommands[] = {"record" ,"report" ,NULL }; +const char *mem_usage[] = { +NULL , +NULL + }; + - argc =parse_options (argc, argv, mem_options, mem_usage, -PARSE_OPT_STOP_AT_NON_OPTION ); + argc =parse_options_subcommand (argc, argv, mem_options, mem_subcommands, + mem_usage,PARSE_OPT_STOP_AT_NON_OPTION );if (!argc || !(strncmp (argv[0 ],"rec" ,3 ) || mem_operation))usage_with_options (mem_usage, mem_options);
tools/perf/builtin-record.c +60 -98
292 lines not on this page · raw message
tools/perf/builtin-report.c +58 -138
332 lines not on this page · raw message
tools/perf/builtin-sched.c +39 -41
155 lines not on this page · raw message
tools/perf/config/feature-checks/Makefile +0 -4
Lines of this file are not shown. View the raw message.
tools/perf/config/feature-checks/test-all.c +0 -5
Lines of this file are not shown. View the raw message.
tools/perf/config/feature-checks/test-on-exit.c deleted +0 -16
Lines of this file are not shown. View the raw message.
tools/perf/perf-sys.h new file +190 -0
190 lines not on this page · raw message
tools/perf/perf.h +9 -239
248 lines not on this page · raw message
tools/perf/tests/hists_common.c new file +205 -0
205 lines not on this page · raw message
tools/perf/tests/hists_common.h new file +47 -0
47 lines not on this page · raw message
tools/perf/tests/hists_filter.c new file +290 -0
290 lines not on this page · raw message
tools/perf/tests/hists_link.c +6 -167
173 lines not on this page · raw message
tools/perf/tests/hists_output.c new file +618 -0
618 lines not on this page · raw message
tools/perf/tests/mmap-thread-lookup.c new file +233 -0
233 lines not on this page · raw message
tools/perf/tests/parse-events.c +97 -45
142 lines not on this page · raw message
tools/perf/tests/parse-no-sample-id-all.c +1 -1
Lines of this file are not shown. View the raw message.
tools/perf/tests/thread-mg-share.c new file +90 -0
90 lines not on this page · raw message
tools/perf/ui/browsers/hists.c +140 -93
233 lines not on this page · raw message
tools/perf/ui/gtk/hists.c +12 -40
52 lines not on this page · raw message
tools/perf/ui/hist.c +205 -47
252 lines not on this page · raw message
tools/perf/ui/stdio/hist.c +31 -50
81 lines not on this page · raw message
tools/perf/util/callchain.c +78 -0
78 lines not on this page · raw message
tools/perf/util/cpumap.c +160 -0
160 lines not on this page · raw message
tools/perf/util/hist.c +102 -85
187 lines not on this page · raw message
tools/perf/util/hist.h +43 -3
46 lines not on this page · raw message
tools/perf/util/include/linux/export.h deleted +0 -6
Lines of this file are not shown. View the raw message.
tools/perf/util/include/linux/types.h deleted +0 -29
Lines of this file are not shown. View the raw message.
tools/perf/util/map.c +117 -1
118 lines not on this page · raw message
tools/perf/util/sort.c +412 -24
436 lines not on this page · raw message
tools/perf/util/thread.c +40 -12
52 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.