1. 17 Apr, 2023 3 commits
    • Arnaldo Carvalho de Melo's avatar
      perf cpumap: Remove initializations done in perf_cpu_map__alloc() · d57fd492
      Arnaldo Carvalho de Melo authored
      When extracting this patch from Ian's original patch I forgot to remove
      the setting of ->nr and ->refcnt, no need to do those initializations
      again as those are done in perf_cpu_map__alloc() already, duh.
      
      Cc: Ian Rogers <irogers@google.com>
      Fixes: 1f94479e ("libperf: Make perf_cpu_map__alloc() available as an internal function for tools/perf to use")
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d57fd492
    • Ian Rogers's avatar
      libperf: Add reference count checking macros · a9b867f6
      Ian Rogers authored
      The macros serve as a way to debug use of a reference counted struct.
      
      The macros add a memory allocated pointer that is interposed between
      the reference counted original struct at a get and freed by a put.
      
      The pointer replaces the original struct, so use of the struct name
      via APIs remains unchanged.
      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: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: http://lore.kernel.org/lkml/20230407230405.2931830-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a9b867f6
    • Arnaldo Carvalho de Melo's avatar
      libperf: Add perf_cpu_map__refcnt() interanl accessor to use in the maps test · 4121234a
      Arnaldo Carvalho de Melo authored
      To remove one more direct access to 'struct perf_cpu_map' so that we can
      intercept accesses to its instantiations and refcount check it to catch
      use after free, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Link: https://lore.kernel.org/lkml/ZD1qdYjG+DL6KOfP@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4121234a
  2. 15 Apr, 2023 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf test: Simplify for_each_test() to avoid tripping on -Werror=array-bounds · 17354d15
      Arnaldo Carvalho de Melo authored
      When cross building on debian to the mips 32-bit arch we get these
      warnings:
      
        In function '__cmd_test',
            inlined from 'cmd_test' at tests/builtin-test.c:561:9:
        tests/builtin-test.c:260:66: error: array subscript 1 is outside array bounds of 'struct test_suite *[1]' [-Werror=array-bounds]
          260 |                 for (k = 0, t = tests[j][k]; tests[j][k]; k++, t = tests[j][k])
              |                                                                  ^
        tests/builtin-test.c:369:9: note: in expansion of macro 'for_each_test'
          369 |         for_each_test(j, k, t) {
              |         ^~~~~~~~~~~~~
        tests/builtin-test.c: In function 'cmd_test':
        tests/builtin-test.c:36:27: note: at offset 4 into object 'arch_tests' of size 4
           36 | struct test_suite *__weak arch_tests[] = {
              |                           ^~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Switch to using a while(!sentinel) for the second level of the 'tests'
      array to avoid that compiler complaint.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      17354d15
  3. 13 Apr, 2023 22 commits
  4. 12 Apr, 2023 14 commits