1. 28 Sep, 2023 4 commits
  2. 27 Sep, 2023 11 commits
  3. 21 Sep, 2023 2 commits
  4. 20 Sep, 2023 1 commit
  5. 18 Sep, 2023 7 commits
    • Ian Rogers's avatar
      perf parse-events: Fix tracepoint name memory leak · ede72dca
      Ian Rogers authored
      Fuzzing found that an invalid tracepoint name would create a memory
      leak with an address sanitizer build:
      ```
      $ perf stat -e '*:o/' true
      event syntax error: '*:o/'
                             \___ parser error
      Run 'perf list' for a list of valid events
      
       Usage: perf stat [<options>] [<command>]
      
          -e, --event <event>   event selector. use 'perf list' to list available events
      
      =================================================================
      ==59380==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 4 byte(s) in 2 object(s) allocated from:
          #0 0x7f38ac07077b in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:439
          #1 0x55f2f41be73b in str util/parse-events.l:49
          #2 0x55f2f41d08e8 in parse_events_lex util/parse-events.l:338
          #3 0x55f2f41dc3b1 in parse_events_parse util/parse-events-bison.c:1464
          #4 0x55f2f410b8b3 in parse_events__scanner util/parse-events.c:1822
          #5 0x55f2f410d1b9 in __parse_events util/parse-events.c:2094
          #6 0x55f2f410e57f in parse_events_option util/parse-events.c:2279
          #7 0x55f2f4427b56 in get_value tools/lib/subcmd/parse-options.c:251
          #8 0x55f2f4428d98 in parse_short_opt tools/lib/subcmd/parse-options.c:351
          #9 0x55f2f4429d80 in parse_options_step tools/lib/subcmd/parse-options.c:539
          #10 0x55f2f442acb9 in parse_options_subcommand tools/lib/subcmd/parse-options.c:654
          #11 0x55f2f3ec99fc in cmd_stat tools/perf/builtin-stat.c:2501
          #12 0x55f2f4093289 in run_builtin tools/perf/perf.c:322
          #13 0x55f2f40937f5 in handle_internal_command tools/perf/perf.c:375
          #14 0x55f2f4093bbd in run_argv tools/perf/perf.c:419
          #15 0x55f2f409412b in main tools/perf/perf.c:535
      
      SUMMARY: AddressSanitizer: 4 byte(s) leaked in 2 allocation(s).
      ```
      Fix by adding the missing destructor.
      
      Fixes: 865582c3 ("perf tools: Adds the tracepoint name parsing support")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: He Kuang <hekuang@huawei.com>
      Link: https://lore.kernel.org/r/20230914164028.363220-1-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      ede72dca
    • Ian Rogers's avatar
      perf test: Detect off-cpu support from build options · b4f48f34
      Ian Rogers authored
      Use perf version to detect whether BPF skeletons were enabled in a
      build rather than a failing perf record.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Patrice Duroux <patrice.duroux@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: llvm@lists.linux.dev
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230914211948.814999-6-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      b4f48f34
    • Ian Rogers's avatar
      perf test: Ensure EXTRA_TESTS is covered in build test · c2ac838e
      Ian Rogers authored
      Add to run variable.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Patrice Duroux <patrice.duroux@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: llvm@lists.linux.dev
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230914211948.814999-5-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      c2ac838e
    • Ian Rogers's avatar
      perf test: Update build test for changed BPF skeleton defaults · c67c631d
      Ian Rogers authored
      Fix a target name and set BUILD_BPF_SKEL to 0 rather than 1.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Patrice Duroux <patrice.duroux@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: llvm@lists.linux.dev
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230914211948.814999-4-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      c67c631d
    • Ian Rogers's avatar
      perf build: Default BUILD_BPF_SKEL, warn/disable for missing deps · 9925495d
      Ian Rogers authored
      LIBBPF is dependent on zlib so move the NO_ZLIB and feature check
      early to avoid statically building when zlib is disabled. This avoids
      a linkage failure with perf and static libbpf when zlib isn't
      specified.
      
      Move BUILD_BPF_SKEL logic to one place and if not defined set
      BUILD_BPF_SKEL to 1. Detect dependencies of building with BPF
      skeletons and warn/disable if the dependencies aren't present.
      
      Change Makefile.perf to contain BPF skeleton logic dependent on the
      Makefile.config result and refresh the comment about BUILD_BPF_SKEL.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Patrice Duroux <patrice.duroux@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: llvm@lists.linux.dev
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230914211948.814999-3-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      9925495d
    • Ian Rogers's avatar
      perf version: Add status of bpf skeletons · 727e4314
      Ian Rogers authored
      Add status for BPF skeletons, to see if a build has them enabled:
      ```
      $ perf version --build-options
      perf version 6.6.rc1.g0381ae36d1a6
                       dwarf: [ OFF ]  # HAVE_DWARF_SUPPORT
          dwarf_getlocations: [ OFF ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
               syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                      libbfd: [ OFF ]  # HAVE_LIBBFD_SUPPORT
                  debuginfod: [ OFF ]  # HAVE_DEBUGINFOD_SUPPORT
                      libelf: [ OFF ]  # HAVE_LIBELF_SUPPORT
                     libnuma: [ OFF ]  # HAVE_LIBNUMA_SUPPORT
      numa_num_possible_cpus: [ OFF ]  # HAVE_LIBNUMA_SUPPORT
                     libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
                   libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
                    libslang: [ on  ]  # HAVE_SLANG_SUPPORT
                   libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
                   libunwind: [ OFF ]  # HAVE_LIBUNWIND_SUPPORT
          libdw-dwarf-unwind: [ OFF ]  # HAVE_DWARF_SUPPORT
                        zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                        lzma: [ on  ]  # HAVE_LZMA_SUPPORT
                   get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                         bpf: [ OFF ]  # HAVE_LIBBPF_SUPPORT
                         aio: [ on  ]  # HAVE_AIO_SUPPORT
                        zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
                     libpfm4: [ on  ]  # HAVE_LIBPFM
               libtraceevent: [ on  ]  # HAVE_LIBTRACEEVENT
               bpf_skeletons: [ OFF ]  # HAVE_BPF_SKEL
      ```
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Patrice Duroux <patrice.duroux@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: llvm@lists.linux.dev
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230914211948.814999-2-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      727e4314
    • Yang Li's avatar
      perf kwork top: Simplify bool conversion · 3ecf87b2
      Yang Li authored
      ./tools/perf/util/bpf_kwork_top.c:120:53-58: WARNING: conversion to bool not needed here
      Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230915063832.120274-1-yang.lee@linux.alibaba.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      3ecf87b2
  6. 17 Sep, 2023 1 commit
    • Yang Jihong's avatar
      perf test: Fix test-record-dummy-C0 failure for supported PERF_FORMAT_LOST feature kernel · a132b784
      Yang Jihong authored
      For kernel that supports PERF_FORMAT_LOST, attr->read_format has
      PERF_FORMAT_LOST bit. Update expected value of
      attr->read_format of test-record-dummy-C0 for this scenario.
      
      Before:
      
        # ./perf test 17 -vv
         17: Setup struct perf_event_attr                                    :
        --- start ---
        test child forked, pid 1609441
        <SNIP>
        running './tests/attr/test-record-dummy-C0'
          'PERF_TEST_ATTR=/tmp/tmpm3s60aji ./perf record -o /tmp/tmpm3s60aji/perf.data --no-bpf-event -e dummy -C 0 kill >/dev/null 2>&1' ret '1', expected '1'
        expected read_format=4, got 20
        FAILED './tests/attr/test-record-dummy-C0' - match failure
        test child finished with -1
        ---- end ----
        Setup struct perf_event_attr: FAILED!
      
      After:
      
        # ./perf test 17 -vv
         17: Setup struct perf_event_attr                                    :
        --- start ---
        test child forked, pid 1609441
        <SNIP>
        running './tests/attr/test-record-dummy-C0'
          'PERF_TEST_ATTR=/tmp/tmppa9vxcb7 ./perf record -o /tmp/tmppa9vxcb7/perf.data --no-bpf-event -e dummy -C 0 kill >/dev/null 2>&1' ret '1', expected '1'
        <SNIP>
        test child finished with 0
        ---- end ----
        Setup struct perf_event_attr: Ok
      Reported-and-Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230916091641.776031-1-yangjihong1@huawei.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      a132b784
  7. 15 Sep, 2023 6 commits
  8. 12 Sep, 2023 8 commits