perf/core improvements and fixes
Subsystems (5)
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 53e74a112ce5c1c9b6a6923bdd6612133625d579:
Merge tag 'perf-urgent-for-mingo-4.10-20170203' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2017-02-03 20:42:30 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.11-20170209
for you to fetch changes up to 7ea6856d6f5629d742edc23b8b76e6263371ef45:
perf intel-pt: Use __fallthrough (2017-02-09 16:32:03 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- 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)
- Support --symfs in 'perf probe' (Uwe Kleine-K?nig)
- Add support for generating bpf prologue on the aarch64 architecture (He Kuang)
- Show proper hint when SDT event not yet in place via 'perf probe' (Ravi Bangoria)
- Take into account symfs setting when reading file build ID (Victor Kamensky)
Infrastructure:
- Map gcc7's '__attribute__ ((fallthrough))', that warns when code associated to case blocks in switches continue into the next case entry, to '__falltrough' and use it where warned by gcc, tested on Fedora Rawhide (Arnaldo Carvalho de Melo)
- Fix buffer sizes used with snprintf that could lead to truncation, another warning introduced in gcc7 (Arnaldo Carvalho de Melo)
- Robustify do_generate_dynamic_list_file in libtraceevent (David Carrillo-Cisneros)
- Use zfree() in more places (Taeung Song)
----------------------------------------------------------------
Andi Kleen (11):
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 (11):
Merge remote-tracking branch 'tip/perf/urgent' into perf/core 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
David Carrillo-Cisneros (1):
tools lib traceevent: Robustify do_generate_dynamic_list_file
He Kuang (2):
perf tools arm64: Add support for generating bpf prologue perf bpf: Add missing newline in debug messages
Micka?l Sala?n (1):
tools lib bpf: Add missing header to the library
Ravi Bangoria (1):
perf sdt: Show proper hint when event not yet in place via 'perf probe'
Taeung Song (4):
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
Makefile | 6 +- arch/x86/events/Makefile | 13 +- arch/x86/events/amd/Makefile | 7 + arch/x86/events/amd/uncore.c | 204 ++++++++----- arch/x86/events/intel/pt.c | 6 + include/linux/kprobes.h | 30 +- include/linux/perf_event.h | 2 +- kernel/events/core.c | 223 ++++++++------ kernel/extable.c | 9 +- kernel/kprobes.c | 73 +++-- 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.h | 9 + 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/parse-options.h | 19 +- tools/lib/traceevent/Makefile | 14 +- tools/perf/Build | 5 +- tools/perf/Documentation/perf-c2c.txt | 2 +- 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/Makefile.config | 6 +- 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/numa.c | 6 +- tools/perf/builtin-c2c.c | 3 +- tools/perf/builtin-ftrace.c | 265 +++++++++++++++++ tools/perf/builtin-help.c | 8 +- tools/perf/builtin-kallsyms.c | 67 +++++ tools/perf/builtin-kmem.c | 8 +- tools/perf/builtin-list.c | 3 + tools/perf/builtin-probe.c | 2 + tools/perf/builtin-record.c | 158 +++++++++- tools/perf/builtin-report.c | 4 +- tools/perf/builtin-sched.c | 130 ++++++++- tools/perf/builtin-script.c | 3 +- tools/perf/builtin-top.c | 6 +- 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/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/header.c | 7 +- tools/perf/util/hist.c | 4 +- .../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 | 19 ++ tools/perf/util/machine.h | 1 + tools/perf/util/parse-events.c | 69 +++-- tools/perf/util/parse-events.y | 35 ++- tools/perf/util/pmu.c | 109 ++++--- tools/perf/util/pmu.h | 1 + tools/perf/util/probe-event.c | 11 +- .../perf/util/scripting-engines/trace-event-perl.c | 6 +- tools/perf/util/session.c | 2 +- tools/perf/util/strfilter.c | 1 + tools/perf/util/string.c | 2 + tools/perf/util/symbol.c | 6 +- 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 | 12 +- 122 files changed, 5101 insertions(+), 550 deletions(-) create mode 100644 arch/x86/events/amd/Makefile 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
Test results:
The first ones are container (docker) based builds of tools/perf with and without libelf support, objtool where it is supported and samples/bpf/, ditto.
Several are cross builds, the ones with -x-ARCH, and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}.
The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests.
Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place.
# dm 1 alpine:3.4: Ok 2 android-ndk:r12b-arm: Ok 3 archlinux:latest: Ok 4 centos:5: Ok 5 centos:6: Ok 6 centos:7: Ok 7 debian:7: Ok 8 debian:8: Ok 9 debian:experimental: Ok 10 debian:experimental-x-arm64: Ok 11 debian:experimental-x-mips: Ok 12 debian:experimental-x-mips64: Ok 13 debian:experimental-x-mipsel: Ok 14 fedora:20: Ok 15 fedora:21: Ok 16 fedora:22: Ok 17 fedora:23: Ok 18 fedora:24: Ok 19 fedora:24-x-ARC-uClibc: Ok 20 fedora:25: Ok 21 fedora:rawhide: Ok 22 mageia:5: Ok 23 opensuse:13.2: Ok 24 opensuse:42.1: Ok 25 opensuse:tumbleweed: Ok 26 ubuntu:12.04.5: Ok 27 ubuntu:14.04.4-x-linaro-arm64: Ok 28 ubuntu:15.10: Ok 29 ubuntu:16.04: Ok 30 ubuntu:16.04-x-arm: Ok 31 ubuntu:16.04-x-arm64: Ok 32 ubuntu:16.04-x-powerpc: Ok 33 ubuntu:16.04-x-powerpc64: Ok 34 ubuntu:16.04-x-powerpc64el: Ok 35 ubuntu:16.04-x-s390: Ok 36 ubuntu:16.10: Ok
# perf test 1: vmlinux symtab matches kallsyms : Ok 2: Detect openat syscall event : Ok 3: Detect openat syscall event on all cpus : Ok 4: Read samples using the mmap interface : Ok 5: Parse event definition strings : Ok 6: PERF_RECORD_* events & perf_sample fields : Ok 7: Parse perf pmu format : Ok 8: DSO data read : Ok 9: DSO data cache : Ok 10: DSO data reopen : Ok 11: Roundtrip evsel->name : Ok 12: Parse sched tracepoints fields : Ok 13: syscalls:sys_enter_openat event fields : Ok 14: Setup struct perf_event_attr : Ok 15: Match and link multiple hists : Ok 16: 'import perf' in python : Ok 17: Breakpoint overflow signal handler : Ok 18: Breakpoint overflow sampling : Ok 19: Number of exit events of a simple workload : Ok 20: Software clock events period values : Ok 21: Object code reading : Ok 22: Sample parsing : Ok 23: Use a dummy software event to keep tracking: Ok 24: Parse with no sample_id_all bit set : Ok 25: Filter hist entries : Ok 26: Lookup mmap thread : Ok 27: Share thread mg : Ok 28: Sort output of hist entries : Ok 29: Cumulate child hist entries : Ok 30: Track with sched_switch : Ok 31: Filter fds with revents mask in a fdarray : Ok 32: Add fd to a fdarray, making it autogrow : Ok 33: kmod_path__parse : Ok 34: Thread map : Ok 35: LLVM search and compile : 35.1: Basic BPF llvm compile : Ok 35.2: kbuild searching : Ok 35.3: Compile source for BPF prologue generation: Ok 35.4: Compile source for BPF relocation : Ok 36: Session topology : Ok 37: BPF filter : 37.1: Basic BPF filtering : Ok 37.2: BPF pinning : Ok 37.3: BPF prologue generation : Ok 37.4: BPF relocation checker : Ok 38: Synthesize thread map : Ok 39: Remove thread map : Ok 40: Synthesize cpu map : Ok 41: Synthesize stat config : Ok 42: Synthesize stat : Ok 43: Synthesize stat round : Ok 44: Synthesize attr update : Ok 45: Event times : Ok 46: Read backward ring buffer : Ok 47: Print cpu map : Ok 48: Probe SDT events : Ok 49: is_printable_array : Ok 50: Print bitmap : Ok 51: perf hooks : Ok 52: builtin clang support : Skip (not compiled in) 53: unit_number__scnprintf : Ok 54: x86 rdpmc : Ok 55: Convert perf time to TSC : Ok 56: DWARF unwind : Ok 57: x86 instruction decoder - new instructions : Ok 58: Intel cqm nmi context read : Skip #
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_no_libperl_O: make NO_LIBPERL=1
make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
make_perf_o_O: make perf.o
make_pure_O: make
make_install_prefix_O: make install prefix=/tmp/krava
make_no_libunwind_O: make NO_LIBUNWIND=1
make_static_O: make LDFLAGS=-static
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_help_O: make help
make_doc_O: make doc
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_tags_O: make tags
make_debug_O: make DEBUG=1
make_install_bin_O: make install-bin
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_libbpf_O: make NO_LIBBPF=1
make_util_map_o_O: make util/map.o
make_no_libelf_O: make NO_LIBELF=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_gtk2_O: make NO_GTK2=1
make_clean_all_O: make clean all
make_no_newt_O: make NO_NEWT=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_install_O: make install
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_demangle_O: make NO_DEMANGLE=1
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_slang_O: make NO_SLANG=1
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'Arnaldo Carvalho de Melo
maintainerPATCH 1/32 perf tools arm64: Add support for generating bpf prologue
From: He Kuang <[email protected]>
Since HAVE_KPROBES can be enabled in arm64, this patch introduces regs_query_register_offset() to convert register name to offset for arm64, so the BPF prologue feature is ready to use.
--- tools/perf/arch/arm64/Makefile | 1 + tools/perf/arch/arm64/util/dwarf-regs.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
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/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 ; +}
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 2/32 perf bpf: Add missing newline in debug messages
In reply to Arnaldo Carvalho de MeloFrom: He Kuang <[email protected]>
These two debug messages are missing the trailing newline.
--- tools/perf/util/bpf-loader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +2 -2
@@ -670,13 +670,13 @@ int bpf__probe(struct bpf_object *obj) err =convert_perf_probe_events (pev,1 );if (err <0 ) { -pr_debug ("bpf_probe: failed to convert perf probe events" ); +pr_debug ("bpf_probe: failed to convert perf probe events\n" ); goto out; } err =apply_perf_probe_events (pev,1 );if (err <0 ) { -pr_debug ("bpf_probe: failed to apply perf probe events" ); +pr_debug ("bpf_probe: failed to apply perf probe events\n" ); goto out; }
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 3/32 perf jevents: Parse eventcode as number
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
The next patch needs to modify event code. Previously eventcode was just passed through as a string. Now parse it as a number.
v2: Don't special case 0
--- tools/perf/pmu-events/jevents.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/perf/pmu-events/jevents.c +9 -1
@@ -135,7 +135,6 @@ static struct field {const char *field;const char *kernel; } fields[] = { - { "EventCode", "event=" }, { "UMask", "umask=" }, { "CounterMask", "cmask=" }, { "Invert", "inv=" },
@@ -343,6 +342,7 @@ int json_events(const char *fn,jsmntok_t *tokens, *tok;int i, j, len;char *map; +char buf[128 ];if (!fn)return -ENOENT ;
@@ -356,6 +356,7 @@ int json_events(const char *fn,char *event =NULL , *desc =NULL , *name =NULL ;char *long_desc =NULL ;char *extra_desc =NULL ; +unsigned long long eventcode =0 ;struct msrmap *msr =NULL ;jsmntok_t *msrval =NULL ;jsmntok_t *precise =NULL ;
@@ -376,6 +377,11 @@ int json_events(const char *fn, nz = !json_streq (map, val,"0" );if (match_field (map, field, nz, &event, val)) {/* ok */ + }else if (json_streq (map, field,"EventCode" )) { +char *code =NULL ; +addfield (map, &code,"" ,"" , val); + eventcode |=strtoul (code,NULL ,0 ); +free (code); }else if (json_streq (map, field,"EventName" )) {addfield (map, &name,"" ,"" , val); }else if (json_streq (map, field,"BriefDescription" )) {
@@ -410,6 +416,8 @@ int json_events(const char *fn,addfield (map, &extra_desc," " ,"(Precise event)" ,NULL ); } +snprintf (buf,sizeof buf,"event=%#llx" , eventcode); +addfield (map, &event,"," , buf,NULL );if (desc && extra_desc)addfield (map, &desc," " , extra_desc,NULL );if (long_desc && extra_desc)
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 4/32 perf jevents: Add support for parsing uncore json files
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Handle the "Unit" field, which is needed to find the right PMU for an event. We call it "pmu" and convert it to the perf pmu name with an uncore prefix.
Handle the "ExtSel" field, which just extends the event mask with an additional bit.
Handle the "Filter" field which adds parameters to the main event to configure filtering.
Handle the "Unit" field which declares the unit the values should be scaled too (similar to what the kernel exports)
Set up the "perpkg" field for uncore events so that perf knows they are per package (similar to what the kernel exports)
Then output the fields into the pmu-events data structures which are compiled into perf.
Filter out zero fields, except for the event itself.
v2: Fix compilation. Add uncore_ prefix at pre-processing time.
Move eventcode change to separate patch.
v3: Remove extra __maybe_unused
v4: dont duplicate aliases for cpu pmu events
--- tools/perf/pmu-events/jevents.c | 74 +++++++++++++++++++++++++++++++++++--- tools/perf/pmu-events/jevents.h | 4 ++- tools/perf/pmu-events/pmu-events.h | 3 ++ tools/perf/util/pmu.c | 30 +++++++++++----- 4 files changed, 98 insertions(+), 13 deletions(-)
tools/perf/pmu-events/jevents.c +70 -4
@@ -188,6 +188,27 @@ static struct msrmap *lookup_msr(char *map, jsmntok_t *val)return NULL ; } +static struct map { +const char *json; +const char *perf; +} unit_to_pmu[] = { + {"CBO" ,"uncore_cbox" }, + {"QPI LL" ,"uncore_qpi" }, + {"SBO" ,"uncore_sbox" }, + {} +}; + +static const char *field_to_perf (struct map *table,char *map,jsmntok_t *val) +{ +int i; + +for (i =0 ; table[i].json; i++) { +if (json_streq (map, val, table[i].json)) +return table[i].perf; + } +return NULL ; +} +#define EXPECT (e, t, m) do { if (!(e)) { \ jsmntok_t *loc = (t); \ if (!(t)->start && (t) > tokens) \
@@ -269,7 +290,8 @@ static void print_events_table_prefix(FILE *fp, const char *tblname) }static int print_events_table_entry (void *data,char *name,char *event, -char *desc,char *long_desc) +char *desc,char *long_desc, +char *pmu,char *unit,char *perpkg) {struct perf_entry_data *pd = data;FILE *outfp = pd->outfp;
@@ -287,7 +309,12 @@ static int print_events_table_entry(void *data, char *name, char *event,fprintf (outfp,"\t.topic = \"%s\",\n" , topic);if (long_desc && long_desc[0 ])fprintf (outfp,"\t.long_desc = \"%s\",\n" , long_desc); - +if (pmu) +fprintf (outfp,"\t.pmu = \"%s\",\n" , pmu); +if (unit) +fprintf (outfp,"\t.unit = \"%s\",\n" , unit); +if (perpkg) +fprintf (outfp,"\t.perpkg = \"%s\",\n" , perpkg);fprintf (outfp,"},\n" );return 0 ;
@@ -334,7 +361,8 @@ static char *real_event(const char *name, char *event)/* Call func with each event in the json file */ int json_events (const char *fn,int (*func)(void *data,char *name,char *event,char *desc, -char *long_desc), +char *long_desc, +char *pmu,char *unit,char *perpkg),void *data) {int err = -EIO ;
@@ -356,6 +384,10 @@ int json_events(const char *fn,char *event =NULL , *desc =NULL , *name =NULL ;char *long_desc =NULL ;char *extra_desc =NULL ; +char *pmu =NULL ; +char *filter =NULL ; +char *perpkg =NULL ; +char *unit =NULL ;unsigned long long eventcode =0 ;struct msrmap *msr =NULL ;jsmntok_t *msrval =NULL ;
@@ -382,6 +414,11 @@ int json_events(const char *fn,addfield (map, &code,"" ,"" , val); eventcode |=strtoul (code,NULL ,0 );free (code); + }else if (json_streq (map, field,"ExtSel" )) { +char *code =NULL ; +addfield (map, &code,"" ,"" , val); + eventcode |=strtoul (code,NULL ,0 ) <<21 ; +free (code); }else if (json_streq (map, field,"EventName" )) {addfield (map, &name,"" ,"" , val); }else if (json_streq (map, field,"BriefDescription" )) {
@@ -405,6 +442,28 @@ int json_events(const char *fn,addfield (map, &extra_desc,". " ," Supports address when precise" ,NULL ); + }else if (json_streq (map, field,"Unit" )) { +const char *ppmu; +char *s; + + ppmu =field_to_perf (unit_to_pmu, map, val); +if (ppmu) { + pmu =strdup (ppmu); + }else { +if (!pmu) + pmu =strdup ("uncore_" ); +addfield (map, &pmu,"" ,"" , val); +for (s = pmu; *s; s++) + *s =tolower (*s); + } +addfield (map, &desc,". " ,"Unit: " ,NULL ); +addfield (map, &desc,"" , pmu,NULL ); + }else if (json_streq (map, field,"Filter" )) { +addfield (map, &filter,"" ,"" , val); + }else if (json_streq (map, field,"ScaleUnit" )) { +addfield (map, &unit,"" ,"" , val); + }else if (json_streq (map, field,"PerPkg" )) { +addfield (map, &perpkg,"" ,"" , val); }/* ignore unknown fields */ }
@@ -422,16 +481,23 @@ int json_events(const char *fn,addfield (map, &desc," " , extra_desc,NULL );if (long_desc && extra_desc)addfield (map, &long_desc," " , extra_desc,NULL ); +if (filter) +addfield (map, &event,"," , filter,NULL );if (msr !=NULL )addfield (map, &event,"," , msr->pname, msrval);fixname (name); - err =func (data, name,real_event (name, event), desc, long_desc); + err =func (data, name,real_event (name, event), desc, long_desc, + pmu, unit, perpkg);free (event);free (desc);free (name);free (long_desc);free (extra_desc); +free (pmu); +free (filter); +free (perpkg); +free (unit);if (err)break ; tok += j;
tools/perf/pmu-events/jevents.h +3 -1
@@ -3,7 +3,9 @@int json_events (const char *fn,int (*func)(void *data,char *name,char *event,char *desc, -char *long_desc), +char *long_desc, +char *pmu, +char *unit,char *perpkg),void *data);char *get_cpu_str (void );
tools/perf/pmu-events/pmu-events.h +3 -0
@@ -10,6 +10,9 @@ struct pmu_event {const char *desc;const char *topic;const char *long_desc; +const char *pmu; +const char *unit; +const char *perpkg; };/*
tools/perf/util/pmu.c +22 -8
@@ -229,11 +229,13 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, }static int __perf_pmu__new_alias (struct list_head *list,char *dir,char *name, -char *desc,char *val,char *long_desc, -char *topic) +char *desc,char *val, +char *long_desc,char *topic, +char *unit,char *perpkg) {struct perf_pmu_alias *alias;int ret; +int num; alias =malloc (sizeof (*alias));if (!alias)
@@ -267,7 +269,12 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, alias->long_desc = long_desc ?strdup (long_desc) : desc ?strdup (desc) :NULL ; alias->topic = topic ?strdup (topic) :NULL ; - +if (unit) { +if (convert_scale (unit, &unit, &alias->scale) <0 ) +return -1 ; +snprintf (alias->unit,sizeof (alias->unit),"%s" , unit); + } + alias->per_pkg = perpkg &&sscanf (perpkg,"%d" , &num) ==1 && num ==1 ;list_add_tail (&alias->list, list);return 0 ;
@@ -284,7 +291,8 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI buf[ret] =0 ; -return __perf_pmu__new_alias (list, dir, name,NULL , buf,NULL ,NULL ); +return __perf_pmu__new_alias (list, dir, name,NULL , buf,NULL ,NULL ,NULL , +NULL ); }static inline bool pmu_alias_info_file (char *name)
@@ -504,7 +512,7 @@ char * __weak get_cpuid_str(void)* to the current running CPU. Then, add all PMU events from that table * as aliases. */ -static void pmu_add_cpu_aliases (struct list_head *head) +static void pmu_add_cpu_aliases (struct list_head *head,const char *name) {int i;struct pmu_events_map *map;
@@ -540,14 +548,21 @@ static void pmu_add_cpu_aliases(struct list_head *head)*/ i =0 ;while (1 ) { +const char *pname; + pe = &map->table[i++];if (!pe->name)break ; + pname = pe->pmu ? pe->pmu :"cpu" ; +if (strncmp (pname, name,strlen (pname))) +continue ; +/* need type casts to override 'const' */ __perf_pmu__new_alias (head,NULL , (char *)pe->name, (char *)pe->desc, (char *)pe->event, - (char *)pe->long_desc, (char *)pe->topic); + (char *)pe->long_desc, (char *)pe->topic, + (char *)pe->unit, (char *)pe->perpkg); } out:
@@ -578,8 +593,7 @@ static struct perf_pmu *pmu_lookup(const char *name)if (pmu_aliases (name, &aliases))return NULL ; -if (!strcmp (name,"cpu" )) -pmu_add_cpu_aliases (&aliases); +pmu_add_cpu_aliases (&aliases, name);if (pmu_type (name, &type))return NULL ;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 5/32 perf pmu: Support per pmu json aliases
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add support for registering json aliases per PMU. Any alias with an unit matching the prefix is registered to the PMU. Uncore has multiple instances of most units, so all these aliases get registered for each individual PMU (this is important later to run the event on every instance of the PMU).
To avoid printing the events multiple times in perf list filter out duplicated events during printing.
v2: Rely on uncore_ prefix already in unit
v3: Document why calls were reordered
--- tools/perf/util/pmu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/perf/util/pmu.c +9 -4
@@ -590,14 +590,16 @@ static struct perf_pmu *pmu_lookup(const char *name)if (pmu_format (name, &format))return NULL ; -if (pmu_aliases (name, &aliases)) +/* +* Check the type first to avoid unnecessary work. +*/ +if (pmu_type (name, &type))return NULL ; -pmu_add_cpu_aliases (&aliases, name); - -if (pmu_type (name, &type)) +if (pmu_aliases (name, &aliases))return NULL ; +pmu_add_cpu_aliases (&aliases, name); pmu =zalloc (sizeof (*pmu));if (!pmu)return NULL ;
@@ -1195,6 +1197,9 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, len = j;qsort (aliases, len,sizeof (struct sevent ), cmp_sevent);for (j =0 ; j < len; j++) { +/* Skip duplicates */ +if (j >0 && !strcmp (aliases[j].name, aliases[j -1 ].name)) +continue ;if (name_only) {printf ("%s " , aliases[j].name);continue ;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 6/32 perf pmu: Support event aliases for non cpu// pmus
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
The code for handling pmu aliases without specifying the PMU hardcoded only supported the cpu PMU.
This patch extends it to work for all PMUs. We always duplicate the event for all PMUs that have an matching alias. This allows to automatically expand an alias for all instances of a PMU (so for example you can monitor all cache boxes with a single event)
--- tools/perf/util/parse-events.c | 46 ++++++++++++++++++++++++------------------ tools/perf/util/parse-events.y | 32 ++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 27 deletions(-)
tools/perf/util/parse-events.c +26 -20
@@ -1504,35 +1504,41 @@ static void perf_pmu__parse_init(void)struct perf_pmu_alias *alias;int len =0 ; - pmu =perf_pmu__find ("cpu" ); -if ((pmu ==NULL ) ||list_empty (&pmu->aliases)) { + pmu =NULL ; +while ((pmu =perf_pmu__scan (pmu)) !=NULL ) { +list_for_each_entry (alias, &pmu->aliases, list) { +if (strchr (alias->name,'-' )) + len++; + len++; + } + } + +if (len ==0 ) { perf_pmu_events_list_num =-1 ;return ; } -list_for_each_entry (alias, &pmu->aliases, list) { -if (strchr (alias->name,'-' )) - len++; - len++; - } perf_pmu_events_list =malloc (sizeof (struct perf_pmu_event_symbol ) * len);if (!perf_pmu_events_list)return ; perf_pmu_events_list_num = len; len =0 ; -list_for_each_entry (alias, &pmu->aliases, list) { -struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; -char *tmp =strchr (alias->name,'-' ); - -if (tmp !=NULL ) { -SET_SYMBOL (strndup (alias->name, tmp - alias->name), -PMU_EVENT_SYMBOL_PREFIX ); - p++; -SET_SYMBOL (strdup (++tmp),PMU_EVENT_SYMBOL_SUFFIX ); - len +=2 ; - }else { -SET_SYMBOL (strdup (alias->name),PMU_EVENT_SYMBOL ); - len++; + pmu =NULL ; +while ((pmu =perf_pmu__scan (pmu)) !=NULL ) { +list_for_each_entry (alias, &pmu->aliases, list) { +struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; +char *tmp =strchr (alias->name,'-' ); + +if (tmp !=NULL ) { +SET_SYMBOL (strndup (alias->name, tmp - alias->name), +PMU_EVENT_SYMBOL_PREFIX ); + p++; +SET_SYMBOL (strdup (++tmp),PMU_EVENT_SYMBOL_SUFFIX ); + len +=2 ; + }else { +SET_SYMBOL (strdup (alias->name),PMU_EVENT_SYMBOL ); + len++; + } } } qsort(perf_pmu_events_list, len,
tools/perf/util/parse-events.y +25 -7
@@ -12,6 +12,7 @@ #include <linux/list.h> #include <linux/types.h> #include "util.h" +#include "pmu.h" #include "parse-events.h" #include "parse-events-bison.h"
@@ -236,15 +237,32 @@ PE_KERNEL_PMU_EVENT sep_dc struct list_head *head; struct parse_events_term *term; struct list_head *list; + struct perf_pmu *pmu = NULL; + int ok = 0; - ALLOC_LIST(head); - ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, - $1, 1, &@1, NULL)); - list_add_tail(&term->list, head); - + /* Add it for all PMUs that support the alias */ ALLOC_LIST(list); - ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); - parse_events_terms__delete(head); + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + struct perf_pmu_alias *alias; + + list_for_each_entry(alias, &pmu->aliases, list) { + if (!strcasecmp(alias->name, $1)) { + ALLOC_LIST(head); + ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, + $1, 1, &@1, NULL)); + list_add_tail(&term->list, head); + + if (!parse_events_add_pmu(data, list, + pmu->name, head)) { + ok++; + } + + parse_events_terms__delete(head); + } + } + } + if (!ok) + YYABORT; $$ = list; } |
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 7/32 perf list: Add debug support for outputing alias string
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
For debugging and testing it is useful to see the converted alias string. Add support to perf stat/record and perf list to print the alias conversion. The text string is saved in the alias structure. For perf stat/record it is folded into the normal -v. For perf list -v was taken, so we use --debug.
Before:
% perf list
...
cache:
l1d.replacement
[L1D data line replacements]
l1d_pend_miss.fb_full
[Cycles a demand request was blocked due to Fill Buffers inavailability]
After
% perf list --debug
...
cache:
l1d.replacement
[L1D data line replacements]
cpu/umask=0x1,period=2000003,event=0x51/
l1d_pend_miss.fb_full
[Cycles a demand request was blocked due to Fill Buffers inavailability]
cpu/umask=0x2,period=2000003,cmask=1,event=0x48/
--- tools/perf/builtin-list.c | 3 +++ tools/perf/util/parse-events.y | 3 +++ tools/perf/util/pmu.c | 8 ++++++++ tools/perf/util/pmu.h | 1 + 4 files changed, 15 insertions(+)
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/util/parse-events.y +3 -0
@@ -13,6 +13,7 @@ #include <linux/types.h> #include "util.h" #include "pmu.h" +#include "debug.h" #include "parse-events.h" #include "parse-events-bison.h"
@@ -254,6 +255,8 @@ PE_KERNEL_PMU_EVENT sep_dc if (!parse_events_add_pmu(data, list, pmu->name, head)) { + pr_debug("%s -> %s/%s/\n", $1, + pmu->name, alias->str); ok++; }
tools/perf/util/pmu.c +8 -0
@@ -275,6 +275,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,snprintf (alias->unit,sizeof (alias->unit),"%s" , unit); } alias->per_pkg = perpkg &&sscanf (perpkg,"%d" , &num) ==1 && num ==1 ; + alias->str =strdup (val); +list_add_tail (&alias->list, list);return 0 ;
@@ -1087,6 +1089,8 @@ struct sevent {char *name;char *desc;char *topic; +char *str; +char *pmu; };static int cmp_sevent (const void *a,const void *b)
@@ -1183,6 +1187,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, aliases[j].desc = long_desc ? alias->long_desc : alias->desc; aliases[j].topic = alias->topic; + aliases[j].str = alias->str; + aliases[j].pmu = pmu->name; j++; } if (pmu->selectable &&
@@ -1217,6 +1223,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,printf ("%*s" ,8 ,"[" );wordwrap (aliases[j].desc,8 , columns,0 );printf ("]\n" ); +if (verbose) +printf ("%*s%s/%s/\n" ,8 ,"" , aliases[j].pmu, aliases[j].str); }else printf (" %-50s [Kernel PMU event]\n" , aliases[j].name); printed++;
tools/perf/util/pmu.h +1 -0
@@ -43,6 +43,7 @@ struct perf_pmu_alias {char *desc;char *long_desc;char *topic; +char *str;struct list_head terms;/* HEAD struct parse_events_term -> list */ struct list_head list;/* ELEM */ char unit[UNIT_MAX_LEN +1 ];
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 8/32 perf sdt: Show proper hint when event not yet in place via 'perf probe'
In reply to Arnaldo Carvalho de MeloFrom: Ravi Bangoria <[email protected]>
All events from 'perf list', except SDT events, can be directly recorded with 'perf record'. But, the flow is little different for SDT events.
Probe points for SDT event needs to be created using 'perf probe' before recording it using 'perf record'.
Perf shows misleading hint when a user tries to record SDT event without first creating a probe point. Show proper hint there.
Before patch:
$ perf record -a -e sdt_glib:idle__add
event syntax error: 'sdt_glib:idle__add'
\___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
...
After patch:
$ perf record -a -e sdt_glib:idle__add
event syntax error: 'sdt_glib:idle__add'
\___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
Hint: SDT event cannot be directly recorded on.
Please first use 'perf probe sdt_glib:idle__add' before recording it.
...
$ perf probe sdt_glib:idle__add
Added new event:
sdt_glib:idle__add (on %idle__add in /usr/lib64/libglib-2.0.so.0.5000.2)You can now use it in all perf tools, such as:
perf record -e sdt_glib:idle__add -aR sleep 1
$ perf record -a -e sdt_glib:idle__add
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.175 MB perf.data ]--- tools/lib/api/fs/tracing_path.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
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); -}
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 9/32 perf symbols: Take into account symfs setting when reading file build ID
In reply to Arnaldo Carvalho de MeloFrom: Victor Kamensky <[email protected]>
After commit 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID") and when --symfs option is used perf failed to pick up symbols for file with the same name between host and sysroot specified by --symfs option. One can see message like this:
bin/bash with build id 26f0062cb6950d4d1ab0fd9c43eae8b10ca42062 not found, continuing without symbols
It happens because code added by 5baecbcd9c9a opens files directly by dso->long_name without symbol_conf.symfs consideration, which as result picks one from the host. It reads its build ID and later even code finds another proper file in directory pointed by --symfs perf ignores it because build id mismatches.
Fix is to use __symbol__join_symfs to adjust file name according to --symfs setting. If no --symfs passed the operation would noop and picks the same host file as before.
Also note in latter tree after 5baecbcd9c9a commit additional check for '!dso->has_build_id' was added, so to observe error condition 'perf record' should run with --no-buildid, so perf.data itself would not have build id for target binary in buildid perf section and 'perf report' will pass '!dso->has_build_id' condition. Or target binary should not have build id, but the same binary on host has build id, again '!dso->has_build_id' will pass in this case and incorrect build id could be read if --symfs is used.
--- tools/perf/util/symbol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/symbol.c +4 -2
@@ -1460,9 +1460,11 @@ int dso__load(struct dso *dso, struct map *map)* DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work */ if (!dso->has_build_id && -is_regular_file (dso->long_name) && -filename__read_build_id (dso->long_name, build_id,BUILD_ID_SIZE ) >0 ) +is_regular_file (dso->long_name)) { +__symbol__join_symfs (name,PATH_MAX , dso->long_name); +if (filename__read_build_id (name, build_id,BUILD_ID_SIZE ) >0 )dso__set_build_id (dso, build_id); + }/* * Iterate over candidate debug images.
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 10/32 perf probe: Add option --symfs
In reply to Arnaldo Carvalho de MeloFrom: Uwe Kleine-König <[email protected]>
perf probe makes use of debug symbols, so add --symfs as the other commands have.
--- tools/perf/builtin-probe.c | 2 ++ 1 file changed, 2 insertions(+)
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;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 11/32 perf tools: Only increase index if perf_evsel__new_idx() succeeds
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
--- tools/perf/util/parse-events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/parse-events.c +2 -1
@@ -310,10 +310,11 @@ __add_event(struct list_head *list, int *idx,event_attr_init (attr); - evsel =perf_evsel__new_idx (attr, (*idx)++); + evsel =perf_evsel__new_idx (attr, *idx);if (!evsel)return NULL ; + (*idx)++; evsel->cpus =cpu_map__get (cpus); evsel->own_cpus =cpu_map__get (cpus);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 12/32 perf tools: Add missing check for failure in a zalloc() call
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
--- tools/perf/util/parse-events.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/parse-events.c +2 -0
@@ -211,6 +211,8 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)closedir (evt_dir);closedir (sys_dir); path =zalloc (sizeof (*path)); +if (!path) +return NULL ; path->system =malloc (MAX_EVENT_LENGTH );if (!path->system) {free (path);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 13/32 perf tools: Use zfree() instead of ad hoc equivalent
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
We have zfree(&ptr) for this very common pattern:
free(ptr); ptr = NULL;
So use it in a few more places.
--- tools/perf/util/parse-events.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/util/parse-events.c +2 -4
@@ -254,8 +254,7 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name)if (path->system ==NULL || path->name ==NULL ) {zfree (&path->system);zfree (&path->name); -free (path); - path =NULL ; +zfree (&path); }return path;
@@ -1482,8 +1481,7 @@ static void perf_pmu__parse_cleanup(void) p = perf_pmu_events_list + i;free (p->symbol); } -free (perf_pmu_events_list); - perf_pmu_events_list =NULL ; +zfree (&perf_pmu_events_list); perf_pmu_events_list_num =0 ; } }
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 14/32 perf tools: Use zfree() to avoid keeping dangling pointers
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
The cases changed in this patch are for when we free but keep the pointer to the freed area, which is not always a good idea.
Be more defensive and zero the pointer to avoid possible use after free bugs to take more time to be detected.
--- tools/perf/util/parse-events.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/perf/util/parse-events.c +6 -6
@@ -1479,7 +1479,7 @@ static void perf_pmu__parse_cleanup(void)for (i =0 ; i < perf_pmu_events_list_num; i++) { p = perf_pmu_events_list + i; -free (p->symbol); +zfree (&p->symbol); }zfree (&perf_pmu_events_list); perf_pmu_events_list_num =0 ;
@@ -1570,7 +1570,7 @@ perf_pmu__parse_check(const char *name) r =bsearch (&p, perf_pmu_events_list, (size_t ) perf_pmu_events_list_num,sizeof (struct perf_pmu_event_symbol ), comp_pmu); -free (p.symbol); +zfree (&p.symbol);return r ? r->type :PMU_EVENT_SYMBOL_ERR ; }
@@ -1717,8 +1717,8 @@ static void parse_events_print_error(struct parse_events_error *err,fprintf (stderr,"%*s\\___ %s\n" , idx +1 ,"" , err->str);if (err->help)fprintf (stderr,"\n%s\n" , err->help); -free (err->str); -free (err->help); +zfree (&err->str); +zfree (&err->help); }fprintf (stderr,"Run 'perf list' for a list of valid events\n" );
@@ -2413,7 +2413,7 @@ void parse_events_terms__purge(struct list_head *terms)list_for_each_entry_safe (term, h, terms, list) {if (term->array.nr_ranges) -free (term->array.ranges); +zfree (&term->array.ranges);list_del_init (&term->list);free (term); }
@@ -2429,7 +2429,7 @@ void parse_events_terms__delete(struct list_head *terms)void parse_events__clear_array (struct parse_events_array *a) { -free (a->ranges); +zfree (&a->ranges); } void parse_events_evlist_error(struct parse_events_evlist *data,
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 15/32 tools lib traceevent: Robustify do_generate_dynamic_list_file
In reply to Arnaldo Carvalho de MeloFrom: David Carrillo-Cisneros <[email protected]>
The dynamic-list-file used to export dynamic symbols introduced in
commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols used by traceevent plugins")
is generated without any sort of error checking.
I experienced problems due to an old version of nm (v 0.158) that outputs in a format distinct from the assumed by the script.
Robustify the built of dynamic symbol list by enforcing that the second column of $(NM) -u <files> is either "U" (Undefined), "W" or "w" (undefined weak), which are the possible outputs from non-ancient $(NM) versions. Print an error if format is unexpected.
v2: Accept "W" and "w" symbol options.
--- tools/lib/traceevent/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
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
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 16/32 perf tools: Fix include of linux/mman.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
It was using uapi/linux/mmap.h which caused for at least one reporter, that hasn't specified in what environment the problem manifests itself:
----
The original error is:
In file included from util/event.c:2:0:...tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h:
No such file or directory
#include <uapi/asm/mman.h>
^compilation terminated.
----
Test built it on these containers:
# dm 1 alpine:3.4: Ok 2 android-ndk:r12b-arm: Ok 3 archlinux:latest: Ok 4 centos:5: Ok 5 centos:6: Ok 6 centos:7: Ok 7 debian:7: Ok 8 debian:8: Ok 9 debian:experimental: Ok 10 debian:experimental-x-arm64: Ok 11 debian:experimental-x-mips: Ok 12 debian:experimental-x-mips64: Ok 13 debian:experimental-x-mipsel: Ok 14 fedora:20: Ok 15 fedora:21: Ok 16 fedora:22: Ok 17 fedora:23: Ok 18 fedora:24: Ok 19 fedora:24-x-ARC-uClibc: Ok 20 fedora:25: Ok 21 fedora:rawhide: Ok 22 mageia:5: Ok 23 opensuse:13.2: Ok 24 opensuse:42.1: Ok 25 opensuse:tumbleweed: Ok 26 ubuntu:12.04.5: Ok 27 ubuntu:14.04.4-x-linaro-arm64: Ok 28 ubuntu:15.10: Ok 29 ubuntu:16.04: Ok 30 ubuntu:16.04-x-arm: Ok 31 ubuntu:16.04-x-arm64: Ok 32 ubuntu:16.04-x-powerpc: Ok 33 ubuntu:16.04-x-powerpc64: Ok 34 ubuntu:16.04-x-powerpc64el: Ok 35 ubuntu:16.04-x-s390: Ok 36 ubuntu:16.10: Ok
--- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/event.c +1 -1
@@ -1,5 +1,5 @@#include <linux/types.h> -#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ +#include <linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ #include <api/fs/fs.h> #include "event.h" #include "debug.h"
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 17/32 perf vendor events intel: Add uncore events for Haswell Server processor
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
This is not a full uncore event list, but a short list of useful and understandable metrics.
--- .../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 ++++++ 4 files changed, 512 insertions(+) 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
tools/perf/pmu-events/arch/x86/haswellx/uncore-cache.json new file +317 -0
@@ -0,0 +1,317 @@ +[ + { + "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "Counter": "0,1,2,3", + "EventName": "UNC_C_CLOCKTICKS", + "PerPkg": "1", + "Unit": "CBO" + }, + { + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "Counter": "0,1,2,3", + "EventCode": "0x34", + "EventName": "UNC_C_LLC_LOOKUP.ANY", + "Filter": "filter_state=0x1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x11", + "Unit": "CBO" + }, + { + "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "Counter": "0,1,2,3", + "EventCode": "0x37", + "EventName": "UNC_C_LLC_VICTIMS.M_STATE", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - Uncacheable reads (from cpu) . Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.UNCACHEABLE", + "Filter": "filter_opc=0x187", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "MMIO reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.MMIO_READ", + "Filter": "filter_opc=0x187,filter_nc=1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "MMIO writes. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.MMIO_WRITE", + "Filter": "filter_opc=0x18f,filter_nc=1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for RFO. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.RFO_LLC_PREFETCH", + "Filter": "filter_opc=0x190", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for code reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x191", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for data reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_LLC_PREFETCH", + "Filter": "filter_opc=0x192", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for PCIe read current. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "ItoM write misses (as part of fast string memcpy stores) + PCIe full line writes. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe write misses (full cache line). Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_NON_SNOOP_WRITE", + "Filter": "filter_opc=0x1c8,filter_tid=0x3e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe writes (partial cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_PARTIAL_WRITE", + "Filter": "filter_opc=0x180,filter_tid=0x3e", + "PerPkg": "1", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "L2 demand and L2 prefetch code references to LLC. Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x181", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_FULL", + "Filter": "filter_opc=0x18c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_PARTIAL", + "Filter": "filter_opc=0x18d", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe read current. Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe write references (full cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_WRITE", + "Filter": "filter_opc=0x1c8,filter_tid=0x3e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy counter for LLC data reads (demand and L2 prefetch). Derived from unc_c_tor_occupancy.miss_opcode", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.LLC_DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "HA" + }, + { + "BriefDescription": "read requests to local home agent. Derived from unc_h_requests.reads_local", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS_LOCAL", + "PerPkg": "1", + "UMask": "0x1", + "Unit": "HA" + }, + { + "BriefDescription": "read requests to remote home agent. Derived from unc_h_requests.reads_remote", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS_REMOTE", + "PerPkg": "1", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES", + "PerPkg": "1", + "UMask": "0xC", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to local home agent. Derived from unc_h_requests.writes_local", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES_LOCAL", + "PerPkg": "1", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to remote home agent. Derived from unc_h_requests.writes_remote", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES_REMOTE", + "PerPkg": "1", + "UMask": "0x8", + "Unit": "HA" + }, + { + "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously). Derived from unc_h_snoop_resp.rspcnflct", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPCNFLCT", + "PerPkg": "1", + "UMask": "0x40", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x20", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPIFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPS", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPSFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x8", + "Unit": "HA" + } +]
tools/perf/pmu-events/arch/x86/haswellx/uncore-interconnect.json new file +28 -0
@@ -0,0 +1,28 @@ +[ + { + "BriefDescription": "QPI clock ticks. Derived from unc_q_clockticks", + "Counter": "0,1,2,3", + "EventCode": "0x14", + "EventName": "UNC_Q_CLOCKTICKS", + "PerPkg": "1", + "Unit": "QPI LL" + }, + { + "BriefDescription": "Number of data flits transmitted . Derived from unc_q_txl_flits_g0.data", + "Counter": "0,1,2,3", + "EventName": "UNC_Q_TxL_FLITS_G0.DATA", + "PerPkg": "1", + "ScaleUnit": "8Bytes", + "UMask": "0x2", + "Unit": "QPI LL" + }, + { + "BriefDescription": "Number of non data (control) flits transmitted . Derived from unc_q_txl_flits_g0.non_data", + "Counter": "0,1,2,3", + "EventName": "UNC_Q_TxL_FLITS_G0.NON_DATA", + "PerPkg": "1", + "ScaleUnit": "8Bytes", + "UMask": "0x4", + "Unit": "QPI LL" + } +]
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
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 18/32 perf vendor events intel: Add uncore events for Broadwell Server
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
This is not a full uncore event list, but a short list of useful and understandable metrics.
--- .../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 ++++++ 4 files changed, 512 insertions(+) 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
tools/perf/pmu-events/arch/x86/broadwellx/uncore-cache.json new file +317 -0
@@ -0,0 +1,317 @@ +[ + { + "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "Counter": "0,1,2,3", + "EventName": "UNC_C_CLOCKTICKS", + "PerPkg": "1", + "Unit": "CBO" + }, + { + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "Counter": "0,1,2,3", + "EventCode": "0x34", + "EventName": "UNC_C_LLC_LOOKUP.ANY", + "Filter": "filter_state=0x1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x11", + "Unit": "CBO" + }, + { + "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "Counter": "0,1,2,3", + "EventCode": "0x37", + "EventName": "UNC_C_LLC_VICTIMS.M_STATE", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - Uncacheable reads (from cpu) . Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.UNCACHEABLE", + "Filter": "filter_opc=0x187", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "MMIO reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.MMIO_READ", + "Filter": "filter_opc=0x187,filter_nc=1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "MMIO writes. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.MMIO_WRITE", + "Filter": "filter_opc=0x18f,filter_nc=1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for RFO. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.RFO_LLC_PREFETCH", + "Filter": "filter_opc=0x190", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for code reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x191", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for data reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_LLC_PREFETCH", + "Filter": "filter_opc=0x192", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for PCIe read current. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "ItoM write misses (as part of fast string memcpy stores) + PCIe full line writes. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe write misses (full cache line). Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_NON_SNOOP_WRITE", + "Filter": "filter_opc=0x1c8,filter_tid=0x3e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe writes (partial cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_PARTIAL_WRITE", + "Filter": "filter_opc=0x180,filter_tid=0x3e", + "PerPkg": "1", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "L2 demand and L2 prefetch code references to LLC. Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x181", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_FULL", + "Filter": "filter_opc=0x18c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_PARTIAL", + "Filter": "filter_opc=0x18d", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe read current. Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe write references (full cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_WRITE", + "Filter": "filter_opc=0x1c8,filter_tid=0x3e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy counter for LLC data reads (demand and L2 prefetch). Derived from unc_c_tor_occupancy.miss_opcode", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.LLC_DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "HA" + }, + { + "BriefDescription": "read requests to local home agent. Derived from unc_h_requests.reads_local", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS_LOCAL", + "PerPkg": "1", + "UMask": "0x1", + "Unit": "HA" + }, + { + "BriefDescription": "read requests to remote home agent. Derived from unc_h_requests.reads_remote", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS_REMOTE", + "PerPkg": "1", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES", + "PerPkg": "1", + "UMask": "0xC", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to local home agent. Derived from unc_h_requests.writes_local", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES_LOCAL", + "PerPkg": "1", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to remote home agent. Derived from unc_h_requests.writes_remote", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES_REMOTE", + "PerPkg": "1", + "UMask": "0x8", + "Unit": "HA" + }, + { + "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously). Derived from unc_h_snoop_resp.rspcnflct", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPCNFLCT", + "PerPkg": "1", + "UMask": "0x40", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x20", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPIFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPS", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPSFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x8", + "Unit": "HA" + } +]
tools/perf/pmu-events/arch/x86/broadwellx/uncore-interconnect.json new file +28 -0
@@ -0,0 +1,28 @@ +[ + { + "BriefDescription": "QPI clock ticks. Derived from unc_q_clockticks", + "Counter": "0,1,2,3", + "EventCode": "0x14", + "EventName": "UNC_Q_CLOCKTICKS", + "PerPkg": "1", + "Unit": "QPI LL" + }, + { + "BriefDescription": "Number of data flits transmitted . Derived from unc_q_txl_flits_g0.data", + "Counter": "0,1,2,3", + "EventName": "UNC_Q_TxL_FLITS_G0.DATA", + "PerPkg": "1", + "ScaleUnit": "8Bytes", + "UMask": "0x2", + "Unit": "QPI LL" + }, + { + "BriefDescription": "Number of non data (control) flits transmitted . Derived from unc_q_txl_flits_g0.non_data", + "Counter": "0,1,2,3", + "EventName": "UNC_Q_TxL_FLITS_G0.NON_DATA", + "PerPkg": "1", + "ScaleUnit": "8Bytes", + "UMask": "0x4", + "Unit": "QPI LL" + } +]
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
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 19/32 perf vendor events intel: Add uncore events for IvyBridge Server
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
This is not a full uncore event list, but a short list of useful and understandable metrics.
--- .../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 ++++++++++++++++ 4 files changed, 692 insertions(+) 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
tools/perf/pmu-events/arch/x86/ivytown/uncore-cache.json new file +322 -0
@@ -0,0 +1,322 @@ +[ + { + "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "Counter": "0,1,2,3", + "EventName": "UNC_C_CLOCKTICKS", + "PerPkg": "1", + "Unit": "CBO" + }, + { + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "Counter": "0,1", + "EventCode": "0x34", + "EventName": "UNC_C_LLC_LOOKUP.ANY", + "Filter": "filter_state=0x1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x11", + "Unit": "CBO" + }, + { + "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "Counter": "0,1", + "EventCode": "0x37", + "EventName": "UNC_C_LLC_VICTIMS.M_STATE", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode.demand", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - Uncacheable reads. Derived from unc_c_tor_inserts.miss_opcode.uncacheable", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.UNCACHEABLE", + "Filter": "filter_opc=0x187", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for RFO. Derived from unc_c_tor_inserts.miss_opcode.rfo_prefetch", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.RFO_LLC_PREFETCH", + "Filter": "filter_opc=0x190", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for code reads. Derived from unc_c_tor_inserts.miss_opcode.code", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x191", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for data reads. Derived from unc_c_tor_inserts.miss_opcode.data_read", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_LLC_PREFETCH", + "Filter": "filter_opc=0x192", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe allocating writes that miss LLC - DDIO misses. Derived from unc_c_tor_inserts.miss_opcode.ddio_miss", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_WRITE", + "Filter": "filter_opc=0x19c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for PCIe read current. Derived from unc_c_tor_inserts.miss_opcode.pcie_read", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for ItoM writes (as part of fast string memcpy stores). Derived from unc_c_tor_inserts.miss_opcode.itom_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.ITOM_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for PCIe non-snoop reads. Derived from unc_c_tor_inserts.miss_opcode.pcie_read", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_NON_SNOOP_READ", + "Filter": "filter_opc=0x1e4", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for PCIe non-snoop writes (full line). Derived from unc_c_tor_inserts.miss_opcode.pcie_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_NON_SNOOP_WRITE", + "Filter": "filter_opc=0x1e6", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode.streaming_full", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_FULL", + "Filter": "filter_opc=0x18c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode.streaming_partial", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_PARTIAL", + "Filter": "filter_opc=0x18d", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Partial PCIe reads. Derived from unc_c_tor_inserts.opcode.pcie_partial", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_PARTIAL_READ", + "Filter": "filter_opc=0x195", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe allocating writes that hit in LLC (DDIO hits). Derived from unc_c_tor_inserts.opcode.ddio_hit", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_WRITE", + "Filter": "filter_opc=0x19c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe read current. Derived from unc_c_tor_inserts.opcode.pcie_read_current", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "ItoM write hits (as part of fast string memcpy stores). Derived from unc_c_tor_inserts.opcode.itom_write_hit", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.ITOM_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe non-snoop reads. Derived from unc_c_tor_inserts.opcode.pcie_read", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_READ", + "Filter": "filter_opc=0x1e4", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe non-snoop writes (partial). Derived from unc_c_tor_inserts.opcode.pcie_partial_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_PARTIAL_WRITE", + "Filter": "filter_opc=0x1e5", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe non-snoop writes (full line). Derived from unc_c_tor_inserts.opcode.pcie_full_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_WRITE", + "Filter": "filter_opc=0x1e6", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy for all LLC misses that are addressed to local memory. Derived from unc_c_tor_occupancy.miss_local", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.MISS_LOCAL", + "PerPkg": "1", + "UMask": "0x2A", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy counter for LLC data reads (demand and L2 prefetch). Derived from unc_c_tor_occupancy.miss_opcode.llc_data_read", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.LLC_DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy for all LLC misses that are addressed to remote memory. Derived from unc_c_tor_occupancy.miss_remote", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.MISS_REMOTE", + "PerPkg": "1", + "UMask": "0x8A", + "Unit": "CBO" + }, + { + "BriefDescription": "Read requests to home agent. Derived from unc_h_requests.reads", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "HA" + }, + { + "BriefDescription": "Write requests to home agent. Derived from unc_h_requests.writes", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES", + "PerPkg": "1", + "UMask": "0xC", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x20", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPIFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPS", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPSFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x8", + "Unit": "HA" + } +]
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
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 20/32 perf vendor events intel: Add uncore events for Sandy Bridge Server
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
This is not a full uncore event list, but a short list of useful and understandable metrics.
--- .../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 +++++++++++++++++++++ 4 files changed, 582 insertions(+) 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
tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json new file +209 -0
@@ -0,0 +1,209 @@ +[ + { + "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "Counter": "0,1,2,3", + "EventName": "UNC_C_CLOCKTICKS", + "PerPkg": "1", + "Unit": "CBO" + }, + { + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "Counter": "0,1", + "EventCode": "0x34", + "EventName": "UNC_C_LLC_LOOKUP.ANY", + "Filter": "filter_state=0x1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x11", + "Unit": "CBO" + }, + { + "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "Counter": "0,1", + "EventCode": "0x37", + "EventName": "UNC_C_LLC_VICTIMS.M_STATE", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode.demand", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - Uncacheable reads. Derived from unc_c_tor_inserts.miss_opcode.uncacheable", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.UNCACHEABLE", + "Filter": "filter_opc=0x187", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe allocating writes that miss LLC - DDIO misses. Derived from unc_c_tor_inserts.miss_opcode.ddio_miss", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_WRITE", + "Filter": "filter_opc=0x19c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for ItoM writes (as part of fast string memcpy stores). Derived from unc_c_tor_inserts.miss_opcode.itom_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_MISSES.ITOM_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode.streaming_full", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_FULL", + "Filter": "filter_opc=0x18c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode.streaming_partial", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_PARTIAL", + "Filter": "filter_opc=0x18d", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Partial PCIe reads. Derived from unc_c_tor_inserts.opcode.pcie_partial", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_PARTIAL_READ", + "Filter": "filter_opc=0x195", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe allocating writes that hit in LLC (DDIO hits). Derived from unc_c_tor_inserts.opcode.ddio_hit", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_WRITE", + "Filter": "filter_opc=0x19c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe read current. Derived from unc_c_tor_inserts.opcode.pcie_read_current", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "ItoM write hits (as part of fast string memcpy stores). Derived from unc_c_tor_inserts.opcode.itom_write_hit", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.ITOM_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe non-snoop reads. Derived from unc_c_tor_inserts.opcode.pcie_read", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_READ", + "Filter": "filter_opc=0x1e4", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe non-snoop writes (partial). Derived from unc_c_tor_inserts.opcode.pcie_partial_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_PARTIAL_WRITE", + "Filter": "filter_opc=0x1e5", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe non-snoop writes (full line). Derived from unc_c_tor_inserts.opcode.pcie_full_write", + "Counter": "0,1", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_WRITE", + "Filter": "filter_opc=0x1e6", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy counter for all LLC misses; we divide this by UNC_C_CLOCKTICKS to get average Q depth. Derived from unc_c_tor_occupancy.miss_all", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.MISS_ALL", + "Filter": "filter_opc=0x182", + "MetricExpr": "(UNC_C_TOR_OCCUPANCY.MISS_ALL / UNC_C_CLOCKTICKS) * 100.", + "PerPkg": "1", + "UMask": "0xa", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy counter for LLC data reads (demand and L2 prefetch). Derived from unc_c_tor_occupancy.miss_opcode.llc_data_read", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.LLC_DATA_READ", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES", + "PerPkg": "1", + "UMask": "0xc", + "Unit": "HA" + } +]
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
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 21/32 perf vendor events intel: Add uncore events for Xeon Phi (Knights Landing)
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add metrics for memory and MCDRAM. Minimal metrics only for now.
--- .../arch/x86/knightslanding/uncore-memory.json | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/uncore-memory.json
tools/perf/pmu-events/arch/x86/knightslanding/uncore-memory.json new file +42 -0
@@ -0,0 +1,42 @@ +[ + { + "BriefDescription": "ddr bandwidth read (CPU traffic only) (MB/sec). ", + "Counter": "0,1,2,3", + "EventCode": "0x03", + "EventName": "UNC_M_CAS_COUNT.RD", + "PerPkg": "1", + "ScaleUnit": "6.4e-05MiB", + "UMask": "0x01", + "Unit": "imc" + }, + { + "BriefDescription": "ddr bandwidth write (CPU traffic only) (MB/sec). ", + "Counter": "0,1,2,3", + "EventCode": "0x03", + "EventName": "UNC_M_CAS_COUNT.WR", + "PerPkg": "1", + "ScaleUnit": "6.4e-05MiB", + "UMask": "0x02", + "Unit": "imc" + }, + { + "BriefDescription": "mcdram bandwidth read (CPU traffic only) (MB/sec). ", + "Counter": "0,1,2,3", + "EventCode": "0x01", + "EventName": "UNC_E_RPQ_INSERTS", + "PerPkg": "1", + "ScaleUnit": "6.4e-05MiB", + "UMask": "0x01", + "Unit": "edc_eclk" + }, + { + "BriefDescription": "mcdram bandwidth write (CPU traffic only) (MB/sec). ", + "Counter": "0,1,2,3", + "EventCode": "0x02", + "EventName": "UNC_E_WPQ_INSERTS", + "PerPkg": "1", + "ScaleUnit": "6.4e-05MiB", + "UMask": "0x01", + "Unit": "edc_eclk" + } +]
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 22/32 perf vendor events intel: Add uncore events for Broadwell DE
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
This is not a full uncore event list, but a short list of useful and understandable metrics.
--- .../arch/x86/broadwellde/uncore-cache.json | 317 +++++++++++++++++++++ .../arch/x86/broadwellde/uncore-memory.json | 83 ++++++ .../arch/x86/broadwellde/uncore-power.json | 84 ++++++ 3 files changed, 484 insertions(+) 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
tools/perf/pmu-events/arch/x86/broadwellde/uncore-cache.json new file +317 -0
@@ -0,0 +1,317 @@ +[ + { + "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "Counter": "0,1,2,3", + "EventName": "UNC_C_CLOCKTICKS", + "PerPkg": "1", + "Unit": "CBO" + }, + { + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "Counter": "0,1,2,3", + "EventCode": "0x34", + "EventName": "UNC_C_LLC_LOOKUP.ANY", + "Filter": "filter_state=0x1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x11", + "Unit": "CBO" + }, + { + "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "Counter": "0,1,2,3", + "EventCode": "0x37", + "EventName": "UNC_C_LLC_VICTIMS.M_STATE", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses - Uncacheable reads (from cpu) . Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.UNCACHEABLE", + "Filter": "filter_opc=0x187", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "MMIO reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.MMIO_READ", + "Filter": "filter_opc=0x187,filter_nc=1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "MMIO writes. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.MMIO_WRITE", + "Filter": "filter_opc=0x18f,filter_nc=1", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for RFO. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.RFO_LLC_PREFETCH", + "Filter": "filter_opc=0x190", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for code reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x191", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC prefetch misses for data reads. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.DATA_LLC_PREFETCH", + "Filter": "filter_opc=0x192", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "LLC misses for PCIe read current. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "ItoM write misses (as part of fast string memcpy stores) + PCIe full line writes. Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_WRITE", + "Filter": "filter_opc=0x1c8", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe write misses (full cache line). Derived from unc_c_tor_inserts.miss_opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_MISSES.PCIE_NON_SNOOP_WRITE", + "Filter": "filter_opc=0x1c8,filter_tid=0x3e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe writes (partial cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_NS_PARTIAL_WRITE", + "Filter": "filter_opc=0x180,filter_tid=0x3e", + "PerPkg": "1", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "L2 demand and L2 prefetch code references to LLC. Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.CODE_LLC_PREFETCH", + "Filter": "filter_opc=0x181", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_FULL", + "Filter": "filter_opc=0x18c", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.STREAMING_PARTIAL", + "Filter": "filter_opc=0x18d", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe read current. Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_READ", + "Filter": "filter_opc=0x19e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "PCIe write references (full cache line). Derived from unc_c_tor_inserts.opcode", + "Counter": "0,1,2,3", + "EventCode": "0x35", + "EventName": "LLC_REFERENCES.PCIE_WRITE", + "Filter": "filter_opc=0x1c8,filter_tid=0x3e", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x1", + "Unit": "CBO" + }, + { + "BriefDescription": "Occupancy counter for LLC data reads (demand and L2 prefetch). Derived from unc_c_tor_occupancy.miss_opcode", + "EventCode": "0x36", + "EventName": "UNC_C_TOR_OCCUPANCY.LLC_DATA_READ", + "Filter": "filter_opc=0x182", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "CBO" + }, + { + "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS", + "PerPkg": "1", + "UMask": "0x3", + "Unit": "HA" + }, + { + "BriefDescription": "read requests to local home agent. Derived from unc_h_requests.reads_local", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS_LOCAL", + "PerPkg": "1", + "UMask": "0x1", + "Unit": "HA" + }, + { + "BriefDescription": "read requests to remote home agent. Derived from unc_h_requests.reads_remote", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.READS_REMOTE", + "PerPkg": "1", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES", + "PerPkg": "1", + "UMask": "0xC", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to local home agent. Derived from unc_h_requests.writes_local", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES_LOCAL", + "PerPkg": "1", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "write requests to remote home agent. Derived from unc_h_requests.writes_remote", + "Counter": "0,1,2,3", + "EventCode": "0x1", + "EventName": "UNC_H_REQUESTS.WRITES_REMOTE", + "PerPkg": "1", + "UMask": "0x8", + "Unit": "HA" + }, + { + "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously). Derived from unc_h_snoop_resp.rspcnflct", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPCNFLCT", + "PerPkg": "1", + "UMask": "0x40", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x20", + "Unit": "HA" + }, + { + "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPIFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x4", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPS", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x2", + "Unit": "HA" + }, + { + "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "Counter": "0,1,2,3", + "EventCode": "0x21", + "EventName": "UNC_H_SNOOP_RESP.RSPSFWD", + "PerPkg": "1", + "ScaleUnit": "64Bytes", + "UMask": "0x8", + "Unit": "HA" + } +]
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
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 23/32 tools lib bpf: Add missing header to the library
In reply to Arnaldo Carvalho de MeloFrom: Mickaël Salaün <[email protected]>
Include stddef.h to define size_t.
--- tools/lib/bpf/bpf.h | 1 + 1 file changed, 1 insertion(+)
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);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 24/32 tools include: Add a __fallthrough statement
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7:
CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (*p)
^
util/string.c:24:3: note: here
case '\0':
^~~~So we introduce:
#define __fallthrough __attribute__ ((fallthrough))
And use it in such cases.
--- tools/include/linux/compiler.h | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/include/linux/compiler.h +9 -0
@@ -126,4 +126,13 @@ 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 +# if defined(__GNUC__) && __GNUC__ >=7 +# define __fallthrough __attribute__ ((fallthrough)) +# else +# define __fallthrough +# endif +#endif +#endif /* _TOOLS_LINUX_COMPILER_H */
Signature · 1 line
2.9.3
Re: [PATCH 24/32] tools include: Add a __fallthrough statement
Quoted 4 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7:
I believe this should be added to compiler_gcc.h
tools/include/linux/compiler.h
Quoted 1 line
tools/include/linux/compiler.h +0
-0
[]
Quoted 14 lines
tools/include/linux/compiler.h +9
-0@@ -126,4 +126,13 @@ 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 +# if defined(__GNUC__) && __GNUC__ >=7 +# define __fallthrough __attribute__ ((fallthrough)) +# else +# define __fallthrough +# endif +#endif +#endif /* _TOOLS_LINUX_COMPILER_H */
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 24/32] tools include: Add a __fallthrough statement
Em Thu, Feb 09, 2017 at 07:02:06PM -0800, Joe Perches escreveu:
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 4 lines
From: Arnaldo Carvalho de Melo <[email protected]>
For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7:
I believe this should be added to
compiler_gcc.h
We still don't have it in tools/include/linux, but yeah, its a good idea to have the equivalent of include/linux/compiler-gcc.h.
Then, at some point, the kernel can grab the definition from tools, i.e. when people start trying to build the kernel _and_ this specific warning is enabled there, as it is in tools/.
- Arnaldo
Quoted 16 lines
tools/include/linux/compiler.h
Quoted 1 line
tools/include/linux/compiler.h +0
-0[]
Quoted 14 lines
tools/include/linux/compiler.h +9
-0@@ -126,4 +126,13 @@ 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 +# if defined(__GNUC__) && __GNUC__ >=7 +# define __fallthrough __attribute__ ((fallthrough)) +# else +# define __fallthrough +# endif +#endif +#endif /* _TOOLS_LINUX_COMPILER_H */
PATCH 1/1 compiler/compiler-gcc: Add __fallthrough
gcc v7.0 can warn on missing break statements from case labels using a special __attribute__((fallthrough))__ marker.
Add a __fallthrough convenience macro for gcc versions >= 7 and make the generic use of __fallthrough a no-op.
--- include/linux/compiler-gcc.h | 7 +++++++ include/linux/compiler.h | 6 ++++++ 2 files changed, 13 insertions(+)
include/linux/compiler-gcc.h +7 -0
@@ -304,6 +304,13 @@#define __no_sanitize_address __attribute__((no_sanitize_address))#endif +#if GCC_VERSION >=70000 +/* +* Tell the compiler not to warn when a switch/case fallthrough marker exists +*/ +#define __fallthrough __attribute__ ((fallthrough)) +#endif +#endif /* gcc version >= 40000 specific checks */ #if !defined(__noclone)
include/linux/compiler.h +6 -0
@@ -477,6 +477,12 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s#define __assume_aligned (a, ...)#endif +/* +* switch/case fallthrough checking +*/ +#ifndef __fallthrough +#define __fallthrough +#endif /* Are two types/vars the same type (ignoring qualifiers)? */ #ifndef __same_type
Signature · 1 line
2.10.0.rc2.1.g053435c
Arnaldo Carvalho de Melo
maintainerRe: [PATCH] compiler/compiler-gcc: Add __fallthrough
Em Fri, Feb 10, 2017 at 09:08:35AM -0800, Joe Perches escreveu:
Quoted 5 lines
gcc v7.0 can warn on missing break statements from case labels using a special __attribute__((fallthrough))__ marker.
Add a
__fallthroughconvenience macro for gcc versions >= 7 and make the generic use of__fallthrougha no-op.
Can you state in the log message were this idea came from? Say, something like:
"This was introduced in the tools/include/linux/compiler.h, where it was first noticed while buildint tools/perf/ in a Fedora Rawhide environment."
BTW, I added this to my tree:
tools include: Introduce linux/compiler-gcc.h
To match the kernel headers structure, setting up things that are specific to gcc or to some specific version of gcc.
It gets included by linux/compiler.h when gcc is the compiler being used.
Thanks,
- Arnaldo
Quoted 43 lines
Signed-off-by Joe Perches <[email protected]>--- include/linux/compiler-gcc.h | 7 +++++++ include/linux/compiler.h | 6 ++++++ 2 files changed, 13 insertions(+)include/linux/compiler-gcc.h +7
-0@@ -304,6 +304,13 @@#define __no_sanitize_address __attribute__((no_sanitize_address))#endif +#if GCC_VERSION >=70000 +/* +* Tell the compiler not to warn when a switch/case fallthrough marker exists +*/ +#define __fallthrough __attribute__ ((fallthrough)) +#endif +#endif /* gcc version >= 40000 specific checks */ #if !defined(__noclone)include/linux/compiler.h +6
-0@@ -477,6 +477,12 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s#define __assume_aligned (a, ...)#endif +/* +* switch/case fallthrough checking +*/ +#ifndef __fallthrough +#define __fallthrough +#endif /* Are two types/vars the same type (ignoring qualifiers)? */ #ifndef __same_typeSignature · 1 line
2.10.0.rc2.1.g053435c
Re: [PATCH] compiler/compiler-gcc: Add __fallthrough
Quoted 7 lines · Arnaldo Carvalho de Melo
Em Fri, Feb 10, 2017 at 09:08:35AM -0800, Joe Perches escreveu:
Quoted 5 lines
gcc v7.0 can warn on missing break statements from case labels using a special __attribute__((fallthrough))__ marker.
Add a
__fallthroughconvenience macro for gcc versions >= 7 and make the generic use of__fallthrougha no-op.
Quoted 6 lines
Can you state in the log message were this idea came from? Say, something like:
"This was introduced in the
tools/include/linux/compiler.h, where it was first noticed while buildinttools/perf/in a Fedora Rawhide environment."
The request is from at least 2002.
Maybe Andrew could add a link like:
if he applies it.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: compiler/compiler-gcc: Add __fallthrough
Quoted 13 lines · Andriy
Quoted 11 lines · Joe Perches
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Joe Perches
gcc v7.0 can warn on missing break statements from case labels using a special __attribute__((fallthrough))__ marker.
Add a
__fallthroughconvenience macro for gcc versions >= 7 and make the generic use of__fallthrougha no-op.So, what happened to this change? Andrew?
Did you mean to send this just to me?
Quoted 7 lines
Oops, not exactly, though...
Quoted 3 lines
No idea really.
It seemed like a decent idea though....it might make sense to ping Andrew.
Well, OK.
Arnaldo Carvalho de Melo
maintainerPATCH 25/32 tools string: Use __fallthrough in perf_atoll()
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The implicit fall through case label here is intended, so let us inform that to gcc >= 7:
CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (*p)
^
util/string.c:24:3: note: here
case '\0':
^~~~--- tools/perf/util/string.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/string.c +2 -0
@@ -21,6 +21,8 @@ s64 perf_atoll(const char *str)case 'b' :case 'B' :if (*p) goto out_err; + + __fallthrough;case '\0' :return length;default :
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 26/32 tools strfilter: Use __fallthrough
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The implicit fall through case label here is intended, so let us inform that to gcc >= 7:
util/strfilter.c: In function 'strfilter_node__sprint':
util/strfilter.c:270:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (len < 0)
^
util/strfilter.c:272:2: note: here
case '!':
^~~~cc1: all warnings being treated as errors
--- tools/perf/util/strfilter.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/strfilter.c +1 -0
@@ -269,6 +269,7 @@ static int strfilter_node__sprint(struct strfilter_node *node, char *buf) len =strfilter_node__sprint_pt (node->l, buf);if (len <0 )return len; + __fallthrough;case '!' :if (buf) { *(buf + len++) = *node->p;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 27/32 perf top: Use __fallthrough
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The implicit fall through case label here is intended, so let us inform that to gcc >= 7:
CC /tmp/build/perf/builtin-top.o
builtin-top.c: In function 'display_thread':
builtin-top.c:644:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (errno == EINTR)
^ builtin-top.c:647:3: note: here
default:
^~~~~~~
--- tools/perf/builtin-top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-top.c +1 -1
@@ -643,7 +643,7 @@ static void *display_thread(void *arg)case -1 :if (errno ==EINTR )continue ; -/* Fall trhu */ + __fallthrough;default : c =getc (stdin);tcsetattr (0 ,TCSAFLUSH , &save);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 28/32 perf thread_map: Correctly size buffer used with dirent->dt_name
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The size of dirent->dt_name is NAME_MAX + 1, but the size for the 'path' buffer is hard coded at 256, which may truncate it because we also prepend "/proc/", so that all that into account and thank gcc 7 for this warning:
/git/linux/tools/perf/util/thread_map.c: In function 'thread_map__new_by_uid':
/git/linux/tools/perf/util/thread_map.c:119:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 250 [-Werror=format-truncation=]
snprintf(path, sizeof(path), "/proc/%s", dirent->d_name);
^~
In file included from /usr/include/stdio.h:939:0,
from /git/linux/tools/perf/util/thread_map.c:5:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 7 and 262 bytes into a destination of size 256
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread_map.c +1 -1
@@ -93,7 +93,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid) {DIR *proc;int max_threads =32 , items, i; -char path[256 ]; +char path[NAME_MAX +1 +6 ];struct dirent *dirent, **namelist =NULL ;struct thread_map *threads =thread_map__alloc (max_threads);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 29/32 perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
In commit daeecbc0c431 ("perf tools: Add event_update event scale type"), the handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a pointer to event_update_event_scale, uses some field from this casted struct and then ends up falling through to the handling of another event type, PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops, fix it by inserting the missing break.
Noticed when building perf using gcc 7 on Fedora Rawhide:
util/header.c: In function 'perf_event__process_event_update':
util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
evsel->scale = ev_scale->scale;
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
util/header.c:3208:2: note: here
case PERF_EVENT_UPDATE__CPUS:
^~~~This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map with the correct data.
--- tools/perf/util/header.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/header.c +1 -0
@@ -3205,6 +3205,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused,case PERF_EVENT_UPDATE__SCALE : ev_scale = (struct event_update_event_scale *) ev->data; evsel->scale = ev_scale->scale; +break ;case PERF_EVENT_UPDATE__CPUS : ev_cpus = (struct event_update_event_cpus *) ev->data;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 30/32 perf bench numa: Avoid possible truncation when using snprintf()
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Addressing this warning from gcc 7:
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function '__bench_numa':
bench/numa.c:1582:42: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 8 and 17 [-Werror=format-truncation=]
snprintf(tname, 32, "process%d:thread%d", p, t);
^~
bench/numa.c:1582:25: note: directive argument in the range [0, 2147483647]
snprintf(tname, 32, "process%d:thread%d", p, t);
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:939:0,
from bench/../util/util.h:47,
from bench/../builtin.h:4,
from bench/numa.c:11:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 17 and 35 bytes into a destination of size 32
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
--- tools/perf/bench/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/bench/numa.c +3 -3
@@ -1573,13 +1573,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,
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 31/32 perf tests: Avoid possible truncation with dirent->d_name + snprintf
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Addressing a few cases spotted by a new warning in gcc 7:
tests/parse-events.c: In function 'test_pmu_events':
tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=]
snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
^~
In file included from /usr/include/stdio.h:939:0,
from /git/linux/tools/perf/util/map.h:9,
from /git/linux/tools/perf/util/symbol.h:7,
from /git/linux/tools/perf/util/evsel.h:10,
from tests/parse-events.c:3:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=]
snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);--- tools/perf/tests/parse-events.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tools/perf/tests/parse-events.c +3 -5
@@ -1779,15 +1779,14 @@ static int test_pmu_events(void) }while (!ret && (ent =readdir (dir))) { -#define MAX_NAME 100struct evlist_test e; -char name[MAX_NAME ]; +char name[2 *NAME_MAX +1 +12 +3 ];/* Names containing . are special and cannot be used directly */ if (strchr (ent->d_name,'.' ))continue ; -snprintf (name,MAX_NAME ,"cpu/event=%s/u" , ent->d_name); +snprintf (name,sizeof (name),"cpu/event=%s/u" , ent->d_name); e.name = name; e.check = test__checkevent_pmu_events;
@@ -1795,11 +1794,10 @@ static int test_pmu_events(void) ret =test_event (&e);if (ret)break ; -snprintf (name,MAX_NAME ,"%s:u,cpu/event=%s/u" , ent->d_name, ent->d_name); +snprintf (name,sizeof (name),"%s:u,cpu/event=%s/u" , ent->d_name, ent->d_name); e.name = name; e.check = test__checkevent_pmu_events_mix; ret =test_event (&e); -#undef MAX_NAME }closedir (dir);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 32/32 perf intel-pt: Use __fallthrough
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To address new warnings emmited by gcc 7, e.g.::
CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o
CC /tmp/build/perf/tests/parse-events.o
util/intel-pt-decoder/intel-pt-pkt-decoder.c: In function 'intel_pt_pkt_desc':
util/intel-pt-decoder/intel-pt-pkt-decoder.c:499:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (!(packet->count))
^
util/intel-pt-decoder/intel-pt-pkt-decoder.c:501:2: note: here
case INTEL_PT_CYC:
^~~~
CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.occ1: all warnings being treated as errors
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 +++++ tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 ++ 2 files changed, 7 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +5 -0
@@ -22,6 +22,7 @@#include <errno.h> #include <stdint.h> #include <inttypes.h> +#include <linux/compiler.h> #include "../cache.h" #include "../util.h"
@@ -1746,6 +1747,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder)switch (decoder->packet.type) {case INTEL_PT_TIP_PGD : decoder->continuous_period = false; + __fallthrough;case INTEL_PT_TIP_PGE :case INTEL_PT_TIP :intel_pt_log ("ERROR: Unexpected packet\n" );
@@ -1799,6 +1801,8 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) decoder->pge = false; decoder->continuous_period = false;intel_pt_clear_tx_flags (decoder); + __fallthrough; +case INTEL_PT_TNT : decoder->have_tma = false;intel_pt_log ("ERROR: Unexpected packet\n" );
@@ -1839,6 +1843,7 @@ static int intel_pt_walk_to_ip(struct intel_pt_decoder *decoder)switch (decoder->packet.type) {case INTEL_PT_TIP_PGD : decoder->continuous_period = false; + __fallthrough;case INTEL_PT_TIP_PGE :case INTEL_PT_TIP : decoder->pge = decoder->packet.type !=INTEL_PT_TIP_PGD ;
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +2 -0
@@ -17,6 +17,7 @@#include <string.h> #include <endian.h> #include <byteswap.h> +#include <linux/compiler.h> #include "intel-pt-pkt-decoder.h"
@@ -498,6 +499,7 @@ int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf,case INTEL_PT_FUP :if (!(packet->count))return snprintf (buf, buf_len,"%s no ip" , name); + __fallthrough;case INTEL_PT_CYC :case INTEL_PT_VMCS :case INTEL_PT_MTC :
Signature · 1 line
2.9.3
Quoted 246 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
53e74a112ce5c1c9b6a6923bdd6612133625d579:Merge tag 'perf-urgent-for-mingo-4.10-20170203' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/urgent (2017-02-03 20:42:30 +0100)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-4.11-20170209for you to fetch changes up to
7ea6856d6f5629d742edc23b8b76e6263371ef45:perf intel-pt: Use
__fallthrough(2017-02-09 16:32:03 -0300)----------------------------------------------------------------
perf/core improvements and fixes:User visible:
- 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)
- Support --symfs in 'perf probe' (Uwe Kleine-K?nig)
- Add support for generating bpf prologue on the aarch64 architecture (He Kuang)
- Show proper hint when SDT event not yet in place via 'perf probe' (Ravi Bangoria)
- Take into account symfs setting when reading file build ID (Victor Kamensky)
Infrastructure:
- Map gcc7's '
__attribute__((fallthrough))', that warns when code associated to case blocks in switches continue into the next case entry, to '__falltrough' and use it where warned by gcc, tested on Fedora Rawhide (Arnaldo Carvalho de Melo)- Fix buffer sizes used with snprintf that could lead to truncation, another warning introduced in gcc7 (Arnaldo Carvalho de Melo)
- Robustify
do_generate_dynamic_list_filein libtraceevent (David Carrillo-Cisneros)- Use
zfree()in more places (Taeung Song)Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Andi Kleen (11):
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 DEArnaldo Carvalho de Melo (11):
Merge remote-tracking branch 'tip/perf/urgent' into perf/core perf tools: Fix include oflinux/mman.h
tools include: Add a__fallthroughstatement
tools string: Use__fallthroughinperf_atoll()
tools strfilter: Use__fallthrough
perf top: Use__fallthrough
perfthread_map: Correctly size buffer used withdirent->dt_nameperf header: Fix handling ofPERF_EVENT_UPDATE__SCALEperf bench numa: Avoid possible truncation when usingsnprintf()perf tests: Avoid possible truncation withdirent->d_name+ snprintf perf intel-pt: Use__fallthroughDavid Carrillo-Cisneros (1):
tools lib traceevent: Robustifydo_generate_dynamic_list_fileHe Kuang (2):
perf tools arm64: Add support for generating bpf prologue perf bpf: Add missing newline in debug messagesMicka?l Sala?n (1):
tools lib bpf: Add missing header to the libraryRavi Bangoria (1):
perf sdt: Show proper hint when event not yet in place via 'perf probe'Taeung Song (4):
perf tools: Only increase index ifperf_evsel__new_idx()succeeds perf tools: Add missing check for failure in azalloc()call perf tools: Usezfree()instead of ad hoc equivalent perf tools: Usezfree()to avoid keeping dangling pointersUwe Kleine-K?nig (1):
perf probe: Add option --symfsVictor Kamensky (1):
perf symbols: Take into account symfs setting when reading file build IDMakefile | 6 +- arch/x86/events/Makefile | 13 +- arch/x86/events/amd/Makefile | 7 + arch/x86/events/amd/uncore.c | 204 ++++++++----- arch/x86/events/intel/pt.c | 6 + include/linux/kprobes.h | 30 +- include/linux/perf_event.h | 2 +- kernel/events/core.c | 223 ++++++++------ kernel/extable.c | 9 +- kernel/kprobes.c | 73 +++-- 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.h | 9 + 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/parse-options.h | 19 +- tools/lib/traceevent/Makefile | 14 +- tools/perf/Build | 5 +- tools/perf/Documentation/perf-c2c.txt | 2 +- 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/Makefile.config | 6 +- 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/numa.c | 6 +- tools/perf/builtin-c2c.c | 3 +- tools/perf/builtin-ftrace.c | 265 +++++++++++++++++ tools/perf/builtin-help.c | 8 +- tools/perf/builtin-kallsyms.c | 67 +++++ tools/perf/builtin-kmem.c | 8 +- tools/perf/builtin-list.c | 3 + tools/perf/builtin-probe.c | 2 + tools/perf/builtin-record.c | 158 +++++++++- tools/perf/builtin-report.c | 4 +- tools/perf/builtin-sched.c | 130 ++++++++- tools/perf/builtin-script.c | 3 +- tools/perf/builtin-top.c | 6 +- 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/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/header.c | 7 +- tools/perf/util/hist.c | 4 +- .../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 | 19 ++ tools/perf/util/machine.h | 1 + tools/perf/util/parse-events.c | 69 +++-- tools/perf/util/parse-events.y | 35 ++- tools/perf/util/pmu.c | 109 ++++--- tools/perf/util/pmu.h | 1 + tools/perf/util/probe-event.c | 11 +- .../perf/util/scripting-engines/trace-event-perl.c | 6 +- tools/perf/util/session.c | 2 +- tools/perf/util/strfilter.c | 1 + tools/perf/util/string.c | 2 + tools/perf/util/symbol.c | 6 +- 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 | 12 +- 122 files changed, 5101 insertions(+), 550 deletions(-) create mode 100644 arch/x86/events/amd/Makefile 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
Quoted 8 lines
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
Pulled, thanks a lot Arnaldo!
Ingo