1. 27 Oct, 2022 24 commits
  2. 26 Oct, 2022 4 commits
  3. 25 Oct, 2022 12 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · 74455fd7
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        257449c6 ("x86/cpufeatures: Add LbrExtV2 feature bit")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Link: https://lore.kernel.org/lkml/Y1g6vGPqPhOrXoaN@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      74455fd7
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync linux/stat.h with the kernel sources · 49c75d30
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        825cf206 ("statx: add direct I/O alignment information")
      
      That add a constant that was manually added to tools/perf/trace/beauty/statx.c,
      at some point this should move to the shell based automated way.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/stat.h' differs from latest version at 'include/uapi/linux/stat.h'
        diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
      
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/Y1gGQL5LonnuzeYd@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49c75d30
    • Arnaldo Carvalho de Melo's avatar
      tools include UAPI: Sync sound/asound.h copy with the kernel sources · 82c50d89
      Arnaldo Carvalho de Melo authored
      Picking the changes from:
      
        69ab6f5b ("ALSA: Remove some left-over license text in include/uapi/sound/")
      
      Which entails no changes in the tooling side as it doesn't introduce new
      SNDRV_PCM_IOCTL_ ioctls.
      
      To silence this perf tools 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
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      82c50d89
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update linux/in.h copy · 036b8f5b
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        65b32f80 ("uapi: move IPPROTO_L2TP to in.h")
        5854a09b ("net/ipv4: Use __DECLARE_FLEX_ARRAY() helper")
      
      That ends up automatically adding the new IPPROTO_L2TP to the socket
      args beautifiers:
      
        $ tools/perf/trace/beauty/socket.sh > before
        $ cp include/uapi/linux/in.h tools/include/uapi/linux/in.h
        $ tools/perf/trace/beauty/socket.sh > after
        $ diff -u before after
        --- before	2022-10-25 12:17:02.577892416 -0300
        +++ after	2022-10-25 12:17:10.806113033 -0300
        @@ -20,6 +20,7 @@
         	[98] = "ENCAP",
         	[103] = "PIM",
         	[108] = "COMP",
        +	[115] = "L2TP",
         	[132] = "SCTP",
         	[136] = "UDPLITE",
         	[137] = "MPLS",
        $
      
      Now 'perf trace' will decode that 115 into "L2TP" and it will also be
      possible to use it in tracepoint filter expressions.
      
      Addresses this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
        diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Wojciech Drewek <wojciech.drewek@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Link: https://lore.kernel.org/lkml/Y1f%2FGe6vjQrGjYiK@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      036b8f5b
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update the copy of x86's memcpy_64.S used in 'perf bench' · 4402e360
      Arnaldo Carvalho de Melo authored
      We also need to add SYM_TYPED_FUNC_START() to util/include/linux/linkage.h
      and update tools/perf/check_headers.sh to ignore the include cfi_types.h
      line when checking if the kernel original files drifted from the copies
      we carry.
      
      This is to get the changes from:
      
        ccace936 ("x86: Add types to indirectly called assembly functions")
      
      Addressing these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Link: https://lore.kernel.org/lkml/Y1f3VRIec9EBgX6F@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4402e360
    • Arnaldo Carvalho de Melo's avatar
      tools headers arm64: Sync arm64's cputype.h with the kernel sources · ffc1df3d
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        0e5d5ae8 ("arm64: Add AMPERE1 to the Spectre-BHB affected list")
      
      That addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/asm/cputype.h' differs from latest version at 'arch/arm64/include/asm/cputype.h'
        diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: D Scott Phillips <scott@os.amperecomputing.com>
      https://lore.kernel.org/lkml/Y1fy5GD7ZYvkeufv@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ffc1df3d
    • Namhyung Kim's avatar
      perf test: Do not fail Intel-PT misc test w/o libpython · 246122a8
      Namhyung Kim authored
      The virtual LBR test uses a python script to check the max size of
      branch stack in the Intel-PT generated LBR.  But it didn't check whether
      python scripting is available (as it's optional).
      
      Let's skip the test if the python support is not available.
      
      Fixes: f77811a0 ("perf test: test_intel_pt.sh: Add 9 tests")
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Ammy Yi <ammy.yi@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221021181055.60183-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      246122a8
    • Thomas Richter's avatar
      perf list: Fix PMU name pai_crypto in perf list on s390 · 5a6c184a
      Thomas Richter authored
      Commit e0b23af8 ("perf list: Add PMU pai_crypto event
      description for IBM z16") introduced the "Processor Activity
      Instrumentation" for cryptographic counters for z16. The PMU device
      driver exports the counters via sysfs files listed in directory
      /sys/devices/pai_crypto.
      
      To specify an event from that PMU, use 'perf stat -e pai_crypto/XXX/'.
      
      However the JSON file mentioned in above commit exports the counter
      decriptions in file pmu-events/arch/s390/cf_z16/pai.json.  Rename this
      file to pmu-events/arch/s390/cf_z16/pai_crypto.json to make the naming
      consistent.
      
      Now 'perf list' shows the counter names under pai_crypto section:
      
        pai_crypto:
      
          CRYPTO_ALL
               [CRYPTO ALL. Unit: pai_crypto]
          ...
      
      Output before was
      
        pai:
          CRYPTO_ALL
               [CRYPTO ALL. Unit: pai_crypto]
          ...
      
      Fixes: e0b23af8 ("perf list: Add PMU pai_crypto event description for IBM z16")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221021082557.2695382-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5a6c184a
    • Ian Rogers's avatar
      perf record: Fix event fd races · 304f0a2f
      Ian Rogers authored
      The write call may set errno which is problematic if occurring in a
      function also setting errno. Save and restore errno around the write
      call.
      
      done_fd may be used after close, clear it as part of the close and check
      its validity in the signal handler.
      
      Suggested-by: <gthelen@google.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Anand K Mistry <amistry@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20221024011024.462518-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      304f0a2f
    • Arnaldo Carvalho de Melo's avatar
      perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available · f1bdebbb
      Arnaldo Carvalho de Melo authored
      During the transition to libbpf 1.0 some functions that perf used were
      deprecated and finally removed from libbpf, so bpf_program__set_insns()
      was introduced for perf to continue to use its bpf loader.
      
      But when build with LIBBPF_DYNAMIC=1 we now need to check if that
      function is available so that perf can build with older libbpf versions,
      even if the end result is emitting a warning to the user that the use
      of the perf BPF loader requires a newer libbpf, since bpf_program__set_insns()
      touches libbpf objects internal state.
      
      This affects only 'perf trace' when using bpf C code or pre-compiled
      bytecode as an event.
      
      Noticed on RHEL9, that has libbpf 0.7.0, where bpf_program__set_insns()
      isn't available.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1bdebbb
    • Arnaldo Carvalho de Melo's avatar
      perf bpf: Fix build with libbpf 0.7.0 by adding prototype for bpf_load_program() · 409fb6bd
      Arnaldo Carvalho de Melo authored
      The bpf_load_program() prototype appeared in tools/lib/bpf/bpf.h as
      deprecated, but nowadays its completely removed, so add it back for
      building with the system libbpf when using 'make LIBBPF_DYNAMIC=1'.
      
      This is a stop gap hack till we do like tools/bpf does with bpftool,
      i.e. bootstrap the libbpf build and install it in the perf build
      directory when not using 'make LIBBPF_DYNAMIC=1'.
      
      That has to be done to all libraries in tools/lib/, so tha we can
      remove -Itools/lib/ from the tools/perf CFLAGS.
      
      Noticed when building with LIBBPF_DYNAMIC=1 and libbpf 0.7.0 on RHEL9.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      409fb6bd
    • Kajol Jain's avatar
      perf vendor events power10: Fix hv-24x7 metric events · b92dd117
      Kajol Jain authored
      Testcase stat_all_metrics.sh fails in powerpc:
      
        90: perf all metrics test : FAILED!
      
      The testcase "stat_all_metrics.sh" verifies perf stat result for all the
      metric events present in perf list.  It runs perf metric events with
      various commands and expects non-empty metric result.
      
      Incase of powerpc:hv-24x7 events, some of the event count can be 0 based
      on system configuration. And if that event used as denominator in divide
      equation, it can cause divide by 0 error. The current nest_metric.json
      file creating divide by 0 issue for some of the metric events, which
      results in failure of the "stat_all_metrics.sh" test case.
      
      Most of the metrics events have cycles or an event which expect to have
      a larger value as denominator, so adding 1 to the denominator of the
      metric expression as a fix.
      
      Result in powerpc box after this patch changes:
      
        90: perf all metrics test : Ok
      
      Fixes: a3cbcadf ("perf vendor events power10: Adds 24x7 nest metric events for power10 platform")
      Signed-off-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221014140220.122251-1-kjain@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b92dd117