perf updates for v4.11
Subsystems (9)
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: 0c8967c9df230d2c4dde6649f410b62e01806c22 Merge tag 'perf-core-for-mingo-4.11-20170215' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
On the kernel side the main changes in this cycle were:
- Add Intel Kaby Lake CPU support (Srinivas Pandruvada)
- AMD uncore driver updates for fam17 (Janakarajan Natarajan)
- Intel/PT updates and core events optimizations and cleanups (Alexander Shishkin)
- cgroups events fixes (David Carrillo-Cisneros)
- kprobes improvements (Masami Hiramatsu)
- ... plus misc fixes and updates.
On the tooling side the main changes were:
- Support clang build in tools/{perf,lib/{bpf,traceevent,api}} with CC=clang, to, for instance, take advantage of better warnings (Arnaldo Carvalho de Melo):
- Introduce the 'delta-abs' 'perf diff' compute method, that orders the histogram entries by the absolute value of the percentage delta for a function in two perf.data files, i.e. the functions that changed the most (increase or decrease in samples) comes first (Namhyung Kim)
- Add support for parsing Intel uncore vendor event files and add uncore vendor events for the Intel server processors (Haswell, Broadwell, IvyBridge), Xeon Phi (Knights Landing) and Broadwell DE (Andi Kleen)
- Introduce 'perf ftrace' a perf front end to the kernel's ftrace function and function_graph tracer, defaulting to the "function_graph" tracer, more work will be done in reviving this effort, forward porting it from its initial patch submission (Namhyung Kim)
- Add 'e' and 'c' hotkeys to expand/collapse call chains for a single hist entry in the 'perf report' and 'perf top' TUI (Jiri Olsa)
- Account thread wait time (off CPU time) separately: sleep, iowait and preempt, based on the prev_state of the last event, show the breakdown when using "perf sched timehist --state" (Namhyumg Kim)
- Add more triggers to switch the output file (perf.data.TIMESTAMP).
Now, in addition to switching to a different output file when receiving a SIGUSR2, one can also specify file size and time based triggers:
perf record -a --switch-output=signal
is equivalent to what we had before:
perf record -a --switch-output
While we can also ask for the file to be "sliced" by size, taking into account that that will happen only when we get woken up by the kernel, i.e. one has to take into account the --mmap-pages (the size of the perf mmap ring buffer):
perf record -a --switch-output=2G
will break the perf.data output into multiple files limited to 2GB of samples, right when generating the output.
For time based samples, alert() will be used, so to have 1 minute limited perf.data output files:
perf record -a --switch-output=1m
(Jiri Olsa)
- Improve 'perf trace' (Arnaldo Carvalho de Melo)
- 'perf kallsyms' toy tool to look for extended symbol information on the running kernel and demonstrate the machine/thread/symbol APIs for use in other tools, such as 'perf probe' (Arnaldo Carvalho de Melo)
- ... plus tons of other changes, see the shortlog and Git log for details.
Thanks,
Ingo
------------------>
Alexander Shishkin (5):
perf/core: Don't re-schedule CPU flexible events needlessly perf/core: Optimize event rescheduling on active contexts perf/x86/intel/pt: Add format strings for PTWRITE and power event tracing perf/core: Do error out on a kernel filter on an exclude_filter event perf/core: Allow kernel filters on CPU events
Andi Kleen (12):
perf pmu: Factor out scale conversion code
perf jevents: Parse eventcode as number
perf jevents: Add support for parsing uncore json files
perf pmu: Support per pmu json aliases
perf pmu: Support event aliases for non cpu// pmus
perf list: Add debug support for outputing alias string
perf vendor events intel: Add uncore events for Haswell Server processor perf vendor events intel: Add uncore events for Broadwell Server perf vendor events intel: Add uncore events for IvyBridge Server perf vendor events intel: Add uncore events for Sandy Bridge Server perf vendor events intel: Add uncore events for Xeon Phi (Knights Landing) perf vendor events intel: Add uncore events for Broadwell DE
Arnaldo Carvalho de Melo (39):
tools lib subcmd: Add missing linux/kernel.h include to subcmd.h
perf machine: Add a kallsyms loading constructor
perf kallsyms: Introduce tool to look for extended symbol information on the running kernel perf trace: Allow specifying list of syscalls and events in -e/--expr/--event
tools: Sync x86's vmx.h with the kernel
perf scripting perl: Do not die() when not founding event for a type
perf ftrace: Make 'function_graph' be the default tracer
perf config: Do not consider an error not to have any perfconfig file
perf tools: Propagate perf_config() errors
perf tools: Fix include of linux/mman.h
tools include: Add a __fallthrough statement
tools string: Use __fallthrough in perf_atoll()
tools strfilter: Use __fallthrough
perf top: Use __fallthrough
perf thread_map: Correctly size buffer used with dirent->dt_name
perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
perf bench numa: Avoid possible truncation when using snprintf()
perf tests: Avoid possible truncation with dirent->d_name + snprintf
perf intel-pt: Use __fallthrough
tools include: Introduce linux/compiler-gcc.h
tools lib traceevent plugin function: Initialize 'index' variable
perf evsel: Inform how to make a sysctl setting permanent
perf symbols: No need to check if sym->name is NULL
perf tests record: No need to test an array against NULL
perf symbols: dso->name is an array, no need to check it against NULL
tools: Suppress request for warning options not existent in clang
tools: Set the maximum optimization level according to the compiler being used tools lib subcmd: Make it an error to pass a signed value to OPTION_UINTEGER Revert "perf bench futex: Sanitize numeric parameters"
perf bench numa: Make sure dprintf() is not defined
perf tests: Synthesize struct instead of using field after variable sized type perf record: Do not put a variable sized type not at the end of a struct perf tools: Do not put a variable sized type not at the end of a struct perf probe: Avoid accessing uninitialized 'map' variable
perf evsel: Do not put a variable sized type not at the end of a struct perf intel pt decoder: clang has no -Wno-override-init
perf tools: Be consistent on the type of map->symbols[] interator
perf pmu: Fix check for unset alias->unit array
perf tools: Add missing parse_events_error() prototype
Borislav Petkov (1):
perf/x86/events: Add an AMD-specific Makefile
David Carrillo-Cisneros (4):
perf tools: Remove unneccessary feature-dwarf warning perf/core: Make cgroup switch visit only cpuctxs with cgroup events perf/core: Remove perf_cpu_context::unique_pmu
tools lib traceevent: Robustify do_generate_dynamic_list_file
He Kuang (3):
perf probe: Fix wrong register name for arm64 perf tools arm64: Add support for generating bpf prologue perf bpf: Add missing newline in debug messages
Ingo Molnar (1):
tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.h, {tools/,}arch/x86/include/asm/cpufeatures.h and {tools/,}arch/arm/include/uapi/asm/kvm.h
Janakarajan Natarajan (3):
perf/x86/amd/uncore: Rename 'L2' to 'LLC' perf/x86/amd/uncore: Update the number of uncore counters perf/x86/amd/uncore: Update sysfs attributes for Family17h processors
Jiri Olsa (10):
perf tools: Add unit_number__scnprintf function
perf record: Add struct switch_output
perf record: Change switch-output option to take optional argument perf record: Add switch-output size option argument
perf record: Add switch-output size warning
perf record: Add switch-output time option argument
perf hists browser: Put hist_entry folding logic into single function perf hists browser: Add e/c hotkeys to expand/collapse callchain for current entry perf c2c report: Display Total records column in offset view
perf c2c report: Coalesce by default only by pid,iaddr
Joe Stringer (10):
tools lib bpf: Fix map offsets in relocation tools lib bpf: Define prog_type fns with macro tools lib bpf: Add set/is helpers for all prog types tools lib bpf: Add libbpf_get_error()
tools lib bpf: Add BPF program pinning APIs tools lib bpf: Add bpf_map__pin()
tools lib bpf: Add bpf_object__pin()
tools perf util: Make rm_rf(path) argument const tools lib api fs: Add bpf_fs filesystem detector perf test: Add libbpf pinning test
Josh Poimboeuf (1):
tools build: Add tools tree support for 'make -s'
Kan Liang (1):
perf/core: Try parent PMU first when initializing a child event
Krister Johansen (1):
perf callchain: Reference count maps
Laura Abbott (1):
perf jvmti: Create libdir directory before installing libperf-jvmti.so
Markus Elfring (2):
perf probe: Delete an unnecessary check in try_to_find_absolute_address() perf probe: Delete an unnecessary assignment in try_to_find_absolute_address()
Masami Hiramatsu (3):
kprobes, extable: Identify kprobes trampolines as kernel text area kprobes/arm64: Remove a redundant dependency from the Kconfig kprobes/x86: Use hlist_for_each_entry() instead of hlist_for_each_entry_safe()
Matija Glavinic Pecotic (1):
perf unwind: Fix looking up dwarf unwind stack info
Michael Petlan (1):
perf script: Fix man page about --dump-raw-trace option
Mickaël Salaün (4):
tools lib bpf: Add missing header to the library samples/bpf: Add missing header samples/bpf: Ignore already processed ELF sections samples/bpf: Reset global variables
Namhyung Kim (10):
perf sched timehist: Account thread wait time separately perf sched timehist: Add --state option
perf sched timehist: Show total wait times for summary perf util: Save pid-cmdline mapping into tracing header perf util: Add more debug message on failure path perf ftrace: Introduce new 'ftrace' tool
perf diff: Add 'delta-abs' compute method
perf diff: Add diff.order config option
perf diff: Add diff.compute config option
perf diff: Change default setting to "delta-abs"
Ravi Bangoria (1):
perf sdt: Show proper hint when event not yet in place via 'perf probe'
Soramichi AKIYAMA (3):
tools lib subcmd: Fix missing member name
perf tools: Move two variables usied in libperf from perf.c perf evlist: Fix typo in deliver_sample()
Soramichi Akiyama (1):
perf evlist: Fix typo in perf_evlist__start_workload()
Srinivas Pandruvada (1):
perf/x86/intel: Add Kaby Lake support
Steven Rostedt (VMware) (1):
tools lib traceevent: Initialize lenght on OLD_RING_BUFFER_TYPE_TIME_STAMP
Taeung Song (7):
perf ftrace: Remove needless code setting default tracer perf tools: Create for_each_event macro for tracepoints iteration perf ftrace: Add ftrace.tracer config option
perf tools: Only increase index if perf_evsel__new_idx() succeeds perf tools: Add missing check for failure in a zalloc() call perf tools: Use zfree() instead of ad hoc equivalent perf tools: Use zfree() to avoid keeping dangling pointers
Uwe Kleine-König (1):
perf probe: Add option --symfs
Victor Kamensky (1):
perf symbols: Take into account symfs setting when reading file build ID
Wang YanQing (1):
perf scripting perl: Fix compile error with some perl5 versions
Yannick Brosseau (1):
perf script: Also allow forcing reading of non-root owned files by root
Makefile | 6 +- arch/arm64/Kconfig | 2 +- arch/x86/events/Makefile | 13 +- arch/x86/events/amd/Makefile | 7 + arch/x86/events/amd/uncore.c | 204 ++++++++----- arch/x86/events/intel/cstate.c | 3 + arch/x86/events/intel/pt.c | 6 + arch/x86/events/intel/rapl.c | 3 + arch/x86/events/intel/uncore.c | 2 + arch/x86/kernel/kprobes/core.c | 2 +- include/linux/kprobes.h | 30 +- include/linux/perf_event.h | 4 +- kernel/events/core.c | 266 ++++++++++------- kernel/extable.c | 9 +- kernel/kprobes.c | 73 +++-- samples/bpf/bpf_load.c | 7 + samples/bpf/tracex5_kern.c | 1 + tools/arch/arm/include/uapi/asm/kvm.h | 9 + tools/arch/powerpc/include/uapi/asm/kvm.h | 5 + tools/arch/x86/include/asm/cpufeatures.h | 11 + tools/arch/x86/include/uapi/asm/vmx.h | 5 + tools/build/Makefile.build | 10 + tools/include/linux/compiler-gcc.h | 14 + tools/include/linux/compiler.h | 9 + tools/lib/api/Makefile | 8 +- tools/lib/api/fs/fs.c | 16 + tools/lib/api/fs/fs.h | 1 + tools/lib/api/fs/tracing_path.c | 32 +- tools/lib/bpf/bpf.h | 1 + tools/lib/bpf/libbpf.c | 264 +++++++++++++++-- tools/lib/bpf/libbpf.h | 19 +- tools/lib/subcmd/Makefile | 8 +- tools/lib/subcmd/parse-options.c | 4 + tools/lib/subcmd/parse-options.h | 19 +- tools/lib/traceevent/Makefile | 14 +- tools/lib/traceevent/kbuffer-parse.c | 1 + tools/lib/traceevent/plugin_function.c | 2 +- tools/perf/Build | 5 +- tools/perf/Documentation/perf-c2c.txt | 2 +- tools/perf/Documentation/perf-config.txt | 12 + tools/perf/Documentation/perf-diff.txt | 15 +- tools/perf/Documentation/perf-ftrace.txt | 36 +++ tools/perf/Documentation/perf-kallsyms.txt | 24 ++ tools/perf/Documentation/perf-record.txt | 14 +- tools/perf/Documentation/perf-sched.txt | 2 + tools/perf/Documentation/perf-script.txt | 4 +- tools/perf/Documentation/perf-trace.txt | 8 +- tools/perf/MANIFEST | 1 + tools/perf/Makefile.config | 10 +- tools/perf/Makefile.perf | 1 + tools/perf/arch/arm64/Makefile | 1 + tools/perf/arch/arm64/include/dwarf-regs-table.h | 12 +- tools/perf/arch/arm64/util/dwarf-regs.c | 15 +- tools/perf/bench/futex-hash.c | 4 - tools/perf/bench/futex-lock-pi.c | 3 - tools/perf/bench/futex-requeue.c | 2 - tools/perf/bench/futex-wake-parallel.c | 4 - tools/perf/bench/futex-wake.c | 3 - tools/perf/bench/futex.h | 4 - tools/perf/bench/numa.c | 7 +- tools/perf/builtin-c2c.c | 3 +- tools/perf/builtin-diff.c | 78 ++++- tools/perf/builtin-ftrace.c | 265 +++++++++++++++++ tools/perf/builtin-help.c | 8 +- tools/perf/builtin-kallsyms.c | 67 +++++ tools/perf/builtin-kmem.c | 12 +- tools/perf/builtin-list.c | 3 + tools/perf/builtin-probe.c | 2 + tools/perf/builtin-record.c | 177 +++++++++-- tools/perf/builtin-report.c | 4 +- tools/perf/builtin-sched.c | 132 ++++++++- tools/perf/builtin-script.c | 3 +- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-top.c | 8 +- tools/perf/builtin-trace.c | 120 ++++++-- tools/perf/builtin.h | 2 + tools/perf/command-list.txt | 2 + tools/perf/perf.c | 20 +- .../arch/x86/broadwellde/uncore-cache.json | 317 ++++++++++++++++++++ .../arch/x86/broadwellde/uncore-memory.json | 83 ++++++ .../arch/x86/broadwellde/uncore-power.json | 84 ++++++ .../arch/x86/broadwellx/uncore-cache.json | 317 ++++++++++++++++++++ .../arch/x86/broadwellx/uncore-interconnect.json | 28 ++ .../arch/x86/broadwellx/uncore-memory.json | 83 ++++++ .../arch/x86/broadwellx/uncore-power.json | 84 ++++++ .../pmu-events/arch/x86/haswellx/uncore-cache.json | 317 ++++++++++++++++++++ .../arch/x86/haswellx/uncore-interconnect.json | 28 ++ .../arch/x86/haswellx/uncore-memory.json | 83 ++++++ .../pmu-events/arch/x86/haswellx/uncore-power.json | 84 ++++++ .../pmu-events/arch/x86/ivytown/uncore-cache.json | 322 +++++++++++++++++++++ .../arch/x86/ivytown/uncore-interconnect.json | 46 +++ .../pmu-events/arch/x86/ivytown/uncore-memory.json | 75 +++++ .../pmu-events/arch/x86/ivytown/uncore-power.json | 249 ++++++++++++++++ .../pmu-events/arch/x86/jaketown/uncore-cache.json | 209 +++++++++++++ .../arch/x86/jaketown/uncore-interconnect.json | 46 +++ .../arch/x86/jaketown/uncore-memory.json | 79 +++++ .../pmu-events/arch/x86/jaketown/uncore-power.json | 248 ++++++++++++++++ .../arch/x86/knightslanding/uncore-memory.json | 42 +++ tools/perf/pmu-events/jevents.c | 84 +++++- tools/perf/pmu-events/jevents.h | 4 +- tools/perf/pmu-events/pmu-events.h | 3 + tools/perf/tests/Build | 1 + tools/perf/tests/bpf.c | 42 ++- tools/perf/tests/builtin-test.c | 4 + tools/perf/tests/llvm.c | 2 +- tools/perf/tests/parse-events.c | 8 +- tools/perf/tests/parse-no-sample-id-all.c | 19 +- tools/perf/tests/perf-record.c | 2 +- tools/perf/tests/tests.h | 1 + tools/perf/tests/unit_number__scnprintf.c | 37 +++ tools/perf/ui/browsers/hists.c | 60 ++-- tools/perf/ui/setup.c | 1 + tools/perf/util/Build | 1 + tools/perf/util/bpf-loader.c | 4 +- tools/perf/util/callchain.c | 16 +- tools/perf/util/config.c | 23 +- tools/perf/util/data-convert-bt.c | 7 +- tools/perf/util/dso.c | 48 ++- tools/perf/util/event.c | 2 +- tools/perf/util/evlist.c | 12 +- tools/perf/util/evlist.h | 2 + tools/perf/util/evsel.c | 66 ++--- tools/perf/util/evsel_fprintf.c | 1 - tools/perf/util/header.c | 7 +- tools/perf/util/hist.c | 4 +- tools/perf/util/intel-pt-decoder/Build | 6 +- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 + .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 + tools/perf/util/intel-pt.c | 4 +- tools/perf/util/llvm-utils.c | 4 +- tools/perf/util/machine.c | 25 +- tools/perf/util/machine.h | 1 + tools/perf/util/map.c | 4 +- tools/perf/util/parse-events.c | 84 +++--- tools/perf/util/parse-events.y | 37 ++- tools/perf/util/pmu.c | 113 +++++--- tools/perf/util/pmu.h | 1 + tools/perf/util/probe-event.c | 13 +- tools/perf/util/scripting-engines/Build | 2 +- .../perf/util/scripting-engines/trace-event-perl.c | 10 +- tools/perf/util/session.c | 4 +- tools/perf/util/strfilter.c | 1 + tools/perf/util/string.c | 2 + tools/perf/util/symbol.c | 6 +- tools/perf/util/symbol_fprintf.c | 2 +- tools/perf/util/thread_map.c | 2 +- tools/perf/util/trace-event-info.c | 71 +++-- tools/perf/util/trace-event-parse.c | 17 ++ tools/perf/util/trace-event-read.c | 77 ++++- tools/perf/util/trace-event.h | 1 + tools/perf/util/unwind-libunwind-local.c | 54 +++- tools/perf/util/util.c | 15 +- tools/perf/util/util.h | 3 +- tools/scripts/Makefile.include | 17 +- 154 files changed, 5373 insertions(+), 682 deletions(-) create mode 100644 arch/x86/events/amd/Makefile create mode 100644 tools/include/linux/compiler-gcc.h create mode 100644 tools/perf/Documentation/perf-ftrace.txt create mode 100644 tools/perf/Documentation/perf-kallsyms.txt create mode 100644 tools/perf/builtin-ftrace.c create mode 100644 tools/perf/builtin-kallsyms.c create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/uncore-memory.json create mode 100644 tools/perf/tests/unit_number__scnprintf.c
Makefile +4 -2
@@ -87,10 +87,12 @@ endif ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) quiet=silent_ + tools_silent=s endif else # make-3.8x ifneq ($(filter s% -s%,$(MAKEFLAGS)),) quiet=silent_ + tools_silent=-s endif endif
@@ -1607,11 +1609,11 @@ endif # Clear a bunch of variables before executing the submake tools/: FORCE $(Q)mkdir -p $(objtree)/tools - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ tools/%: FORCE $(Q)mkdir -p $(objtree)/tools - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $* + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $* # Single targets # ---------------------------------------------------------------------------
arch/arm64/Kconfig +1 -1
@@ -96,7 +96,7 @@ config ARM64 select HAVE_RCU_TABLE_FREE select HAVE_SYSCALL_TRACEPOINTS select HAVE_KPROBES - select HAVE_KRETPROBES if HAVE_KPROBES + select HAVE_KRETPROBES select IOMMU_DMA if IOMMU_SUPPORT select IRQ_DOMAIN select IRQ_FORCED_THREADING
arch/x86/events/Makefile +3 -10
@@ -1,11 +1,4 @@ -obj-y += core.o - -obj-$(CONFIG_CPU_SUP_AMD) += amd/core.o amd/uncore.o -obj-$(CONFIG_PERF_EVENTS_AMD_POWER) += amd/power.o -obj-$(CONFIG_X86_LOCAL_APIC) += amd/ibs.o msr.o -ifdef CONFIG_AMD_IOMMU -obj-$(CONFIG_CPU_SUP_AMD) += amd/iommu.o -endif - -obj-$(CONFIG_CPU_SUP_INTEL) += msr.o +obj-y += core.o +obj-y += amd/ +obj-$(CONFIG_X86_LOCAL_APIC) += msr.o obj-$(CONFIG_CPU_SUP_INTEL) += intel/
arch/x86/events/amd/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +obj-$(CONFIG_CPU_SUP_AMD) += core.o uncore.o +obj-$(CONFIG_PERF_EVENTS_AMD_POWER) += power.o +obj-$(CONFIG_X86_LOCAL_APIC) += ibs.o +ifdef CONFIG_AMD_IOMMU +obj-$(CONFIG_CPU_SUP_AMD) += iommu.o +endif +
arch/x86/events/amd/uncore.c +132 -72
352 lines not on this page · raw message
arch/x86/events/intel/cstate.c +3 -0
@@ -541,6 +541,9 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {X86_CSTATES_MODEL (INTEL_FAM6_SKYLAKE_MOBILE , snb_cstates),X86_CSTATES_MODEL (INTEL_FAM6_SKYLAKE_DESKTOP , snb_cstates), +X86_CSTATES_MODEL (INTEL_FAM6_KABYLAKE_MOBILE , snb_cstates), +X86_CSTATES_MODEL (INTEL_FAM6_KABYLAKE_DESKTOP , snb_cstates), +X86_CSTATES_MODEL (INTEL_FAM6_XEON_PHI_KNL , knl_cstates), X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNM, knl_cstates), { },
arch/x86/events/intel/pt.c +6 -0
@@ -99,18 +99,24 @@ static struct attribute_group pt_cap_group = { };PMU_FORMAT_ATTR (cyc,"config:1" ); +PMU_FORMAT_ATTR (pwr_evt,"config:4" ); +PMU_FORMAT_ATTR (fup_on_ptw,"config:5" );PMU_FORMAT_ATTR (mtc,"config:9" );PMU_FORMAT_ATTR (tsc,"config:10" );PMU_FORMAT_ATTR (noretcomp,"config:11" ); +PMU_FORMAT_ATTR (ptw,"config:12" );PMU_FORMAT_ATTR (mtc_period,"config:14-17" );PMU_FORMAT_ATTR (cyc_thresh,"config:19-22" );PMU_FORMAT_ATTR (psb_period,"config:24-27" );static struct attribute *pt_formats_attr[] = { &format_attr_cyc.attr, + &format_attr_pwr_evt.attr, + &format_attr_fup_on_ptw.attr, &format_attr_mtc.attr, &format_attr_tsc.attr, &format_attr_noretcomp.attr, + &format_attr_ptw.attr, &format_attr_mtc_period.attr, &format_attr_cyc_thresh.attr, &format_attr_psb_period.attr,
arch/x86/events/intel/rapl.c +3 -0
@@ -771,6 +771,9 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst = {X86_RAPL_MODEL_MATCH (INTEL_FAM6_SKYLAKE_DESKTOP , skl_rapl_init),X86_RAPL_MODEL_MATCH (INTEL_FAM6_SKYLAKE_X , hsx_rapl_init), +X86_RAPL_MODEL_MATCH (INTEL_FAM6_KABYLAKE_MOBILE , skl_rapl_init), +X86_RAPL_MODEL_MATCH (INTEL_FAM6_KABYLAKE_DESKTOP , skl_rapl_init), + X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init), {}, };
arch/x86/events/intel/uncore.c +2 -0
@@ -1328,6 +1328,8 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {X86_UNCORE_MODEL_MATCH (INTEL_FAM6_SKYLAKE_DESKTOP ,skl_uncore_init),X86_UNCORE_MODEL_MATCH (INTEL_FAM6_SKYLAKE_MOBILE , skl_uncore_init),X86_UNCORE_MODEL_MATCH (INTEL_FAM6_SKYLAKE_X , skx_uncore_init), +X86_UNCORE_MODEL_MATCH (INTEL_FAM6_KABYLAKE_MOBILE , skl_uncore_init), + X86_UNCORE_MODEL_MATCH(INTEL_FAM6_KABYLAKE_DESKTOP, skl_uncore_init), {}, };
arch/x86/kernel/kprobes/core.c +1 -1
@@ -745,7 +745,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)* will be the real return address, and all the rest will * point to kretprobe_trampoline. */ -hlist_for_each_entry_safe (ri, tmp, head, hlist) { +hlist_for_each_entry (ri, head, hlist) {if (ri->task != current)/* another task is sharing our hash bucket */ continue ;
include/linux/kprobes.h +29 -1
@@ -278,9 +278,13 @@ struct kprobe_insn_cache {int nr_garbage; }; +#ifdef __ARCH_WANT_KPROBES_INSN_SLOTextern kprobe_opcode_t *__get_insn_slot (struct kprobe_insn_cache *c);extern void __free_insn_slot (struct kprobe_insn_cache *c,kprobe_opcode_t *slot,int dirty); +/* sleep-less address checking routine */ +extern bool __is_insn_slot_addr (struct kprobe_insn_cache *c, +unsigned long addr);#define DEFINE_INSN_CACHE_OPS (__name) \ extern struct kprobe_insn_cache kprobe_##__name##_slots; \
@@ -294,6 +298,18 @@ static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\ { \ __free_insn_slot(&kprobe_##__name##_slots, slot, dirty); \ } \ + \ +static inline bool is_kprobe_##__name##_slot(unsigned long addr) \ +{ \ + return __is_insn_slot_addr(&kprobe_##__name##_slots, addr); \ +} +#else /* __ARCH_WANT_KPROBES_INSN_SLOT */ +#define DEFINE_INSN_CACHE_OPS (__name) \ +static inline bool is_kprobe_##__name##_slot(unsigned long addr) \ +{ \ + return 0; \ +} +#endif DEFINE_INSN_CACHE_OPS (insn);
@@ -330,7 +346,6 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos);#endif -#endif /* CONFIG_OPTPROBES */ #ifdef CONFIG_KPROBES_ON_FTRACE extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
@@ -481,6 +496,19 @@ static inline int enable_jprobe(struct jprobe *jp)return enable_kprobe (&jp->kp); } +#ifndef CONFIG_KPROBES +static inline bool is_kprobe_insn_slot (unsigned long addr) +{ +return false; +} +#endif +#ifndef CONFIG_OPTPROBES +static inline bool is_kprobe_optinsn_slot (unsigned long addr) +{ +return false; +} +#endif +#ifdef CONFIG_KPROBES /* * Blacklist ganerating macro. Specify functions which is not probed
include/linux/perf_event.h +3 -1
@@ -482,6 +482,7 @@ struct perf_addr_filter {* @list: list of filters for this event * @lock: spinlock that serializes accesses to the @list and event's * (and its children's) filter generations. +* @nr_file_filters: number of file-based filters * * A child event will use parent's @list (and therefore @lock), so they are * bundled together; see perf_event_addr_filters().
@@ -489,6 +490,7 @@ struct perf_addr_filter {struct perf_addr_filters_head {struct list_head list;raw_spinlock_t lock; +unsigned int nr_file_filters; };/**
@@ -785,9 +787,9 @@ struct perf_cpu_context {ktime_t hrtimer_interval;unsigned int hrtimer_active; -struct pmu *unique_pmu;#ifdef CONFIG_CGROUP_PERF struct perf_cgroup *cgrp; +struct list_head cgrp_cpuctx_entry;#endif struct list_head sched_cb_entry;
kernel/events/core.c +157 -109
459 lines not on this page · raw message
kernel/extable.c +8 -1
@@ -20,6 +20,7 @@#include <linux/module.h> #include <linux/mutex.h> #include <linux/init.h> +#include <linux/kprobes.h> #include <asm/sections.h> #include <linux/uaccess.h>
@@ -104,6 +105,8 @@ int __kernel_text_address(unsigned long addr)return 1 ;if (is_ftrace_trampoline (addr))return 1 ; +if (is_kprobe_optinsn_slot (addr) ||is_kprobe_insn_slot (addr)) +return 1 ;/* * There might be init symbols in saved stacktraces. * Give those symbols a chance to be printed in
@@ -123,7 +126,11 @@ int kernel_text_address(unsigned long addr)return 1 ;if (is_module_text_address (addr))return 1 ; -return is_ftrace_trampoline (addr); +if (is_ftrace_trampoline (addr)) +return 1 ; +if (is_kprobe_optinsn_slot (addr) ||is_kprobe_insn_slot (addr)) +return 1 ; +return 0 ; }/*
kernel/kprobes.c +54 -19
126 lines not on this page · raw message
samples/bpf/bpf_load.c +7 -0
@@ -277,6 +277,11 @@ int load_bpf_file(char *path)Elf_Data *data, *data_prog, *symbols =NULL ;char *shname, *shname_prog; +/* reset global variables */ + kern_version =0 ; +memset (license,0 ,sizeof (license)); +memset (processed_sec,0 ,sizeof (processed_sec)); +if (elf_version (EV_CURRENT ) ==EV_NONE )return 1 ;
@@ -328,6 +333,8 @@ int load_bpf_file(char *path)/* load programs that need map fixup (relocations) */ for (i =1 ; i < ehdr.e_shnum; i++) { +if (processed_sec[i]) +continue ;if (get_sec (elf, i, &ehdr, &shname, &shdr, &data))continue ;
samples/bpf/tracex5_kern.c +1 -0
@@ -8,6 +8,7 @@#include <linux/version.h> #include <uapi/linux/bpf.h> #include <uapi/linux/seccomp.h> +#include <uapi/linux/unistd.h> #include "bpf_helpers.h" #define PROG (F ) SEC("kprobe/"__stringify(F)) int bpf_func_##F
tools/arch/arm/include/uapi/asm/kvm.h +9 -0
@@ -84,6 +84,15 @@ struct kvm_regs {#define KVM_VGIC_V2_DIST_SIZE 0x1000#define KVM_VGIC_V2_CPU_SIZE 0x2000 +/* Supported VGICv3 address types */ +#define KVM_VGIC_V3_ADDR_TYPE_DIST 2 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 +#define KVM_VGIC_ITS_ADDR_TYPE 4 + +#define KVM_VGIC_V3_DIST_SIZE SZ_64K +#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K) +#define KVM_ARM_VCPU_POWER_OFF 0/* CPU is started in OFF state */ #define KVM_ARM_VCPU_PSCI_0_2 1/* CPU uses PSCI v0.2 */
tools/arch/powerpc/include/uapi/asm/kvm.h +5 -0
@@ -573,6 +573,10 @@ struct kvm_get_htab_header {#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba)#define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) +/* POWER9 registers */ +#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) +#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) +/* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs */
@@ -596,6 +600,7 @@ struct kvm_get_htab_header {#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67)#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68)#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) +#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a)/* PPC64 eXternal Interrupt Controller Specification */ #define KVM_DEV_XICS_GRP_SOURCES 1/* 64-bit source attributes */
tools/arch/x86/include/asm/cpufeatures.h +11 -0
@@ -105,6 +105,7 @@#define X86_FEATURE_AMD_DCM ( 3*32+27)/* multi-node processor */ #define X86_FEATURE_APERFMPERF ( 3*32+28)/* APERFMPERF */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30)/* TSC doesn't stop in S3 state */ +#define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31)/* TSC has known frequency */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ #define X86_FEATURE_XMM3 ( 4*32+ 0)/* "pni" SSE-3 */
@@ -188,10 +189,14 @@#define X86_FEATURE_CPB ( 7*32+ 2)/* AMD Core Performance Boost */ #define X86_FEATURE_EPB ( 7*32+ 3)/* IA32_ENERGY_PERF_BIAS support */ +#define X86_FEATURE_CAT_L3 ( 7*32+ 4)/* Cache Allocation Technology L3 */ +#define X86_FEATURE_CAT_L2 ( 7*32+ 5)/* Cache Allocation Technology L2 */ +#define X86_FEATURE_CDP_L3 ( 7*32+ 6)/* Code and Data Prioritization L3 */ #define X86_FEATURE_HW_PSTATE ( 7*32+ 8)/* AMD HW-PState */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ +#define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ #define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ #define X86_FEATURE_AVX512_4VNNIW (7*32+16)/* AVX-512 Neural Network Instructions */ #define X86_FEATURE_AVX512_4FMAPS (7*32+17)/* AVX-512 Multiply Accumulation Single precision */
@@ -220,11 +225,13 @@#define X86_FEATURE_RTM ( 9*32+11)/* Restricted Transactional Memory */ #define X86_FEATURE_CQM ( 9*32+12)/* Cache QoS Monitoring */ #define X86_FEATURE_MPX ( 9*32+14)/* Memory Protection Extension */ +#define X86_FEATURE_RDT_A ( 9*32+15)/* Resource Director Technology Allocation */ #define X86_FEATURE_AVX512F ( 9*32+16)/* AVX-512 Foundation */ #define X86_FEATURE_AVX512DQ ( 9*32+17)/* AVX-512 DQ (Double/Quad granular) Instructions */ #define X86_FEATURE_RDSEED ( 9*32+18)/* The RDSEED instruction */ #define X86_FEATURE_ADX ( 9*32+19)/* The ADCX and ADOX instructions */ #define X86_FEATURE_SMAP ( 9*32+20)/* Supervisor Mode Access Prevention */ +#define X86_FEATURE_AVX512IFMA ( 9*32+21)/* AVX-512 Integer Fused Multiply-Add instructions */ #define X86_FEATURE_CLFLUSHOPT ( 9*32+23)/* CLFLUSHOPT instruction */ #define X86_FEATURE_CLWB ( 9*32+24)/* CLWB instruction */ #define X86_FEATURE_AVX512PF ( 9*32+26)/* AVX-512 Prefetch */
@@ -278,8 +285,10 @@#define X86_FEATURE_AVIC (15*32+13)/* Virtual Interrupt Controller */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ +#define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_RDPID (16*32+ 22)/* RDPID instruction */ /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */ #define X86_FEATURE_OVERFLOW_RECOV (17*32+0)/* MCA overflow recovery support */
@@ -310,4 +319,6 @@#define X86_BUG_NULL_SEG X86_BUG(10)/* Nulling a selector preserves the base */ #define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ #define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ +#define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ +#endif /* _ASM_X86_CPUFEATURES_H */
tools/arch/x86/include/uapi/asm/vmx.h +5 -0
@@ -65,6 +65,8 @@#define EXIT_REASON_TPR_BELOW_THRESHOLD 43#define EXIT_REASON_APIC_ACCESS 44#define EXIT_REASON_EOI_INDUCED 45 +#define EXIT_REASON_GDTR_IDTR 46 +#define EXIT_REASON_LDTR_TR 47#define EXIT_REASON_EPT_VIOLATION 48#define EXIT_REASON_EPT_MISCONFIG 49#define EXIT_REASON_INVEPT 50
@@ -113,6 +115,8 @@ { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, \ { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, \ { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, \ + { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, \ + { EXIT_REASON_LDTR_TR, "LDTR_TR" }, \ { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, \ { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, \ { EXIT_REASON_INVEPT, "INVEPT" }, \
@@ -129,6 +133,7 @@ { EXIT_REASON_XRSTORS, "XRSTORS" }#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 +#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4#endif /* _UAPIVMX_H */
tools/build/Makefile.build +10 -0
@@ -19,6 +19,16 @@ else Q=@ endif +ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) + quiet=silent_ +endif +else # make-3.8x +ifneq ($(filter s% -s%,$(MAKEFLAGS)),) + quiet=silent_ +endif +endif + build-dir := $(srctree)/tools/build # Define $(fixdep) for dep-cmd function
tools/include/linux/compiler-gcc.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _TOOLS_LINUX_COMPILER_H_ +#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead." +#endif + +/* +* Common definitions for all gcc versions go here. +*/ +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + +#if GCC_VERSION >=70000 && !defined(__CHECKER__) +# define __fallthrough __attribute__ ((fallthrough)) +#endif
tools/include/linux/compiler.h +9 -0
@@ -1,6 +1,10 @@#ifndef _TOOLS_LINUX_COMPILER_H_#define _TOOLS_LINUX_COMPILER_H_ +#ifdef __GNUC__ +#include <linux/compiler-gcc.h> +#endif +/* Optimization barrier */ /* The "volatile" is due to gcc bugs */ #define barrier () __asm__ __volatile__("": : :"memory")
@@ -126,4 +130,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s#define WRITE_ONCE (x, val) \ ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) + +#ifndef __fallthrough +# define __fallthrough +#endif +#endif /* _TOOLS_LINUX_COMPILER_H */
tools/lib/api/Makefile +7 -1
@@ -17,7 +17,13 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libapi.a CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC + +ifeq ($(CC), clang) + CFLAGS += -O3 +else + CFLAGS += -O6 +endif # Treat warnings as errors unless directed not to ifneq ($(WERROR),0)
tools/lib/api/fs/fs.c +16 -0
@@ -38,6 +38,10 @@#define HUGETLBFS_MAGIC 0x958458f6#endif +#ifndef BPF_FS_MAGIC +#define BPF_FS_MAGIC 0xcafe4a11 +#endif +static const char *const sysfs__fs_known_mountpoints[] = {"/sys" ,0 ,
@@ -75,6 +79,11 @@ static const char * const hugetlbfs__known_mountpoints[] = { 0, }; +static const char *const bpf_fs__known_mountpoints[] = { +"/sys/fs/bpf" , +0 , +}; +struct fs {const char *name;const char *const *mounts;
@@ -89,6 +98,7 @@ enum {FS__DEBUGFS =2 ,FS__TRACEFS =3 ,FS__HUGETLBFS =4 , + FS__BPF_FS = 5, };#ifndef TRACEFS_MAGIC
@@ -121,6 +131,11 @@ static struct fs fs__entries[] = { .mounts = hugetlbfs__known_mountpoints, .magic = HUGETLBFS_MAGIC, }, + [FS__BPF_FS] = { + .name = "bpf", + .mounts = bpf_fs__known_mountpoints, + .magic = BPF_FS_MAGIC, + }, };static bool fs__read_mounts (struct fs *fs)
@@ -280,6 +295,7 @@ FS(procfs, FS__PROCFS);FS (debugfs,FS__DEBUGFS );FS (tracefs,FS__TRACEFS );FS (hugetlbfs,FS__HUGETLBFS ); +FS (bpf_fs,FS__BPF_FS );int filename__read_int (const char *filename,int *value) {
tools/lib/api/fs/fs.h +1 -0
@@ -22,6 +22,7 @@ FS(procfs) FS(debugfs) FS(tracefs) FS(hugetlbfs) +FS(bpf_fs)#undef FS
tools/lib/api/fs/tracing_path.c +18 -14
@@ -86,9 +86,13 @@ void put_tracing_file(char *file)free (file); } -static int strerror_open (int err,char *buf,size_t size,const char *filename) +int tracing_path__strerror_open_tp (int err,char *buf,size_t size, +const char *sys,const char *name) {char sbuf[128 ]; +char filename[PATH_MAX ]; + +snprintf (filename,PATH_MAX ,"%s/%s" , sys, name ?:"*" );switch (err) {case ENOENT :
@@ -99,10 +103,19 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)* - jirka */ if (debugfs__configured () ||tracefs__configured ()) { -snprintf (buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n" , - tracing_events_path, filename); +/* sdt markers */ +if (!strncmp (filename,"sdt_" ,4 )) { +snprintf (buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tSDT event cannot be directly recorded on.\n" +"\tPlease first use 'perf probe %s:%s' before recording it.\n" , + tracing_events_path, filename, sys, name); + }else { +snprintf (buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n" , + tracing_events_path, filename); + }break ; } snprintf(buf, size, "%s",
@@ -125,12 +138,3 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)return 0 ; } - -int tracing_path__strerror_open_tp (int err,char *buf,size_t size,const char *sys,const char *name) -{ -char path[PATH_MAX ]; - -snprintf (path,PATH_MAX ,"%s/%s" , sys, name ?:"*" ); - -return strerror_open (err, buf, size, path); -}
tools/lib/bpf/bpf.h +1 -0
@@ -22,6 +22,7 @@#define __BPF_BPF_H#include <linux/bpf.h> +#include <stddef.h> int bpf_create_map (enum bpf_map_type map_type,int key_size,int value_size,int max_entries,__u32 map_flags);
tools/lib/bpf/libbpf.c +236 -28
330 lines not on this page · raw message
tools/lib/bpf/libbpf.h +18 -1
@@ -22,8 +22,8 @@#define __BPF_LIBBPF_H#include <stdio.h> +#include <stdint.h> #include <stdbool.h> -#include <linux/err.h> #include <sys/types.h> // for size_t enum libbpf_errno {
@@ -65,6 +65,7 @@ struct bpf_object *bpf_object__open(const char *path);struct bpf_object *bpf_object__open_buffer (void *obj_buf,size_t obj_buf_sz,const char *name); +int bpf_object__pin (struct bpf_object *object,const char *path);void bpf_object__close (struct bpf_object *object);/* Load/unload object into/from kernel */
@@ -106,6 +107,9 @@ void *bpf_program__priv(struct bpf_program *prog);const char *bpf_program__title (struct bpf_program *prog,bool needs_copy);int bpf_program__fd (struct bpf_program *prog); +int bpf_program__pin_instance (struct bpf_program *prog,const char *path, +int instance); +int bpf_program__pin (struct bpf_program *prog,const char *path);struct bpf_insn ;
@@ -174,11 +178,21 @@ int bpf_program__nth_fd(struct bpf_program *prog, int n);/* * Adjust type of bpf program. Default is kprobe. */ +int bpf_program__set_socket_filter (struct bpf_program *prog);int bpf_program__set_tracepoint (struct bpf_program *prog);int bpf_program__set_kprobe (struct bpf_program *prog); +int bpf_program__set_sched_cls (struct bpf_program *prog); +int bpf_program__set_sched_act (struct bpf_program *prog); +int bpf_program__set_xdp (struct bpf_program *prog); +int bpf_program__set_perf_event (struct bpf_program *prog); +bool bpf_program__is_socket_filter (struct bpf_program *prog);bool bpf_program__is_tracepoint (struct bpf_program *prog);bool bpf_program__is_kprobe (struct bpf_program *prog); +bool bpf_program__is_sched_cls (struct bpf_program *prog); +bool bpf_program__is_sched_act (struct bpf_program *prog); +bool bpf_program__is_xdp (struct bpf_program *prog); +bool bpf_program__is_perf_event (struct bpf_program *prog);/* * We don't need __attribute__((packed)) now since it is
@@ -223,5 +237,8 @@ typedef void (*bpf_map_clear_priv_t)(struct bpf_map *, void *);int bpf_map__set_priv (struct bpf_map *map,void *priv,bpf_map_clear_priv_t clear_priv);void *bpf_map__priv (struct bpf_map *map); +int bpf_map__pin (struct bpf_map *map,const char *path); + +long libbpf_get_error (const void *ptr);#endif
tools/lib/subcmd/Makefile +7 -1
@@ -19,7 +19,13 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libsubcmd.a CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC + +ifeq ($(CC), clang) + CFLAGS += -O3 +else + CFLAGS += -O6 +endif # Treat warnings as errors unless directed not to ifneq ($(WERROR),0)
tools/lib/subcmd/parse-options.c +4 -0
@@ -270,6 +270,8 @@ static int get_value(struct parse_opt_ctx_t *p, }if (get_arg (p, opt, flags, &arg))return -1 ; +if (arg[0 ] =='-' ) +return opterror (opt,"expects an unsigned numerical value" , flags); *(unsigned int *)opt->value =strtol (arg, (char **)&s,10 );if (*s)return opterror (opt,"expects a numerical value" , flags);
@@ -302,6 +304,8 @@ static int get_value(struct parse_opt_ctx_t *p, }if (get_arg (p, opt, flags, &arg))return -1 ; +if (arg[0 ] =='-' ) +return opterror (opt,"expects an unsigned numerical value" , flags); *(u64 *)opt->value =strtoull (arg, (char **)&s,10 );if (*s)return opterror (opt,"expects a numerical value" , flags);
tools/lib/subcmd/parse-options.h +10 -9
@@ -1,6 +1,7 @@#ifndef __SUBCMD_PARSE_OPTIONS_H#define __SUBCMD_PARSE_OPTIONS_H +#include <linux/kernel.h> #include <stdbool.h> #include <stdint.h>
@@ -132,32 +133,32 @@ struct option {#define OPT_UINTEGER (s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }#define OPT_LONG (s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }#define OPT_U64 (s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) } -#define OPT_STRING (s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) } +#define OPT_STRING (s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), .argh = (a), .help = (h) }#define OPT_STRING_OPTARG (s, l, v, a, h, d) \ { .type = OPTION_STRING, .short_name = (s), .long_name = (l), \ - .value = check_vtype(v, const char **), (a), .help = (h), \ + .value = check_vtype(v, const char **), .argh =(a), .help = (h), \ .flags = PARSE_OPT_OPTARG, .defval = (intptr_t)(d) }#define OPT_STRING_OPTARG_SET (s, l, v, os, a, h, d) \ { .type = OPTION_STRING, .short_name = (s), .long_name = (l), \ - .value = check_vtype(v, const char **), (a), .help = (h), \ + .value = check_vtype(v, const char **), .argh = (a), .help = (h), \ .flags = PARSE_OPT_OPTARG, .defval = (intptr_t)(d), \ .set = check_vtype(os, bool *)} -#define OPT_STRING_NOEMPTY (s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h), .flags = PARSE_OPT_NOEMPTY} +#define OPT_STRING_NOEMPTY (s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), .argh = (a), .help = (h), .flags = PARSE_OPT_NOEMPTY}#define OPT_DATE (s, l, v, h) \ { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb }#define OPT_CALLBACK (s, l, v, a, h, f) \ - { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f) } + { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f) }#define OPT_CALLBACK_NOOPT (s, l, v, a, h, f) \ - { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .flags = PARSE_OPT_NOARG } + { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f), .flags = PARSE_OPT_NOARG }#define OPT_CALLBACK_DEFAULT (s, l, v, a, h, f, d) \ - { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d, .flags = PARSE_OPT_LASTARG_DEFAULT } + { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f), .defval = (intptr_t)d, .flags = PARSE_OPT_LASTARG_DEFAULT }#define OPT_CALLBACK_DEFAULT_NOOPT (s, l, v, a, h, f, d) \ { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l),\ - .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d,\ + .value = (v), .arg = (a), .help = (h), .callback = (f), .defval = (intptr_t)d,\ .flags = PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NOARG}#define OPT_CALLBACK_OPTARG (s, l, v, d, a, h, f) \ { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), \ - .value = (v), (a), .help = (h), .callback = (f), \ + .value = (v), .argh = (a), .help = (h), .callback = (f), \ .flags = PARSE_OPT_OPTARG, .data = (d) }/* parse_options() will filter out the processed options and leave the
tools/lib/traceevent/Makefile +10 -4
@@ -257,10 +257,16 @@ define do_install_plugins endef define do_generate_dynamic_list_file - (echo '{'; \ - $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u; \ - echo '};'; \ - ) > $2 + symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \ + xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\ + if [ "$$symbol_type" = "U W w" ];then \ + (echo '{'; \ + $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\ + echo '};'; \ + ) > $2; \ + else \ + (echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\ + fi endef install_lib: all_cmd install_plugins
tools/lib/traceevent/kbuffer-parse.c +1 -0
@@ -315,6 +315,7 @@ static unsigned int old_update_pointers(struct kbuffer *kbuf) extend += delta; delta = extend; ptr +=4 ; + length =0 ;break ;case OLD_RINGBUF_TYPE_TIME_STAMP :
tools/lib/traceevent/plugin_function.c +1 -1
@@ -130,7 +130,7 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record,unsigned long long pfunction;const char *func;const char *parent; -int index; +int index =0 ;if (pevent_get_field_val (s, event,"ip" , record, &function,1 ))return trace_seq_putc (s,'!' );
tools/perf/Build +3 -2
@@ -3,10 +3,12 @@ perf-y += builtin-annotate.o perf-y += builtin-config.o perf-y += builtin-diff.o perf-y += builtin-evlist.o +perf-y += builtin-ftrace.o perf-y += builtin-help.o perf-y += builtin-sched.o perf-y += builtin-buildid-list.o perf-y += builtin-buildid-cache.o +perf-y += builtin-kallsyms.o perf-y += builtin-list.o perf-y += builtin-record.o perf-y += builtin-report.o
@@ -39,8 +41,7 @@ CFLAGS_builtin-help.o += $(paths) CFLAGS_builtin-timechart.o += $(paths) CFLAGS_perf.o += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))" \ -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" \ - -DPREFIX="BUILD_STR($(prefix_SQ))" \ - -include $(OUTPUT)PERF-VERSION-FILE + -DPREFIX="BUILD_STR($(prefix_SQ))" CFLAGS_builtin-trace.o += -DSTRACE_GROUPS_DIR="BUILD_STR($(STRACE_GROUPS_DIR_SQ))" CFLAGS_builtin-report.o += -DTIPDIR="BUILD_STR($(tipdir_SQ))" CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)"
tools/perf/Documentation/perf-c2c.txt +1 -1
@@ -248,7 +248,7 @@ Following fields are available and governs the final Code address, Code symbol, Shared Object, Source line dso - coalesced by shared object -By default the coalescing is setup with 'pid,tid,iaddr'. +By default the coalescing is setup with 'pid,iaddr'. STDIO OUTPUT ------------
tools/perf/Documentation/perf-config.txt +12 -0
@@ -498,6 +498,18 @@ Variables But if this option is 'no-cache', it will not update the build-id cache. 'skip' skips post-processing and does not update the cache. +diff.*:: + diff.order:: + This option sets the number of columns to sort the result. + The default is 0, which means sorting by baseline. + Setting it to 1 will sort the result by delta (or other + compute method selected). + + diff.compute:: + This options sets the method for computing the diff result. + Possible values are 'delta', 'delta-abs', 'ratio' and + 'wdiff'. Default is 'delta'. + SEE ALSO -------- linkperf:perf[1]
tools/perf/Documentation/perf-diff.txt +12 -3
@@ -86,8 +86,9 @@ OPTIONS -c:: --compute:: - Differential computation selection - delta,ratio,wdiff (default is delta). - See COMPARISON METHODS section for more info. + Differential computation selection - delta, ratio, wdiff, delta-abs + (default is delta-abs). Default can be changed using diff.compute + config option. See COMPARISON METHODS section for more info. -p:: --period::
@@ -99,7 +100,11 @@ OPTIONS -o:: --order:: - Specify compute sorting column number. + Specify compute sorting column number. 0 means sorting by baseline + overhead and 1 (default) means sorting by computed value of column 1 + (data from the first file other base baseline). Values more than 1 + can be used only if enough data files are provided. + The default value can be set using the diff.order config option. --percentage:: Determine how to display the overhead percentage of filtered entries.
@@ -181,6 +186,10 @@ delta relative to how entries are filtered. Use --percentage=absolute to prevent such fluctuation. +delta-abs +~~~~~~~~~ +Same as 'delta` method, but sort the result with the absolute values. + ratio ~~~~~ If specified the 'Ratio' column is displayed with value 'r' computed as:
tools/perf/Documentation/perf-ftrace.txt new file +36 -0
@@ -0,0 +1,36 @@ +perf-ftrace(1) +============= + +NAME +---- +perf-ftrace - simple wrapper for kernel's ftrace functionality + + +SYNOPSIS +-------- +[verse] +'perf ftrace' <command> + +DESCRIPTION +----------- +The 'perf ftrace' command is a simple wrapper of kernel's ftrace +functionality. It only supports single thread tracing currently and +just reads trace_pipe in text and then write it to stdout. + +The following options apply to perf ftrace. + +OPTIONS +------- + +-t:: +--tracer=:: + Tracer to use: function_graph or function. + +-v:: +--verbose=:: + Verbosity level. + + +SEE ALSO +-------- +linkperf:perf-record[1], linkperf:perf-trace[1]
tools/perf/Documentation/perf-kallsyms.txt new file +24 -0
@@ -0,0 +1,24 @@ +perf-kallsyms(1) +============== + +NAME +---- +perf-kallsyms - Searches running kernel for symbols + +SYNOPSIS +-------- +[verse] +'perf kallsyms <options> symbol_name[,symbol_name...]' + +DESCRIPTION +----------- +This command searches the running kernel kallsyms file for the given symbol(s) +and prints information about it, including the DSO, the kallsyms begin/end +addresses and the addresses in the ELF kallsyms symbol table (for symbols in +modules). + +OPTIONS +------- +-v:: +--verbose=:: + Increase verbosity level, showing details about symbol table loading, etc.
tools/perf/Documentation/perf-record.txt +12 -2
@@ -421,9 +421,19 @@ Configure all used events to run in user space. --timestamp-filename Append timestamp to output file name. ---switch-output:: +--switch-output[=mode]:: Generate multiple perf.data files, timestamp prefixed, switching to a new one -when receiving a SIGUSR2. +based on 'mode' value: + "signal" - when receiving a SIGUSR2 (default value) or + <size> - when reaching the size threshold, size is expected to + be a number with appended unit character - B/K/M/G + <time> - when reaching the time threshold, size is expected to + be a number with appended unit character - s/m/h/d + + Note: the precision of the size threshold hugely depends + on your configuration - the number and size of your ring + buffers (-m). It is generally more precise for higher sizes + (like >5M), for lower values expect different sizes. A possible use case is to, given an external event, slice the perf.data file that gets then processed, possibly via a perf script, to decide if that
tools/perf/Documentation/perf-sched.txt +2 -0
@@ -143,6 +143,8 @@ OPTIONS for 'perf sched timehist' stop time is not given (i.e, time string is 'x.y,') then analysis goes to end of file. +--state:: + Show task state when it switched out. SEE ALSO --------
tools/perf/Documentation/perf-script.txt +2 -2
@@ -36,7 +36,7 @@ This command reads the input file and displays the trace recorded. 'perf script report <script> [args]' to run and display the results of <script>. <script> is the name displayed in the output of 'perf - trace --list' i.e. the actual script name minus any language + script --list' i.e. the actual script name minus any language extension. The perf.data output from a previous run of 'perf script record <script>' is used and should be present for this command to succeed. [args] refers to the (mainly optional) args expected by
@@ -76,7 +76,7 @@ OPTIONS Any command you can specify in a shell. -D:: ---dump-raw-script=:: +--dump-raw-trace=:: Display verbose dump of the trace data. -L::
tools/perf/Documentation/perf-trace.txt +4 -4
@@ -35,7 +35,10 @@ OPTIONS -e:: --expr:: - List of syscalls to show, currently only syscall names. +--event:: + List of syscalls and other perf events (tracepoints, HW cache events, + etc) to show. + See 'perf list' for a complete list of events. Prefixing with ! shows all syscalls but the ones specified. You may need to escape it.
@@ -135,9 +138,6 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. --kernel-syscall-graph:: Show the kernel callchains on the syscall exit path. ---event:: - Trace other events, see 'perf list' for a complete list. - --max-stack:: Set the stack depth limit when parsing the callchain, anything beyond the specified depth will be ignored. Note that at this point
tools/perf/MANIFEST +1 -0
@@ -61,6 +61,7 @@ tools/include/asm-generic/bitops.h tools/include/linux/atomic.h tools/include/linux/bitops.h tools/include/linux/compiler.h +tools/include/linux/compiler-gcc.h tools/include/linux/coresight-pmu.h tools/include/linux/filter.h tools/include/linux/hash.h
tools/perf/Makefile.config +8 -2
@@ -144,8 +144,12 @@ ifndef DEBUG endif ifeq ($(DEBUG),0) +ifeq ($(CC), clang) + CFLAGS += -O3 +else CFLAGS += -O6 endif +endif ifdef PARSER_DEBUG PARSER_DEBUG_BISON := -t
@@ -291,8 +295,10 @@ else endif endif ifneq ($(feature-dwarf), 1) - msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); - NO_DWARF := 1 + ifndef NO_DWARF + msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); + NO_DWARF := 1 + endif else ifneq ($(feature-dwarf_getlocations), 1) msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
tools/perf/Makefile.perf +1 -0
@@ -661,6 +661,7 @@ ifndef NO_PERF_READ_VDSOX32 endif ifndef NO_JVMTI $(call QUIET_INSTALL, $(LIBJVMTI)) \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \ $(INSTALL) $(OUTPUT)$(LIBJVMTI) '$(DESTDIR_SQ)$(libdir_SQ)'; endif $(call QUIET_INSTALL, libexec) \
tools/perf/arch/arm64/Makefile +1 -0
@@ -2,3 +2,4 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif PERF_HAVE_JITDUMP := 1 +PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
tools/perf/arch/arm64/include/dwarf-regs-table.h +6 -6
@@ -2,12 +2,12 @@/* This is included in perf/util/dwarf-regs.c */ static const char *const aarch64_regstr_tbl[] = { -"%r0" ,"%r1" ,"%r2" ,"%r3" ,"%r4" , -"%r5" ,"%r6" ,"%r7" ,"%r8" ,"%r9" , -"%r10" ,"%r11" ,"%r12" ,"%r13" ,"%r14" , -"%r15" ,"%r16" ,"%r17" ,"%r18" ,"%r19" , -"%r20" ,"%r21" ,"%r22" ,"%r23" ,"%r24" , -"%r25" ,"%r26" ,"%r27" ,"%r28" ,"%r29" , +"%x0" ,"%x1" ,"%x2" ,"%x3" ,"%x4" , +"%x5" ,"%x6" ,"%x7" ,"%x8" ,"%x9" , +"%x10" ,"%x11" ,"%x12" ,"%x13" ,"%x14" , +"%x15" ,"%x16" ,"%x17" ,"%x18" ,"%x19" , +"%x20" ,"%x21" ,"%x22" ,"%x23" ,"%x24" , +"%x25" ,"%x26" ,"%x27" ,"%x28" ,"%x29" ,"%lr" ,"%sp" , };#endif
tools/perf/arch/arm64/util/dwarf-regs.c +14 -1
@@ -10,17 +10,20 @@#include <stddef.h> #include <dwarf-regs.h> +#include <linux/ptrace.h> /* for struct user_pt_regs */ +#include "util.h" struct pt_regs_dwarfnum {const char *name;unsigned int dwarfnum; }; -#define STR (s) #s#define REG_DWARFNUM_NAME (r, num) {.name = r, .dwarfnum = num}#define GPR_DWARFNUM_NAME (num) \ {.name = STR(%x##num), .dwarfnum = num}#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} +#define DWARFNUM2OFFSET (index) \ + (index * sizeof((struct user_pt_regs *)0)->regs[0])/* * Reference:
@@ -78,3 +81,13 @@ const char *get_arch_regstr(unsigned int n)return roff->name;return NULL ; } + +int regs_query_register_offset (const char *name) +{ +const struct pt_regs_dwarfnum *roff; + +for (roff = regdwarfnum_table; roff->name !=NULL ; roff++) +if (!strcmp (roff->name, name)) +return DWARFNUM2OFFSET (roff->dwarfnum); +return -EINVAL ; +}
tools/perf/bench/futex-hash.c +0 -4
@@ -130,8 +130,6 @@ int bench_futex_hash(int argc, const char **argv, } ncpus =sysconf (_SC_NPROCESSORS_ONLN); - nsecs =futexbench_sanitize_numeric (nsecs); - nfutexes =futexbench_sanitize_numeric (nfutexes);sigfillset (&act.sa_mask); act.sa_sigaction = toggle_done;
@@ -139,8 +137,6 @@ int bench_futex_hash(int argc, const char **argv,if (!nthreads)/* default to the number of CPUs */ nthreads = ncpus; -else - nthreads =futexbench_sanitize_numeric (nthreads); worker =calloc (nthreads,sizeof (*worker));if (!worker)
tools/perf/bench/futex-lock-pi.c +0 -3
@@ -152,7 +152,6 @@ int bench_futex_lock_pi(int argc, const char **argv, goto err; ncpus =sysconf (_SC_NPROCESSORS_ONLN); - nsecs =futexbench_sanitize_numeric (nsecs);sigfillset (&act.sa_mask); act.sa_sigaction = toggle_done;
@@ -160,8 +159,6 @@ int bench_futex_lock_pi(int argc, const char **argv,if (!nthreads) nthreads = ncpus; -else - nthreads =futexbench_sanitize_numeric (nthreads); worker =calloc (nthreads,sizeof (*worker));if (!worker)
tools/perf/bench/futex-requeue.c +0 -2
@@ -128,8 +128,6 @@ int bench_futex_requeue(int argc, const char **argv,if (!nthreads) nthreads = ncpus; -else - nthreads =futexbench_sanitize_numeric (nthreads); worker =calloc (nthreads,sizeof (*worker));if (!worker)
tools/perf/bench/futex-wake-parallel.c +0 -4
@@ -217,12 +217,8 @@ int bench_futex_wake_parallel(int argc, const char **argv,sigaction (SIGINT , &act,NULL ); ncpus =sysconf (_SC_NPROCESSORS_ONLN); - nwaking_threads =futexbench_sanitize_numeric (nwaking_threads); -if (!nblocked_threads) nblocked_threads = ncpus; -else - nblocked_threads =futexbench_sanitize_numeric (nblocked_threads);/* some sanity checks */ if (nwaking_threads > nblocked_threads || !nwaking_threads)
tools/perf/bench/futex-wake.c +0 -3
@@ -129,7 +129,6 @@ int bench_futex_wake(int argc, const char **argv, } ncpus =sysconf (_SC_NPROCESSORS_ONLN); - nwakes =futexbench_sanitize_numeric (nwakes);sigfillset (&act.sa_mask); act.sa_sigaction = toggle_done;
@@ -137,8 +136,6 @@ int bench_futex_wake(int argc, const char **argv,if (!nthreads) nthreads = ncpus; -else - nthreads =futexbench_sanitize_numeric (nthreads); worker =calloc (nthreads,sizeof (*worker));if (!worker)
tools/perf/bench/futex.h +0 -4
@@ -7,7 +7,6 @@#ifndef _FUTEX_H#define _FUTEX_H -#include <stdlib.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h>
@@ -100,7 +99,4 @@ static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr, }#endif -/* User input sanitation */ -#define futexbench_sanitize_numeric (__n) abs((__n)) -#endif /* _FUTEX_H */
tools/perf/bench/numa.c +4 -3
@@ -43,6 +43,7 @@/* * Debug printf: */ +#undef dprintf #define dprintf(x...) do { if (g && g->p.show_details >= 1) printf(x); } while (0)struct thread_data {
@@ -1573,13 +1574,13 @@ static int __bench_numa(const char *name) "GB/sec,", "total-speed", "GB/sec total speed");if (g->p.show_details >=2 ) { -char tname[32 ]; +char tname[14 +2 *10 +1 ];struct thread_data *td;for (p =0 ; p < g->p.nr_proc; p++) {for (t =0 ; t < g->p.nr_threads; t++) { -memset (tname,0 ,32 ); +memset (tname,0 ,sizeof (tname)); td = g->threads + p*g->p.nr_threads + t; -snprintf (tname,32 ,"process%d:thread%d" , p, t); +snprintf (tname,sizeof (tname),"process%d:thread%d" , p, t);print_res (tname, td->speed_gbs,"GB/sec" ,"thread-speed" ,"GB/sec/thread speed" ); print_res(tname, td->system_time_ns / NSEC_PER_SEC,
tools/perf/builtin-c2c.c +2 -1
@@ -58,7 +58,7 @@ struct c2c_hist_entry {struct hist_entry he; }; -static char const *coalesce_default ="pid,tid,iaddr" ; +static char const *coalesce_default ="pid,iaddr" ;struct perf_c2c {struct perf_tool tool;
@@ -2476,6 +2476,7 @@ static int build_cl_output(char *cl_sort, bool no_source)"mean_rmt," "mean_lcl," "mean_load," +"tot_recs," "cpucnt," , add_sym ?"symbol," :"" , add_dso ? "dso," : "",
tools/perf/builtin-diff.c +74 -4
192 lines not on this page · raw message
tools/perf/builtin-ftrace.c new file +265 -0
265 lines not on this page · raw message
tools/perf/builtin-help.c +5 -3
@@ -434,7 +434,7 @@ int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)const char *const builtin_help_subcommands[] = {"buildid-cache" ,"buildid-list" ,"diff" ,"evlist" ,"help" ,"list" ,"record" ,"report" ,"bench" ,"stat" ,"timechart" ,"top" ,"annotate" , -"script" ,"sched" ,"kmem" ,"lock" ,"kvm" ,"test" ,"inject" ,"mem" ,"data" , +"script" ,"sched" ,"kallsyms" ,"kmem" ,"lock" ,"kvm" ,"test" ,"inject" ,"mem" ,"data" , #ifdef HAVE_LIBELF_SUPPORT"probe" , #endif
@@ -447,11 +447,13 @@ int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused) NULL };const char *alias; -int rc =0 ; +int rc;load_command_list ("perf-" , &main_cmds, &other_cmds); -perf_config (perf_help_config, &help_format); + rc =perf_config (perf_help_config, &help_format); +if (rc) +return rc; argc =parse_options_subcommand (argc, argv, builtin_help_options, builtin_help_subcommands, builtin_help_usage,0 );
tools/perf/builtin-kallsyms.c new file +67 -0
67 lines not on this page · raw message
tools/perf/builtin-kmem.c +8 -4
@@ -1065,7 +1065,7 @@ static void __print_page_alloc_result(struct perf_session *session, int n_lines) data = rb_entry(next, struct page_stat, node); sym =machine__find_kernel_function (machine, data->callsite, &map); -if (sym && sym->name) +if (sym) caller = sym->name;else scnprintf (buf,sizeof (buf),"%" PRIx64, data->callsite);
@@ -1107,7 +1107,7 @@ static void __print_page_caller_result(struct perf_session *session, int n_lines data = rb_entry(next, struct page_stat, node); sym =machine__find_kernel_function (machine, data->callsite, &map); -if (sym && sym->name) +if (sym) caller = sym->name;else scnprintf (buf,sizeof (buf),"%" PRIx64, data->callsite);
@@ -1920,10 +1920,12 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) NULL };struct perf_session *session; -int ret =-1 ;const char errmsg[] ="No %s allocation events found. Have you run 'perf kmem record --%s'?\n" ; +int ret =perf_config (kmem_config,NULL ); + +if (ret) +return ret; -perf_config (kmem_config,NULL ); argc =parse_options_subcommand (argc, argv, kmem_options, kmem_subcommands, kmem_usage,0 );
@@ -1948,6 +1950,8 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)if (session ==NULL )return -1 ; + ret =-1 ; +if (kmem_slab) {if (!perf_evlist__find_tracepoint_by_name (session->evlist,"kmem:kmalloc" )) {
tools/perf/builtin-list.c +3 -0
@@ -14,6 +14,7 @@#include "util/parse-events.h" #include "util/cache.h" #include "util/pmu.h" +#include "util/debug.h" #include <subcmd/parse-options.h> static bool desc_flag = true;
@@ -29,6 +30,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) "Print extra event descriptions. --no-desc to not print."),OPT_BOOLEAN ('v' ,"long-desc" , &long_desc_flag,"Print longer event descriptions." ), +OPT_INCR (0 ,"debug" , &verbose, +"Enable debugging output" ),OPT_END () }; const char * const list_usage[] = {
tools/perf/builtin-probe.c +2 -0
@@ -552,6 +552,8 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)OPT_BOOLEAN (0 ,"demangle-kernel" , &symbol_conf.demangle_kernel,"Enable kernel symbol demangling" ),OPT_BOOLEAN (0 ,"cache" , &probe_conf.cache,"Manipulate probe cache" ), +OPT_STRING (0 ,"symfs" , &symbol_conf.symfs,"directory" , +"Look for files with symbols relative to this directory" ), OPT_END() };int ret;
tools/perf/builtin-record.c +154 -23
18 lines not on this page · raw message
tools/perf/builtin-sched.c +119 -13
132 lines not on this page · raw message
tools/perf/builtin-trace.c +92 -28
120 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/broadwellde/uncore-cache.json new file +317 -0
317 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/broadwellde/uncore-memory.json new file +83 -0
83 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/broadwellde/uncore-power.json new file +84 -0
84 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/broadwellx/uncore-cache.json new file +317 -0
317 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/broadwellx/uncore-interconnect.json new file +28 -0
Lines of this file are not shown. View the raw message.
tools/perf/pmu-events/arch/x86/broadwellx/uncore-memory.json new file +83 -0
83 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/broadwellx/uncore-power.json new file +84 -0
84 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/haswellx/uncore-cache.json new file +317 -0
317 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/haswellx/uncore-interconnect.json new file +28 -0
Lines of this file are not shown. View the raw message.
tools/perf/pmu-events/arch/x86/haswellx/uncore-memory.json new file +83 -0
83 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/haswellx/uncore-power.json new file +84 -0
84 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/ivytown/uncore-cache.json new file +322 -0
322 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/ivytown/uncore-interconnect.json new file +46 -0
46 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/ivytown/uncore-memory.json new file +75 -0
75 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/ivytown/uncore-power.json new file +249 -0
249 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json new file +209 -0
209 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/jaketown/uncore-interconnect.json new file +46 -0
46 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/jaketown/uncore-memory.json new file +79 -0
79 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/jaketown/uncore-power.json new file +248 -0
248 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/knightslanding/uncore-memory.json new file +42 -0
42 lines not on this page · raw message
tools/perf/pmu-events/jevents.c +79 -5
84 lines not on this page · raw message
tools/perf/tests/bpf.c +41 -1
42 lines not on this page · raw message
tools/perf/tests/parse-no-sample-id-all.c +8 -11
Lines of this file are not shown. View the raw message.
tools/perf/tests/unit_number__scnprintf.c new file +37 -0
Lines of this file are not shown. View the raw message.
tools/perf/ui/browsers/hists.c +42 -18
60 lines not on this page · raw message
tools/perf/util/dso.c +37 -11
48 lines not on this page · raw message
tools/perf/util/evsel.c +31 -35
66 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +5 -0
Lines of this file are not shown. View the raw message.
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +2 -0
Lines of this file are not shown. View the raw message.
tools/perf/util/parse-events.c +44 -40
84 lines not on this page · raw message
tools/perf/util/pmu.c +73 -40
113 lines not on this page · raw message
tools/perf/util/scripting-engines/Build +1 -1
Lines of this file are not shown. View the raw message.
tools/perf/util/scripting-engines/trace-event-perl.c +6 -4
Lines of this file are not shown. View the raw message.
tools/perf/util/trace-event-info.c +50 -21
71 lines not on this page · raw message
tools/perf/util/trace-event-read.c +64 -13
77 lines not on this page · raw message
tools/perf/util/unwind-libunwind-local.c +49 -5
54 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.