1. 13 Nov, 2021 40 commits
    • James Clark's avatar
      perf test: Remove bash construct from stat_bpf_counters.sh test · c8b94764
      James Clark authored
      Currently the test skips with an error because == only works in bash:
      
        $ ./perf test 91 -v
        Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
        91: perf stat --bpf-counters test                                   :
        --- start ---
        test child forked, pid 44586
        ./tests/shell/stat_bpf_counters.sh: 26: [: -v: unexpected operator
        test child finished with -2
        ---- end ----
        perf stat --bpf-counters test: Skip
      
      Changing == to = does the same thing, but doesn't result in an error:
      
        ./perf test 91 -v
        Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
        91: perf stat --bpf-counters test                                   :
        --- start ---
        test child forked, pid 45833
        Skipping: --bpf-counters not supported
          Error: unknown option `bpf-counters'
        [...]
        test child finished with -2
        ---- end ----
        perf stat --bpf-counters test: Skip
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20211028134828.65774-2-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c8b94764
    • Sohaib Mohamed's avatar
      perf bench futex: Fix memory leak of perf_cpu_map__new() · 88e48238
      Sohaib Mohamed authored
      ASan reports memory leaks while running:
      
        $ sudo ./perf bench futex all
      
      The leaks are caused by perf_cpu_map__new not being freed.
      This patch adds the missing perf_cpu_map__put since it calls
      cpu_map_delete implicitly.
      
      Fixes: 9c3516d1 ("libperf: Add perf_cpu_map__new()/perf_cpu_map__read() functions")
      Signed-off-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: André Almeida <andrealmeid@collabora.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lore.kernel.org/lkml/20211112201134.77892-1-sohaib.amhmd@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      88e48238
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 3442b5e0
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        dae1bd58 ("x86/msr-index: Add MSRs for XFD")
      
      Addressing these tools/perf build warnings:
      
          diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
          Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
      
      That makes the beautification scripts to pick some new entries:
      
        $ diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
        --- tools/arch/x86/include/asm/msr-index.h	2021-07-15 16:17:01.819817827 -0300
        +++ arch/x86/include/asm/msr-index.h	2021-11-06 15:49:33.738517311 -0300
        @@ -625,6 +625,8 @@
      
         #define MSR_IA32_BNDCFGS_RSVD		0x00000ffc
      
        +#define MSR_IA32_XFD			0x000001c4
        +#define MSR_IA32_XFD_ERR		0x000001c5
         #define MSR_IA32_XSS			0x00000da0
      
         #define MSR_IA32_APICBASE		0x0000001b
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > /tmp/before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > /tmp/after
        $ diff -u /tmp/before /tmp/after
        --- /tmp/before	2021-11-13 11:10:39.964201505 -0300
        +++ /tmp/after	2021-11-13 11:10:47.902410873 -0300
        @@ -93,6 +93,8 @@
         	[0x000001b0] = "IA32_ENERGY_PERF_BIAS",
         	[0x000001b1] = "IA32_PACKAGE_THERM_STATUS",
         	[0x000001b2] = "IA32_PACKAGE_THERM_INTERRUPT",
        +	[0x000001c4] = "IA32_XFD",
        +	[0x000001c5] = "IA32_XFD_ERR",
         	[0x000001c8] = "LBR_SELECT",
         	[0x000001c9] = "LBR_TOS",
         	[0x000001d9] = "IA32_DEBUGCTLMSR",
        $
      
      And this gets rebuilt:
      
        CC       /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
        INSTALL  trace_plugins
        LD       /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
        LD       /tmp/build/perf/trace/beauty/perf-in.o
        LD       /tmp/build/perf/perf-in.o
        LINK     /tmp/build/perf/perf
      
      Now one can trace systemwide asking to see backtraces to where those
      MSRs are being read/written with:
      
        # perf trace -e msr:*_msr/max-stack=32/ --filter="msr==IA32_XFD || msr==IA32_XFD_ERR"
        ^C#
        #
      
      If we use -v (verbose mode) we can see what it does behind the scenes:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_XFD || msr==IA32_XFD_ERR"
        <SNIP>
        New filter for msr:read_msr: (msr==0x1c4 || msr==0x1c5) && (common_pid != 44489516 && common_pid != 8781)
        New filter for msr:write_msr: (msr==0x1c4 || msr==0x1c5) && (common_pid != 44489516 && common_pid != 8781)
        <SNIP>
        ^C#
      
      Example with a frequent msr:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
        Using CPUID AuthenticAMD-25-21-0
        0x48
        New filter for msr:read_msr: (msr==0x48) && (common_pid != 3738351 && common_pid != 3564)
        0x48
        New filter for msr:write_msr: (msr==0x48) && (common_pid != 3738351 && common_pid != 3564)
        mmap size 528384B
        Looking at the vmlinux_path (8 entries long)
        symsrc__init: build id mismatch for vmlinux.
        Using /proc/kcore for kernel data
        Using /proc/kallsyms for symbols
             0.000 pipewire/2479 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               __switch_to_xtra ([kernel.kallsyms])
                                               __switch_to ([kernel.kallsyms])
                                               __schedule ([kernel.kallsyms])
                                               schedule ([kernel.kallsyms])
                                               schedule_hrtimeout_range_clock ([kernel.kallsyms])
                                               do_epoll_wait ([kernel.kallsyms])
                                               __x64_sys_epoll_wait ([kernel.kallsyms])
                                               do_syscall_64 ([kernel.kallsyms])
                                               entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
                                               epoll_wait (/usr/lib64/libc-2.33.so)
                                               [0x76c4] (/usr/lib64/spa-0.2/support/libspa-support.so)
                                               [0x4cf0] (/usr/lib64/spa-0.2/support/libspa-support.so)
             0.027 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               __switch_to_xtra ([kernel.kallsyms])
                                               __switch_to ([kernel.kallsyms])
                                               __schedule ([kernel.kallsyms])
                                               schedule_idle ([kernel.kallsyms])
                                               do_idle ([kernel.kallsyms])
                                               cpu_startup_entry ([kernel.kallsyms])
                                               start_kernel ([kernel.kallsyms])
                                               secondary_startup_64_no_verify ([kernel.kallsyms])
        #
      
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Chang S. Bae <chang.seok.bae@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/YY%2FJdb6on7swsn+C@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3442b5e0
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · 06cf00c4
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        e5e32171 ("drm/i915/guc: Connect UAPI to GuC multi-lrc interface")
        9409eb35 ("drm/i915: Expose logical engine instance to user")
        ea673f17 ("drm/i915/uapi: Add comment clarifying purpose of I915_TILING_* values")
        d3ac8d42 ("drm/i915/pxp: interfaces for using protected objects")
        cbbd3764 ("drm/i915/pxp: Create the arbitrary session after boot")
      
      That don't add any new ioctl, so no changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Huang, Sean Z <sean.z.huang@intel.com>
      Cc: John Harrison <John.C.Harrison@Intel.com>
      Cc: Matthew Brost <matthew.brost@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      06cf00c4
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync sound/asound.h with the kernel sources · 37057e74
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        5aec579e ("ALSA: uapi: Fix a C++ style comment in asound.h")
      
      That is just changing a // style comment to /* */.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/sound/asound.h' differs from latest version at 'include/uapi/sound/asound.h'
        diff -u tools/include/uapi/sound/asound.h include/uapi/sound/asound.h
      
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      37057e74
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/prctl.h with the kernel sources · 49024204
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        61bc346c ("uapi/linux/prctl: provide macro definitions for the PR_SCHED_CORE type argument")
      
      That don't result in any changes in tooling:
      
        $ tools/perf/trace/beauty/prctl_option.sh > before
        $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
        $ tools/perf/trace/beauty/prctl_option.sh > after
        $ diff -u before after
        $
      
      Just silences this perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/prctl.h' differs from latest version at 'include/uapi/linux/prctl.h'
        diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
      
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Eugene Syromiatnikov <esyr@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49024204
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync arch prctl headers with the kernel sources · 5b749efe
      Arnaldo Carvalho de Melo authored
      To pick the changes in this cset:
      
        db8268df ("x86/arch_prctl: Add controls for dynamic XSTATE components")
      
      This picks these new prctls:
      
        $ tools/perf/trace/beauty/x86_arch_prctl.sh > /tmp/before
        $ cp arch/x86/include/uapi/asm/prctl.h tools/arch/x86/include/uapi/asm/prctl.h
        $ tools/perf/trace/beauty/x86_arch_prctl.sh > /tmp/after
        $ diff -u /tmp/before /tmp/after
        --- /tmp/before	2021-11-13 10:42:52.787308809 -0300
        +++ /tmp/after	2021-11-13 10:43:02.295558837 -0300
        @@ -6,6 +6,9 @@
         	[0x1004 - 0x1001]= "GET_GS",
         	[0x1011 - 0x1001]= "GET_CPUID",
         	[0x1012 - 0x1001]= "SET_CPUID",
        +	[0x1021 - 0x1001]= "GET_XCOMP_SUPP",
        +	[0x1022 - 0x1001]= "GET_XCOMP_PERM",
        +	[0x1023 - 0x1001]= "REQ_XCOMP_PERM",
         };
      
         #define x86_arch_prctl_codes_2_offset 0x2001
        $
      
      With this 'perf trace' can translate those numbers into strings and use
      the strings in filter expressions:
      
        # perf trace -e prctl
             0.000 ( 0.011 ms): DOM Worker/3722622 prctl(option: SET_NAME, arg2: 0x7f9c014b7df5)     = 0
             0.032 ( 0.002 ms): DOM Worker/3722622 prctl(option: SET_NAME, arg2: 0x7f9bb6b51580)     = 0
             5.452 ( 0.003 ms): StreamT~ns #30/3722623 prctl(option: SET_NAME, arg2: 0x7f9bdbdfeb70) = 0
             5.468 ( 0.002 ms): StreamT~ns #30/3722623 prctl(option: SET_NAME, arg2: 0x7f9bdbdfea70) = 0
            24.494 ( 0.009 ms): IndexedDB #556/3722624 prctl(option: SET_NAME, arg2: 0x7f562a32ae28) = 0
            24.540 ( 0.002 ms): IndexedDB #556/3722624 prctl(option: SET_NAME, arg2: 0x7f563c6d4b30) = 0
           670.281 ( 0.008 ms): systemd-userwo/3722339 prctl(option: SET_NAME, arg2: 0x564be30805c8) = 0
           670.293 ( 0.002 ms): systemd-userwo/3722339 prctl(option: SET_NAME, arg2: 0x564be30800f0) = 0
        ^C#
      
      This addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/prctl.h' differs from latest version at 'arch/x86/include/uapi/asm/prctl.h'
        diff -u tools/arch/x86/include/uapi/asm/prctl.h arch/x86/include/uapi/asm/prctl.h
      
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Chang S. Bae <chang.seok.bae@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/YY%2FER104k852WOTK@kernel.org/T/#uSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5b749efe
    • Jiri Olsa's avatar
      perf tools: Add more weak libbpf functions · 2a4898fc
      Jiri Olsa authored
      We hit the window where perf uses libbpf functions, that did not make it
      to the official libbpf release yet and it's breaking perf build with
      dynamicly linked libbpf.
      
      Fixing this by providing the new interface as weak functions which calls
      the original libbpf functions. Fortunatelly the changes were just
      renames.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20211109140707.1689940-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2a4898fc
    • Ian Rogers's avatar
      perf bpf: Avoid memory leak from perf_env__insert_btf() · 4924b1f7
      Ian Rogers authored
      perf_env__insert_btf() doesn't insert if a duplicate BTF id is
      encountered and this causes a memory leak. Modify the function to return
      a success/error value and then free the memory if insertion didn't
      happen.
      
      v2. Adds a return -1 when the insertion error occurs in
          perf_env__fetch_btf. This doesn't affect anything as the result is
          never checked.
      
      Fixes: 3792cb2f ("perf bpf: Save BTF in a rbtree in perf_env")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20211112074525.121633-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4924b1f7
    • Ian Rogers's avatar
      perf symbols: Factor out annotation init/exit · 4f74f187
      Ian Rogers authored
      The exit function fixes a memory leak with the src field as detected by
      leak sanitizer. An example of which is:
      
      Indirect leak of 25133184 byte(s) in 207 object(s) allocated from:
          #0 0x7f199ecfe987 in __interceptor_calloc libsanitizer/asan/asan_malloc_linux.cpp:154
          #1 0x55defe638224 in annotated_source__alloc_histograms util/annotate.c:803
          #2 0x55defe6397e4 in symbol__hists util/annotate.c:952
          #3 0x55defe639908 in symbol__inc_addr_samples util/annotate.c:968
          #4 0x55defe63aa29 in hist_entry__inc_addr_samples util/annotate.c:1119
          #5 0x55defe499a79 in hist_iter__report_callback tools/perf/builtin-report.c:182
          #6 0x55defe7a859d in hist_entry_iter__add util/hist.c:1236
          #7 0x55defe49aa63 in process_sample_event tools/perf/builtin-report.c:315
          #8 0x55defe731bc8 in evlist__deliver_sample util/session.c:1473
          #9 0x55defe731e38 in machines__deliver_event util/session.c:1510
          #10 0x55defe732a23 in perf_session__deliver_event util/session.c:1590
          #11 0x55defe72951e in ordered_events__deliver_event util/session.c:183
          #12 0x55defe740082 in do_flush util/ordered-events.c:244
          #13 0x55defe7407cb in __ordered_events__flush util/ordered-events.c:323
          #14 0x55defe740a61 in ordered_events__flush util/ordered-events.c:341
          #15 0x55defe73837f in __perf_session__process_events util/session.c:2390
          #16 0x55defe7385ff in perf_session__process_events util/session.c:2420
          ...
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211112035124.94327-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4f74f187
    • Ian Rogers's avatar
      perf symbols: Bit pack to save a byte · 42704567
      Ian Rogers authored
      Use a bit field alongside the earlier bit fields.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211112035124.94327-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      42704567
    • Ian Rogers's avatar
      perf symbols: Add documentation to 'struct symbol' · bd9acd9c
      Ian Rogers authored
      Refactor some existing comments and then infer the rest.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211112035124.94327-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bd9acd9c
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync files changed by new futex_waitv syscall · 7380aa89
      Arnaldo Carvalho de Melo authored
      To pick the changes in these csets:
      
        039c0ec9 ("futex,x86: Wire up sys_futex_waitv()")
        bf69bad3 ("futex: Implement sys_futex_waitv()")
      
      That add support for this new syscall in tools such as 'perf trace'.
      
      For instance, this is now possible:
      
        # perf trace -e futex_waitv
        ^C#
        # perf trace -v -e futex_waitv
        Using CPUID AuthenticAMD-25-21-0
        event qualifier tracepoint filter: (common_pid != 807333 && common_pid != 3564) && (id == 449)
        mmap size 528384B
        ^C#
        # perf trace -v -e futex* --max-events 10
        Using CPUID AuthenticAMD-25-21-0
        event qualifier tracepoint filter: (common_pid != 812168 && common_pid != 3564) && (id == 202 || id == 449)
        mmap size 528384B
                 ? (         ): Timer/219310  ... [continued]: futex())                                            = -1 ETIMEDOUT (Connection timed out)
             0.012 ( 0.002 ms): Timer/219310 futex(uaddr: 0x7fd0b152d3c8, op: WAKE|PRIVATE_FLAG, val: 1)           = 0
             0.024 ( 0.060 ms): Timer/219310 futex(uaddr: 0x7fd0b152d420, op: WAIT_BITSET|PRIVATE_FLAG, utime: 0x7fd0b1657840, val3: MATCH_ANY) = 0
             0.086 ( 0.001 ms): Timer/219310 futex(uaddr: 0x7fd0b152d3c8, op: WAKE|PRIVATE_FLAG, val: 1)           = 0
             0.088 (         ): Timer/219310 futex(uaddr: 0x7fd0b152d424, op: WAIT_BITSET|PRIVATE_FLAG, utime: 0x7fd0b1657840, val3: MATCH_ANY) ...
             0.075 ( 0.005 ms): Web Content/219299 futex(uaddr: 0x7fd0b152d420, op: WAKE|PRIVATE_FLAG, val: 1)     = 1
             0.169 ( 0.004 ms): Web Content/219299 futex(uaddr: 0x7fd0b152d424, op: WAKE|PRIVATE_FLAG, val: 1)     = 1
             0.088 ( 0.089 ms): Timer/219310  ... [continued]: futex())                                            = 0
             0.179 ( 0.001 ms): Timer/219310 futex(uaddr: 0x7fd0b152d3c8, op: WAKE|PRIVATE_FLAG, val: 1)           = 0
             0.181 (         ): Timer/219310 futex(uaddr: 0x7fd0b152d420, op: WAIT_BITSET|PRIVATE_FLAG, utime: 0x7fd0b1657840, val3: MATCH_ANY) ...
        #
      
      That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ grep futex_waitv tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        449	common	futex_waitv		sys_futex_waitv
        $
      
      This addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
      
      Cc: André Almeida <andrealmeid@collabora.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7380aa89
    • Guo Zhengkui's avatar
      perf test bpf: Use ARRAY_CHECK() instead of ad-hoc equivalent, addressing array_size.cocci warning · f08a8fcc
      Guo Zhengkui authored
      Address following coccicheck warnings:
      
        ./tools/perf/tests/bpf.c:316:22-23: WARNING: Use ARRAY_SIZE.
      Signed-off-by: default avatarGuo Zhengkui <guozhengkui@vivo.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: kernel@vivo.com
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20211108070801.5540-1-guozhengkui@vivo.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f08a8fcc
    • German Gomez's avatar
      perf arm-spe: Support hardware-based PID tracing · 27d113cf
      German Gomez authored
      If ARM SPE traces contains CONTEXT packets with TID info, use these
      values for tracking the TID of samples. Otherwise fall back to using
      context switch events and display a message warning to the user of
      possible timing inaccuracies [1].
      
      [1] https://lore.kernel.org/lkml/f877cfa6-9b25-6445-3806-ca44a4042eaf@arm.com/Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211111133625.193568-5-german.gomez@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      27d113cf
    • German Gomez's avatar
      perf arm-spe: Save context ID in record · 169de64f
      German Gomez authored
      This patch is to save context ID in record, this will be used to set TID
      for samples.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211111133625.193568-4-german.gomez@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      169de64f
    • German Gomez's avatar
      perf arm-spe: Update --switch-events docs in 'perf record' · 455c9882
      German Gomez authored
      Update 'perf record' docs and ARM SPE recording options so that they are
      consistent. This includes supporting the --no-switch-events flag in ARM
      SPE as well.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211111133625.193568-3-german.gomez@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      455c9882
    • Namhyung Kim's avatar
      perf arm-spe: Track task context switch for cpu-mode events · 9dc9855f
      Namhyung Kim authored
      When perf report synthesize events from ARM SPE data, it refers to
      current cpu, pid and tid in the machine.  But there's no place to set
      them in the ARM SPE decoder.  I'm seeing all pid/tid is set to -1 and
      user symbols are not resolved in the output.
      
        # perf record -a -e arm_spe_0/ts_enable=1/ sleep 1
      
        # perf report -q | head
           8.77%     8.77%  :-1      [kernel.kallsyms]  [k] format_decode
           7.02%     7.02%  :-1      [kernel.kallsyms]  [k] seq_printf
           7.02%     7.02%  :-1      [unknown]          [.] 0x0000ffff9f687c34
           5.26%     5.26%  :-1      [kernel.kallsyms]  [k] vsnprintf
           3.51%     3.51%  :-1      [kernel.kallsyms]  [k] string
           3.51%     3.51%  :-1      [unknown]          [.] 0x0000ffff9f66ae20
           3.51%     3.51%  :-1      [unknown]          [.] 0x0000ffff9f670b3c
           3.51%     3.51%  :-1      [unknown]          [.] 0x0000ffff9f67c040
           1.75%     1.75%  :-1      [kernel.kallsyms]  [k] ___cache_free
           1.75%     1.75%  :-1      [kernel.kallsyms]  [k] __count_memcg_events
      
      Like Intel PT, add context switch records to track task info.  As ARM
      SPE support was added later than PERF_RECORD_SWITCH_CPU_WIDE, I think
      we can safely set the attr.context_switch bit and use it.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211111133625.193568-2-german.gomez@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9dc9855f
    • Kajol Jain's avatar
      perf vendor events power10: Add metric events JSON file for power10 platform · 3ca3af7d
      Kajol Jain authored
      Add PMU metric JSON file for power10 platform.
      Signed-off-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: default avatarPaul Clarke <pc@us.ibm.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lore.kernel.org/lkml/20211108060010.177517-1-kjain@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3ca3af7d
    • Like Xu's avatar
      perf design.txt: Synchronize the definition of enum perf_hw_id with code · 438f1a9f
      Like Xu authored
      We're not surprised that there are tons of Linux users who only read the
      documentation to learn about the kernel.
      
      Let's update the perf part for common hardware events since three new
      *generic* hardware events were added.
      Signed-off-by: default avatarLike Xu <likexu@tencent.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20211109090147.56978-1-likexu@tencent.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      438f1a9f
    • Andrew Kilroy's avatar
      perf arm-spe: Print size using consistent format · 09e9afac
      Andrew Kilroy authored
      Since the size is already printed earlier in hex, print the same data
      using the same format, in hex.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarAndrew Kilroy <andrew.kilroy@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211109142153.56546-3-german.gomez@arm.comSigned-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      09e9afac
    • Andrew Kilroy's avatar
      perf cs-etm: Print size using consistent format · d54e50b7
      Andrew Kilroy authored
      Since the size is already printed earlier in hex, print the same data
      using the same format, in hex.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Signed-off-by: default avatarAndrew Kilroy <andrew.kilroy@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211109142153.56546-2-german.gomez@arm.comSigned-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d54e50b7
    • German Gomez's avatar
      perf arm-spe: Snapshot mode test · 6b1b208b
      German Gomez authored
      Shell script test_arm_spe.sh has been added to test the recording of SPE
      tracing events in snapshot mode.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211109163009.92072-4-german.gomez@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6b1b208b
    • German Gomez's avatar
      perf arm-spe: Implement find_snapshot callback · 56c31cdf
      German Gomez authored
      The head pointer of the AUX buffer managed by the arm_spe_pmu.c driver
      is not monotonically increasing, therefore the find_snapshot callback is
      needed in order to find the trace data within the AUX buffer and avoid
      wasting space in the perf.data file.
      
      The pointer is assumed to have wrapped if the buffer contains non-zero
      data at the end. If it has wrapped, the entire contents of the AUX
      buffer are stored in the perf.data file. Otherwise only the data up to
      the head pointer is stored.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211109163009.92072-3-german.gomez@arm.comTested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      56c31cdf
    • German Gomez's avatar
      perf arm-spe: Add snapshot mode support · 0901b560
      German Gomez authored
      This patch enables support for snapshot mode of arm_spe events,
      including the implementation of the necessary callbacks (excluding
      find_snapshot, which is to be included in a followup commit).
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarGerman Gomez <german.gomez@arm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20211109163009.92072-2-german.gomez@arm.comTested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0901b560
    • Ian Rogers's avatar
      perf expr: Add source_count for aggregating events · 9aba0ada
      Ian Rogers authored
      Events like uncore_imc/cas_count_read/ on Skylake open multiple events
      and then aggregate in the metric leader. To determine the average value
      per event the number of these events is needed. Add a source_count
      function that returns this value by counting the number of events with
      the given metric leader. For most events the value is 1 but for
      uncore_imc/cas_count_read/ it can yield values like 6.
      
      Add a generic test, but manually tested with a test metric that uses
      the function.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9aba0ada
    • Ian Rogers's avatar
      perf expr: Move ID handling to its own function · 1e7ab829
      Ian Rogers authored
      This will facilitate sharing in a follow-on change.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1e7ab829
    • Ian Rogers's avatar
      perf expr: Add metric literals for topology. · fdf1e29b
      Ian Rogers authored
      Allow the number of cpus, cores, dies and packages to be queried by a
      metric expression.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fdf1e29b
    • Ian Rogers's avatar
      perf expr: Add literal values starting with # · 3613f6c1
      Ian Rogers authored
      It is useful to have literal values for constants relating to
      topologies, SMT, etc. Make the parsing of literals shared code and add a
      lookup function. Move #smt_on to this function.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3613f6c1
    • Ian Rogers's avatar
      perf cputopo: Match thread_siblings to topology ABI name · 0b6b84cc
      Ian Rogers authored
      The topology name for thread_siblings is core_cpus_list, use this for
      consistency and add documentation.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0b6b84cc
    • Ian Rogers's avatar
      perf cputopo: Match die_siblings to topology ABI name · 406018dc
      Ian Rogers authored
      The topology name for die_siblings is die_cpus_list, use this for
      consistency and add documentation.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      406018dc
    • Ian Rogers's avatar
      perf cputopo: Update to use pakage_cpus · 48f07b0b
      Ian Rogers authored
      core_siblings_list is the deprecated topology name for
      package_cpus_list, update the code to try the non-deprecated path first.
      Adjust variable names to match topology name.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      48f07b0b
    • Ian Rogers's avatar
      perf test: Add expr test for events with hyphens · 604ce2f0
      Ian Rogers authored
      An example of such an event is topdown-fe-bound.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul A . Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Wan Jiabing <wanjiabing@vivo.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20211111002109.194172-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      604ce2f0
    • Ian Rogers's avatar
      perf test: Remove skip_if_fail · b47d2fb4
      Ian Rogers authored
      Remove optionality, always run tests in a suite even if one fails. This
      brings perf's test more inline with kunit that lacks this notion.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-23-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b47d2fb4
    • Ian Rogers's avatar
      perf test: Remove is_supported function · 848ddf59
      Ian Rogers authored
      All tests now return TEST_SKIP if not supported. Removing this function
      brings perf's test_suite struct more inline with kunit.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-22-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      848ddf59
    • Ian Rogers's avatar
      perf test: TSC test, remove is_supported use · e74dd9cb
      Ian Rogers authored
      Migrate the is_supported functionality to returning TEST_SKIP.
      Motivation is kunit has no is_supported function.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-21-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e74dd9cb
    • Ian Rogers's avatar
      perf test: BP tests, remove is_supported use · 4935e2cd
      Ian Rogers authored
      Migrate the is_supported functionality to returning TEST_SKIP.
      Motivation is kunit has no is_supported function.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-20-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4935e2cd
    • Ian Rogers's avatar
      perf test: Remove non test case style support. · c76ec1cf
      Ian Rogers authored
      Convert shell tests to also run using test case style.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-19-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c76ec1cf
    • Ian Rogers's avatar
      perf test: Convert time to tsc test to test case. · 1870356f
      Ian Rogers authored
      Migration toward kunit style test cases.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-18-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1870356f
    • Ian Rogers's avatar
      perf test: bp tests use test case · e329f03a
      Ian Rogers authored
      Migration toward kunit style test cases.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarSohaib Mohamed <sohaib.amhmd@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: David Gow <davidgow@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211104064208.3156807-17-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e329f03a