1. 28 Jul, 2023 6 commits
  2. 26 Jul, 2023 5 commits
  3. 24 Jul, 2023 4 commits
    • Ian Rogers's avatar
      perf build: Add LTO build option · c126ac4a
      Ian Rogers authored
      Add an LTO build option, that sets the appropriate CFLAGS and CXXFLAGS
      values.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230724201247.748146-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c126ac4a
    • Ian Rogers's avatar
      perf test: Avoid weak symbol for arch_tests · 5cfb0cc0
      Ian Rogers authored
      GCC LTO will complain that the array length varies for the arch_tests
      weak symbol. Use extern/static and architecture determining #if to
      workaround this problem.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230724201247.748146-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5cfb0cc0
    • Ian Rogers's avatar
      perf parse-events: Avoid use uninitialized warning · 0f97a3a0
      Ian Rogers authored
      With GCC LTO a potential use uninitialized is spotted:
      ```
      In function ‘parse_events_config_bpf’,
          inlined from ‘parse_events_load_bpf’ at util/parse-events.c:874:8:
      util/parse-events.c:792:37: error: ‘error_pos’ may be used uninitialized [-Werror=maybe-uninitialized]
        792 |                                 idx = term->err_term + error_pos;
            |                                     ^
      util/parse-events.c: In function ‘parse_events_load_bpf’:
      util/parse-events.c:765:13: note: ‘error_pos’ was declared here
        765 |         int error_pos;
            |             ^
      ```
      So initialize at declaration.
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230724201247.748146-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0f97a3a0
    • Ian Rogers's avatar
      perf stat: Avoid uninitialized use of perf_stat_config · 91f88a0a
      Ian Rogers authored
      perf_event__read_stat_config will assign values based on number of
      tags and tag values. Initialize the structs to zero before they are
      assigned so that no uninitialized values can be seen.
      
      This potential error was reported by GCC with LTO enabled.
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230724201247.748146-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      91f88a0a
  4. 20 Jul, 2023 12 commits
    • Lu Hongfei's avatar
      perf diff: Replaces some ',' as separator with the more usual ';' · 681f34d5
      Lu Hongfei authored
      When wrapping code, use ';' better than using ',' which is more in line
      with the coding habits of most engineers.
      Signed-off-by: default avatarLu Hongfei <luhongfei@vivo.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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: opensource.kernel@vivo.com
      Link: https://lore.kernel.org/r/20230706094635.1553-1-luhongfei@vivo.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      681f34d5
    • Arnaldo Carvalho de Melo's avatar
      perf bench uprobe trace_printk: Add entry attaching an BPF program that does a trace_printk · 7b47623b
      Arnaldo Carvalho de Melo authored
        [root@five ~]# perf bench uprobe all
        # Running uprobe/baseline benchmark...
        # Executed 1,000 usleep(1000) calls
             Total time: 1,053,963 usecs
      
         1,053.963 usecs/op
      
        # Running uprobe/empty benchmark...
        # Executed 1,000 usleep(1000) calls
             Total time: 1,056,293 usecs +2,330 to baseline
      
         1,056.293 usecs/op 2.330 usecs/op to baseline
      
        # Running uprobe/trace_printk benchmark...
        # Executed 1,000 usleep(1000) calls
             Total time: 1,056,977 usecs +3,014 to baseline +684 to previous
      
         1,056.977 usecs/op 3.014 usecs/op to baseline 0.684 usecs/op to previous
      
        [root@five ~]#
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andre Fredette <anfredet@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Dave Tucker <datucker@redhat.com>
      Cc: Derek Barbosa <debarbos@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719204910.539044-6-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7b47623b
    • Arnaldo Carvalho de Melo's avatar
      perf bench uprobe empty: Add entry attaching an empty BPF program · 6af5e4cf
      Arnaldo Carvalho de Melo authored
      Using libbpf and a BPF skel:
      
        # perf bench uprobe all
        # Running uprobe/baseline benchmark...
        # Executed 1,000 usleep(1000) calls
             Total time: 1,055,618 usecs
      
         1,055.618 usecs/op
        # Running uprobe/empty benchmark...
        # Executed 1,000 usleep(1000) calls
             Total time: 1,057,146 usecs +1,528 to baseline
      
         1,057.146 usecs/op
        #
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andre Fredette <anfredet@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Dave Tucker <datucker@redhat.com>
      Cc: Derek Barbosa <debarbos@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719204910.539044-5-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6af5e4cf
    • Arnaldo Carvalho de Melo's avatar
      perf bench uprobe: Show diff to previous · 54d81102
      Arnaldo Carvalho de Melo authored
      Will be useful to show the incremental overhead as we do more stuff in
      the BPF program attached to the uprobes.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andre Fredette <anfredet@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Dave Tucker <datucker@redhat.com>
      Cc: Derek Barbosa <debarbos@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719204910.539044-4-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54d81102
    • Arnaldo Carvalho de Melo's avatar
      perf bench uprobe: Print diff to baseline · dded6f61
      Arnaldo Carvalho de Melo authored
      This is just prep work to show the diff to the unmodified workload.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andre Fredette <anfredet@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Dave Tucker <datucker@redhat.com>
      Cc: Derek Barbosa <debarbos@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719204910.539044-3-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dded6f61
    • Arnaldo Carvalho de Melo's avatar
      perf bench uprobe: Add benchmark to test uprobe overhead · 2df27071
      Arnaldo Carvalho de Melo authored
      This just adds the initial "workload", a call to libc's usleep(1000us)
      function:
      
        $ perf stat --null perf bench uprobe all
        # Running uprobe/baseline benchmark...
        # Executed 1000 usleep(1000) calls
             Total time: 1053533 usecs
      
         1053.533 usecs/op
      
         Performance counter stats for 'perf bench uprobe all':
      
               1.061042896 seconds time elapsed
      
               0.001079000 seconds user
               0.006499000 seconds sys
      
        $
      
      More entries will be added using a BPF skel to add various uprobes to
      the usleep() function.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andre Fredette <anfredet@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Dave Tucker <datucker@redhat.com>
      Cc: Derek Barbosa <debarbos@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719204910.539044-2-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2df27071
    • Arnaldo Carvalho de Melo's avatar
      MAINTAINERS: Add git information for perf-tools and perf-tools-next trees/branches · faa4e0da
      Arnaldo Carvalho de Melo authored
      Now the perf tools development is done on these trees/branches:
      
        git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git perf-tools
        git git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next
      
      For a while I'll continue mirroring what is these to the same branches
      in my git tree.
      Suggested-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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>
      Link: https://lore.kernel.org/lkml/CAP-5=fVGOP6-k=BTRd_bn=N0HVy+1ShpdW5rk5ND0ZGhm_fQkg@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      faa4e0da
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Free thread_trace->files table · fcca1faf
      Arnaldo Carvalho de Melo authored
      The fd->pathname table that is kept in 'struct thread_trace' and thus in
      thread->priv must be freed when a thread is deleted.
      
      This was also detected using -fsanitize=address.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719202951.534582-6-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fcca1faf
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Really free the evsel->priv area · 7962ef13
      Arnaldo Carvalho de Melo authored
      In 3cb4d5e0 ("perf trace: Free syscall tp fields in
      evsel->priv") it only was freeing if strcmp(evsel->tp_format->system,
      "syscalls") returned zero, while the corresponding initialization of
      evsel->priv was being performed if it was _not_ zero, i.e. if the tp
      system wasn't 'syscalls'.
      
      Just stop looking for that and free it if evsel->priv was set, which
      should be equivalent.
      
      Also use the pre-existing evsel_trace__delete() function.
      
      This resolves these leaks, detected with:
      
        $ make EXTRA_CFLAGS="-fsanitize=address" BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools-next -C tools/perf install-bin
      
        =================================================================
        ==481565==ERROR: LeakSanitizer: detected memory leaks
      
        Direct leak of 40 byte(s) in 1 object(s) allocated from:
            #0 0x7f7343cba097 in calloc (/lib64/libasan.so.8+0xba097)
            #1 0x987966 in zalloc (/home/acme/bin/perf+0x987966)
            #2 0x52f9b9 in evsel_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:307
            #3 0x52f9b9 in evsel__syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:333
            #4 0x52f9b9 in evsel__init_raw_syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:458
            #5 0x52f9b9 in perf_evsel__raw_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:480
            #6 0x540e8b in trace__add_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3212
            #7 0x540e8b in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3891
            #8 0x540e8b in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5156
            #9 0x5ef262 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
            #10 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
            #11 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
            #12 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
            #13 0x7f7342c4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
      
        Direct leak of 40 byte(s) in 1 object(s) allocated from:
            #0 0x7f7343cba097 in calloc (/lib64/libasan.so.8+0xba097)
            #1 0x987966 in zalloc (/home/acme/bin/perf+0x987966)
            #2 0x52f9b9 in evsel_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:307
            #3 0x52f9b9 in evsel__syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:333
            #4 0x52f9b9 in evsel__init_raw_syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:458
            #5 0x52f9b9 in perf_evsel__raw_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:480
            #6 0x540dd1 in trace__add_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3205
            #7 0x540dd1 in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3891
            #8 0x540dd1 in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5156
            #9 0x5ef262 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
            #10 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
            #11 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
            #12 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
            #13 0x7f7342c4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
      
        SUMMARY: AddressSanitizer: 80 byte(s) leaked in 2 allocation(s).
        [root@quaco ~]#
      
      With this we plug all leaks with "perf trace sleep 1".
      
      Fixes: 3cb4d5e0 ("perf trace: Free syscall tp fields in evsel->priv")
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Link: https://lore.kernel.org/lkml/20230719202951.534582-5-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7962ef13
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Register a thread priv destructor · 9de251cb
      Arnaldo Carvalho de Melo authored
      To plug these leaks detected with:
      
        $ make EXTRA_CFLAGS="-fsanitize=address" BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools-next -C tools/perf install-bin
      
        =================================================================
        ==473890==ERROR: LeakSanitizer: detected memory leaks
      
        Direct leak of 112 byte(s) in 1 object(s) allocated from:
          #0 0x7fdf19aba097 in calloc (/lib64/libasan.so.8+0xba097)
          #1 0x987836 in zalloc (/home/acme/bin/perf+0x987836)
          #2 0x5367ae in thread_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:1289
          #3 0x5367ae in thread__trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:1307
          #4 0x5367ae in trace__sys_exit /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:2468
          #5 0x52bf34 in trace__handle_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3177
          #6 0x52bf34 in __trace__deliver_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3685
          #7 0x542927 in trace__deliver_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3712
          #8 0x542927 in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:4055
          #9 0x542927 in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5141
          #10 0x5ef1a2 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
          #11 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
          #12 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
          #13 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
          #14 0x7fdf18a4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
      
        Direct leak of 2048 byte(s) in 1 object(s) allocated from:
          #0 0x7f788fcba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af)
          #1 0x5337c0 in trace__sys_enter /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:2342
          #2 0x52bfb4 in trace__handle_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3191
          #3 0x52bfb4 in __trace__deliver_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3699
          #4 0x542883 in trace__deliver_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3726
          #5 0x542883 in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:4069
          #6 0x542883 in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5155
          #7 0x5ef232 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
          #8 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
          #9 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
          #10 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
          #11 0x7f788ec4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
      
        Indirect leak of 48 byte(s) in 1 object(s) allocated from:
          #0 0x7fdf19aba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af)
          #1 0x77b335 in intlist__new util/intlist.c:116
          #2 0x5367fd in thread_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:1293
          #3 0x5367fd in thread__trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:1307
          #4 0x5367fd in trace__sys_exit /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:2468
          #5 0x52bf34 in trace__handle_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3177
          #6 0x52bf34 in __trace__deliver_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3685
          #7 0x542927 in trace__deliver_event /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3712
          #8 0x542927 in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:4055
          #9 0x542927 in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5141
          #10 0x5ef1a2 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
          #11 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
          #12 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
          #13 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
          #14 0x7fdf18a4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719202951.534582-4-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9de251cb
    • Arnaldo Carvalho de Melo's avatar
      perf thread: Allow tools to register a thread->priv destructor · 04cb4fc4
      Arnaldo Carvalho de Melo authored
      So that when thread__delete() runs it can be called and free stuff tools
      stashed into thread->priv, like 'perf trace' does and will use this
      new facility to plug some leaks.
      
      Added an assert(thread__priv_destructor == NULL) as suggested in Ian's
      review.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/CAP-5=fV3Er=Ek8=iE=bSGbEBmM56_PJffMWot1g_5Bh8B5hO7A@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      04cb4fc4
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Free evsel->filter on the destructor · 3f6a74bd
      Arnaldo Carvalho de Melo authored
      Noticed with:
      
        make EXTRA_CFLAGS="-fsanitize=address" BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools-next -C tools/perf install-bin
      
      Direct leak of 45 byte(s) in 1 object(s) allocated from:
          #0 0x7f213f87243b in strdup (/lib64/libasan.so.8+0x7243b)
          #1 0x63d15f in evsel__set_filter util/evsel.c:1371
          #2 0x63d15f in evsel__append_filter util/evsel.c:1387
          #3 0x63d15f in evsel__append_tp_filter util/evsel.c:1400
          #4 0x62cd52 in evlist__append_tp_filter util/evlist.c:1145
          #5 0x62cd52 in evlist__append_tp_filter_pids util/evlist.c:1196
          #6 0x541e49 in trace__set_filter_loop_pids /home/acme/git/perf-tools/tools/perf/builtin-trace.c:3646
          #7 0x541e49 in trace__set_filter_pids /home/acme/git/perf-tools/tools/perf/builtin-trace.c:3670
          #8 0x541e49 in trace__run /home/acme/git/perf-tools/tools/perf/builtin-trace.c:3970
          #9 0x541e49 in cmd_trace /home/acme/git/perf-tools/tools/perf/builtin-trace.c:5141
          #10 0x5ef1a2 in run_builtin /home/acme/git/perf-tools/tools/perf/perf.c:323
          #11 0x4196da in handle_internal_command /home/acme/git/perf-tools/tools/perf/perf.c:377
          #12 0x4196da in run_argv /home/acme/git/perf-tools/tools/perf/perf.c:421
          #13 0x4196da in main /home/acme/git/perf-tools/tools/perf/perf.c:537
          #14 0x7f213e84a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
      
      Free it on evsel__exit().
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20230719202951.534582-2-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3f6a74bd
  5. 18 Jul, 2023 4 commits
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v6.5-1-2023-07-18' of... · ccff6d11
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v6.5-1-2023-07-18' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Don't group events when computing metrics that require more than the
         maximum number of simultaneously enabled events on AMD systems.
      
       - Fix multi CU handling in 'perf probe', add a 'perf test' entry to
         regress test it.
      
       - Make the 'perf test task_exit' stop generating samples by using the
         'dummy' event, all it is testing is if a PERF_RECORD_EXIT is
         generated at the end of a perf session. This makes this perf test to
         stop sometimes failing on some systems due to a full ring buffer.
      
       - Avoid SEGV if PMU lookup fails for legacy cache terms.
      
       - Fix libsubcmd SEGV/use-after-free when commands aren't excluded.
      
       - Fix OpenCSD (ARM64's CoreSight hardware tracing) library path
         resolution when specifying CSLIBS= in the make command line.
      
       - Fix broken feature check for libtracefs due to external lib changes,
         use the provided pkgconfig file instead future proof it.
      
       - Sync drm, fcntl, kvm, mount, prctl, socket, vhost, asound, arm64's
         cputype headers with the kernel sources, in some cases this made the
         tools become aware of new kernel APIs such as ioctls and the
         cachestat sysctl.
      
      * tag 'perf-tools-fixes-for-v6.5-1-2023-07-18' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
        perf test task_exit: No need for a cycles event to check if we get an PERF_RECORD_EXIT
        tools headers arm64: Sync arm64's cputype.h with the kernel sources
        tools include UAPI: Sync the sound/asound.h copy with the kernel sources
        tools include UAPI: Sync linux/vhost.h with the kernel sources
        perf beauty: Update copy of linux/socket.h with the kernel sources
        perf parse-events: Avoid SEGV if PMU lookup fails for legacy cache terms
        libsubcmd: Avoid SEGV/use-after-free when commands aren't excluded
        tools headers UAPI: Sync linux/prctl.h with the kernel sources
        perf build: Fix broken feature check for libtracefs due to external lib changes
        tools include UAPI: Sync linux/mount.h copy with the kernel sources
        tools headers UAPI: Sync linux/kvm.h with the kernel sources
        tools headers uapi: Sync linux/fcntl.h with the kernel sources
        perf vendor events amd: Fix large metrics
        perf build: Fix library not found error when using CSLIBS
        tools headers UAPI: Sync files changed by new cachestat syscall with the kernel sources
        tools headers UAPI: Sync drm/i915_drm.h with the kernel sources
        perf probe: Read DWARF files from the correct CU
        perf probe: Add test for regression introduced by switch to die_get_decl_file()
      ccff6d11
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-07-18-12-28' of... · 4806364a
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-07-18-12-28' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull hotfixes from Andrew Morton:
       "Seven hotfixes, six of which are cc:stable and one of which addresses
        a post-6.5 issue"
      
      * tag 'mm-hotfixes-stable-2023-07-18-12-28' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        maple_tree: fix node allocation testing on 32 bit
        maple_tree: fix 32 bit mas_next testing
        selftests/mm: mkdirty: fix incorrect position of #endif
        maple_tree: set the node limit when creating a new root node
        mm/mlock: fix vma iterator conversion of apply_vma_lock_flags()
        prctl: move PR_GET_AUXV out of PR_MCE_KILL
        selftests/mm: give scripts execute permission
      4806364a
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-6.5-rc3' of... · 74f1456c
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fixes from Shuah Khan:
       "Fixes to bugs that are interfering with arm64 and risc workflows. Also
        two fixes to timer and mincore tests that are causing test failures"
      
      * tag 'linux-kselftest-fixes-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/arm64: fix build failure during the "emit_tests" step
        selftests/riscv: fix potential build failure during the "emit_tests" step
        tools: timers: fix freq average calculation
        selftests/mincore: fix skip condition for check_huge_pages test
      74f1456c
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd · f2f393c3
      Linus Torvalds authored
      Pull tpm fixes from Jarkko Sakkinen.
      
      Mostly interrupt storm fixes, with some other minor changes.
      
      * tag 'tpmdd-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
        tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs
        tpm/tpm_tis: Disable interrupts for Lenovo L590 devices
        tpm: Do not remap from ACPI resources again for Pluton TPM
        tpm/tpm_tis: Disable interrupts for Framework Laptop Intel 13th gen
        tpm/tpm_tis: Disable interrupts for Framework Laptop Intel 12th gen
        security: keys: Modify mismatched function name
        tpm: return false from tpm_amd_is_rng_defective on non-x86 platforms
        keys: Fix linking a duplicate key to a keyring's assoc_array
        tpm: tis_i2c: Limit write bursts to I2C_SMBUS_BLOCK_MAX (32) bytes
        tpm: tis_i2c: Limit read bursts to I2C_SMBUS_BLOCK_MAX (32) bytes
        tpm_tis_spi: Release chip select when flow control fails
        tpm: tpm_tis: Disable interrupts *only* for AEON UPX-i11
        tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation
      f2f393c3
  6. 17 Jul, 2023 9 commits