1. 05 Jun, 2023 7 commits
  2. 01 Jun, 2023 7 commits
    • Namhyung Kim's avatar
      perf script: Increase PID/TID width for output · fe8e0434
      Namhyung Kim authored
      On large systems, it's common that PID/TID is bigger than 5-digit and it
      makes the output unaligned.  Let's increase the width to 7.
      
      Before:
      
        $ perf script
        ...
                 swapper     0 [006] 1540823.803935:    1369324 cycles:P:  ffffffff9c755588 ktime_get+0x18 ([kernel.kallsyms])
             gvfsd-dnssd 95114 [004] 1540823.804164:    1643871 cycles:P:  ffffffff9cfdca5c __get_user_8+0x1c ([kernel.kallsyms])
               perf-exec 1558582 [000] 1540823.804209:    1018714 cycles:P:  ffffffff9c924ab9 __slab_free+0x9 ([kernel.kallsyms])
                   nmcli 1558589 [007] 1540823.804384:    1859212 cycles:P:      7f70537a8ad8 __strchrnul_evex+0x18 (/usr/lib/x86_64-linux-gnu/libc.so.6>
                   sleep 1558582 [000] 1540823.804456:     987425 cycles:P:      7fd35bb27b30 _dl_init+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2>
             dbus-daemon  3043 [003] 1540823.804575:    1564465 cycles:P:  ffffffff9cb2bb70 llist_add_batch+0x0 ([kernel.kallsyms])
                   gdbus 1558592 [001] 1540823.804766:    1315219 cycles:P:  ffffffff9c797b2e audit_filter_syscall+0x9e ([kernel.kallsyms])
          NetworkManager  3452 [005] 1540823.805301:    1558782 cycles:P:      7fa957737748 g_bit_lock+0x58 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.5>
      
      After:
      
        $ perf script
        ...
                 swapper       0 [006] 1540823.803935:    1369324 cycles:P:  ffffffff9c755588 ktime_get+0x18 ([kernel.kallsyms])
             gvfsd-dnssd   95114 [004] 1540823.804164:    1643871 cycles:P:  ffffffff9cfdca5c __get_user_8+0x1c ([kernel.kallsyms])
               perf-exec 1558582 [000] 1540823.804209:    1018714 cycles:P:  ffffffff9c924ab9 __slab_free+0x9 ([kernel.kallsyms])
                   nmcli 1558589 [007] 1540823.804384:    1859212 cycles:P:      7f70537a8ad8 __strchrnul_evex+0x18 (/usr/lib/x86_64-linux-gnu/libc.so.6>
                   sleep 1558582 [000] 1540823.804456:     987425 cycles:P:      7fd35bb27b30 _dl_init+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2>
             dbus-daemon    3043 [003] 1540823.804575:    1564465 cycles:P:  ffffffff9cb2bb70 llist_add_batch+0x0 ([kernel.kallsyms])
                   gdbus 1558592 [001] 1540823.804766:    1315219 cycles:P:  ffffffff9c797b2e audit_filter_syscall+0x9e ([kernel.kallsyms])
          NetworkManager    3452 [005] 1540823.805301:    1558782 cycles:P:      7fa957737748 g_bit_lock+0x58 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.5>
      
      Reviewer notes:
      
      Adrian added:
      
      "Might be worth noting that currently the biggest PID_MAX_LIMIT is 2^22
       so pids don't get bigger than 7 digits presently"
      
      $ echo $((2 ** 22))
      4194304
      $ echo -n $((2 ** 22)) | wc -c
      7
      $
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20230531203236.1602054-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fe8e0434
    • Ian Rogers's avatar
      perf pmu: Warn about invalid config for all PMUs and configs · b9f01032
      Ian Rogers authored
      Don't just check the raw PMU type, the only core PMU on homogeneous x86,
      check raw and all dynamically added PMUs. Extend the
      perf_pmu__warn_invalid_config to check all 4 config values.
      
      Rather than process the format list once per event, store the computed
      masks for each config value.
      
      Don't ignore the mask being zero, which is likely for config2 and
      config3, add config_masks_present so config values can be ignored only
      when no format information is present.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      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@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230601023644.587584-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b9f01032
    • Ian Rogers's avatar
      perf pmu: Only warn about unsupported formats once · 68c25043
      Ian Rogers authored
      Avoid scanning format list for each event parsed.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      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@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230601023644.587584-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      68c25043
    • Ian Rogers's avatar
      perf test: Update parse-events expectations to test for multiple events · 27c9fcfc
      Ian Rogers authored
      With PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events opening on
      multiple PMUs, the test expectations need updating to test for
      multiple events. TODOs are added to document existing hybrid perf
      bugs.
      
      Tested on hybrid alderlake and non-hybrid tigerlake.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.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: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230601082954.754318-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      27c9fcfc
    • Ian Rogers's avatar
      perf parse-events: Wildcard most "numeric" events · 251aa040
      Ian Rogers authored
      Numeric events are either raw events or those with ABI defined numbers
      matched by the lexer. PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events
      should wildcard match on hybrid systems. So "cycles" should match each
      PMU type with an extended type, not just PERF_TYPE_HARDWARE.
      
      Change wildcard matching to add the event even if wildcard PMU
      scanning fails, there will be no extended type but this best matches
      previous behavior.
      
      Only set the extended type when the event type supports it and when
      perf_pmus__supports_extended_type is true. This new function returns
      true if >1 core PMU and avoids potential errors on older kernels.
      
      Modify evsel__compute_group_pmu_name using a helper
      perf_pmu__is_software to determine when grouping should occur. Try to
      use PMUs, and evsel__find_pmu, as being more dependable than
      evsel->pmu_name.
      
      Set a parse events error if a hardware term's PMU lookup fails, to
      provide extra diagnostics.
      
      Fixes: 8bc75f69 ("perf parse-events: Support wildcards on raw events")
      Reported-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.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: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230601082954.754318-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      251aa040
    • Ian Rogers's avatar
      perf evsel: Add verbose 3 print of evsel name when opening · 1f4326bf
      Ian Rogers authored
      It is often useful to know not just the attribute and perf_event_open()
      details when opening an evsel, but also the evsel's name. Add this debug
      output for verbose 3 so that it won't interfere with the current verbose
      2 output.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.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: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230601082954.754318-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1f4326bf
    • Ian Rogers's avatar
      perf pmu: Correct perf_pmu__auto_merge_stats() affecting hybrid · e2342142
      Ian Rogers authored
      Flip the return value correcting a bug.
      
      Fixes: 6b9da260 ("perf pmu: Remove is_pmu_hybrid")
      Reported-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@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: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230601082954.754318-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e2342142
  3. 31 May, 2023 1 commit
    • Arnaldo Carvalho de Melo's avatar
      Merge tag 'perf-tools-fixes-for-v6.4-2-2023-05-30' into perf-tools-next · d17ed982
      Arnaldo Carvalho de Melo authored
      perf tools fixes for v6.4: 2nd batch
      
      - Fix BPF CO-RE naming convention for checking the availability of fields on
        'union perf_mem_data_src' on the running kernel.
      
      - Remove the use of llvm-strip on BPF skel object files, not needed, fixes a
        build breakage when the llvm package, that contains it in most distros, isn't
        installed.
      
      - Fix tools that use both evsel->{bpf_counter_list,bpf_filters}, removing them from a
        union.
      
      - Remove extra "--" from the 'perf ftrace latency' --use-nsec option,
        previously it was working only when using the '-n' alternative.
      
      - Don't stop building when both binutils-devel and a C++ compiler isn't
        available to compile the alternative C++ demangle support code, disable that
        feature instead.
      
      - Sync the linux/in.h and coresight-pmu.h header copies with the kernel sources.
      
      - Fix relative include path to cs-etm.h.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d17ed982
  4. 30 May, 2023 1 commit
  5. 28 May, 2023 18 commits
    • Ian Rogers's avatar
      libsubcmd: Avoid two path statics, removing 8192 bytes from .bss · 20032376
      Ian Rogers authored
      Use a single stack allocated buffer and avoid 8,192 bytes in .bss.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-17-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      20032376
    • Ian Rogers's avatar
      perf test pmu: Avoid 2 static path arrays · f50b8357
      Ian Rogers authored
      Avoid two static paths that contributed 8,192 bytes to .bss are only
      used duing the perf parse pmu test. This change helps FORTIFY
      triggering 2 warnings like:
      
      ```
      tests/pmu.c: In function ‘test__pmu’:
      tests/pmu.c:121:43: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4090 [-Werror=format-truncation=]
        121 |         snprintf(buf, sizeof(buf), "rm -f %s/*\n", dir);
      ```
      
      So make buf a little larger.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-16-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f50b8357
    • Ian Rogers's avatar
      tools api fs: Dynamically allocate cgroupfs mount point cache, removing 4128 bytes from .bss · 7a3fb8b5
      Ian Rogers authored
      Move the cgroupfs_cache_entry 4128 byte array out of .bss.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-15-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7a3fb8b5
    • Ian Rogers's avatar
      perf scripting-engines: Move static to local variable, remove 16384 from .bss · d9c26d45
      Ian Rogers authored
      Avoid 16,384 bytes in .bss by stack allocating two bitmaps.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-14-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d9c26d45
    • Ian Rogers's avatar
      perf path: Make mkpath thread safe, remove 16384 bytes from .bss · 370ce164
      Ian Rogers authored
      Avoid 4 static arrays for paths, pass in a char[] buffer to use. Makes
      mkpath thread safe for the small number of users. Also removes 16,384
      bytes from .bss.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-13-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      370ce164
    • Ian Rogers's avatar
      perf probe: Dynamically allocate params memory · 430952e6
      Ian Rogers authored
      Avoid 14,432 bytes in .bss by dynamically allocating params.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-12-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      430952e6
    • Ian Rogers's avatar
      perf timechart: Make large arrays dynamic · ddc27bb8
      Ian Rogers authored
      Allocate start time and state arrays when command starts rather than
      using 114,688 bytes in .bss.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-11-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ddc27bb8
    • Ian Rogers's avatar
      perf lock: Dynamically allocate lockhash_table · eef4fee5
      Ian Rogers authored
      lockhash_table is 32,768 bytes in .bss, make it a memory allocation so
      that the space is freed for non-lock perf commands.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-10-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      eef4fee5
    • Ian Rogers's avatar
      perf daemon: Dynamically allocate path to perf · 92294b90
      Ian Rogers authored
      Avoid a PATH_MAX array in __daemon (the .data section) by dynamically
      allocating the memory.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-9-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      92294b90
    • Ian Rogers's avatar
      tools lib api fs tracing_path: Remove two unused MAX_PATH paths · 20dcad8f
      Ian Rogers authored
      tracing_mnt was set but never written. tracing_events_path was set and
      read on errors paths, but its value is exactly tracing_path with a
      "/events" appended, so we can derive the value in the error
      paths. There appears to have been a missing "/" when
      tracing_events_path was initialized.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-8-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      20dcad8f
    • Ian Rogers's avatar
      tools api fs: Avoid large static PATH_MAX arrays · 89df62c3
      Ian Rogers authored
      Change struct fs to have a pointer to a dynamically allocated array
      rather than an array. This reduces the size of fs__entries from 24,768
      bytes to 240 bytes. Read paths into a stack allocated array and
      strdup. Fix off-by-1 fscanf %<num>s in fs__read_mounts caught by
      address sanitizer.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-7-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      89df62c3
    • Ian Rogers's avatar
      perf trace beauty: Make MSR arrays const to move it to .data.rel.ro · 1fc88e5a
      Ian Rogers authored
      Allows the movement of 46,072 bytes from .data to .data.rel.ro.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-6-irogers@google.com
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1fc88e5a
    • Ian Rogers's avatar
      perf trace: Make some large static arrays const to move it to .data.rel.ro · 60995604
      Ian Rogers authored
      Allows the movement of 33,128 bytes from .data to .data.rel.ro.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      60995604
    • Ian Rogers's avatar
      perf test x86: intel-pt-test data is immutable so mark it const · 7c1d862e
      Ian Rogers authored
      This allows the movement of 5,808 bytes from .data to .rodata.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7c1d862e
    • Ian Rogers's avatar
      perf test x86: insn-x86 test data is immutable so mark it const · b1d870a8
      Ian Rogers authored
      This allows the movement of some sizeable data arrays (168,624 bytes) to
      .data.relro. Without PIE or the strings it could be moved to .rodata.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b1d870a8
    • Ian Rogers's avatar
      perf header: Make nodes dynamic in write_mem_topology() · 5c6e7c21
      Ian Rogers authored
      Avoid a large static array, dynamically allocate the nodes avoiding a
      hard coded limited as well.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230526183401.2326121-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5c6e7c21
    • Ian Rogers's avatar
      perf evsel: Don't let for_each_group() treat the head of the list as one of its nodes · 797b9ec8
      Ian Rogers authored
      Address/memory sanitizer was reporting issues in evsel__group_pmu_name
      because the for_each_group_evsel loop didn't terminate when the head
      was reached, the head would then be cast and accessed as an evsel
      leading to invalid memory accesses.
      
      Fix for_each_group_member and for_each_group_evsel to terminate at the
      list head. Note, evsel__group_pmu_name no longer iterates the group, but
      the problem is present regardless.
      
      Fixes: 717e263f ("perf report: Show group description when event group is enabled")
      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: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.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.kim@lge.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230526194442.2355872-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      797b9ec8
    • Ian Rogers's avatar
      perf evsel: Don't let evsel__group_pmu_name() traverse unsorted group · a90cc5a9
      Ian Rogers authored
      Previously the evsel__group_pmu_name would iterate the evsel's group,
      however, the list of evsels aren't yet sorted and so the loop may
      terminate prematurely. It is also not desirable to iterate the list of
      evsels during list_sort as the list may be broken.
      
      Precompute the group_pmu_name for the evsel before sorting, as part of
      the computation and only if necessary, iterate the whole list looking
      for group members so that being sorted isn't necessary.
      
      Move the group pmu name computation to parse-events.c given the closer
      dependency on the behavior of
      parse_events__sort_events_and_fix_groups.
      
      Fixes: 7abf0bcc ("perf evsel: Add function to compute group PMU name")
      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: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Ian Rogers <irogers@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: Peter Zijlstra <peterz@infradead.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230526194442.2355872-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a90cc5a9
  6. 27 May, 2023 6 commits
    • Ian Rogers's avatar
      perf pmu: Remove is_pmu_hybrid · 6b9da260
      Ian Rogers authored
      Users have been removed or switched to using pmu->is_core with
      perf_pmus__num_core_pmus() > 1.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.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: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-35-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6b9da260
    • Ian Rogers's avatar
      perf pmus: Remove perf_pmus__has_hybrid · 94f9eb95
      Ian Rogers authored
      perf_pmus__has_hybrid was used to detect when there was >1 core PMU,
      this can be achieved with perf_pmus__num_core_pmus that doesn't depend
      upon is_pmu_hybrid and PMU name comparisons. When modifying the
      function calls take the opportunity to improve comments,
      enable/simplify tests that were previously failing for hybrid but now
      pass and to simplify generic code.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.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: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-34-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      94f9eb95
    • Ian Rogers's avatar
      perf pmus: Add function to return count of core PMUs · 002c4845
      Ian Rogers authored
      Add perf_pmus__num_core_pmus that will count core PMUs holding the
      result in a static. Reuse for perf_pmus__num_mem_pmus.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.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: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-33-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      002c4845
    • Ian Rogers's avatar
      perf pmus: Ensure all PMUs are read for find_by_type · 1dd5f78d
      Ian Rogers authored
      perf_pmus__find_by_type may be called for something like a raw event,
      in which case the PMU isn't guaranteed to have been looked up. Add a
      second check to make sure all PMUs are loaded.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.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: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-32-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1dd5f78d
    • Ian Rogers's avatar
      perf pmus: Avoid repeated sysfs scanning · 8e7d8a2e
      Ian Rogers authored
      perf_pmus__scan will process every directory in sysfs to see if it is
      a PMU, attempting to add it if not already in the pmus list. Add two
      booleans to record whether this scanning has been done for core or all
      PMUs. Skip scanning in the event that scanning has already occurred.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.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: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-31-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8e7d8a2e
    • Ian Rogers's avatar
      perf pmus: Allow just core PMU scanning · 9d6a1df9
      Ian Rogers authored
      Scanning all PMUs is expensive as all PMUs sysfs entries are loaded,
      benchmarking shows more than 4x the cost:
      
      ```
      $ perf bench internals pmu-scan -i 1000
      Computing performance of sysfs PMU event scan for 1000 times
        Average core PMU scanning took: 989.231 usec (+- 1.535 usec)
        Average PMU scanning took: 4309.425 usec (+- 74.322 usec)
      ```
      
      Add new perf_pmus__scan_core routine that scans just core
      PMUs. Replace perf_pmus__scan calls with perf_pmus__scan_core when
      non-core PMUs are being ignored.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.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: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-30-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9d6a1df9