1. 12 Jun, 2023 7 commits
    • Ian Rogers's avatar
      perf thread: Make threads rbtree non-invasive · 7ee227f6
      Ian Rogers authored
      Separate the rbtree out of thread and into a new struct
      thread_rb_node. The refcnt is in thread and the rbtree is responsible
      for a single count.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Brian Robbins <brianrob@linux.microsoft.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Babrou <ivan@cloudflare.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: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Ye Xingchen <ye.xingchen@zte.com.cn>
      Cc: Yuan Can <yuancan@huawei.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230608232823.4027869-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7ee227f6
    • Ian Rogers's avatar
      perf thread: Remove notion of dead threads · 40826c45
      Ian Rogers authored
      The dead thread list is best effort. Threads live on it until the
      reference count hits zero and they are removed. With correct reference
      counting this should never happen. It is, however, part of the 'perf
      sched' output that is now removed. If this is an issue we should
      implement tracking of dead threads in a robust not best-effort way.
      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: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Brian Robbins <brianrob@linux.microsoft.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Babrou <ivan@cloudflare.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: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Ye Xingchen <ye.xingchen@zte.com.cn>
      Cc: Yuan Can <yuancan@huawei.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230608232823.4027869-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      40826c45
    • Ian Rogers's avatar
      perf test: Add test of libpfm4 events · dcf7a177
      Ian Rogers authored
        $ ./perf test -v 102
        102: perf all libpfm4 events test                                    :
        --- start ---
        test child forked, pid 3030994
        Testing ix86arch::UNHALTED_CORE_CYCLES
        Testing ix86arch::INSTRUCTION_RETIRED
        Testing ix86arch::UNHALTED_REFERENCE_CYCLES
        Testing ix86arch::LLC_REFERENCES
        Testing ix86arch::LLC_MISSES
        Testing ix86arch::BRANCH_INSTRUCTIONS_RETIRED
        Testing ix86arch::MISPREDICTED_BRANCH_RETIRED
        Testing perf_raw::r0000
        Testing icl::UNHALTED_CORE_CYCLES
        Testing icl::UNHALTED_REFERENCE_CYCLES
        ...
        test child finished with 0
        ---- end ----
        perf all libpfm4 events test: Ok
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20230608232400.3056312-4-namhyung@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dcf7a177
    • Ian Rogers's avatar
      perf list: Check arguments to show libpfm4 events · cc3d139b
      Ian Rogers authored
      This is particularly useful for tests.
      
        $ perf list pfm
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20230608232400.3056312-3-namhyung@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cc3d139b
    • Namhyung Kim's avatar
      perf list: Check if libpfm4 event is supported · d1f1cecc
      Namhyung Kim authored
      Some of its event info cannot be used directly due to missing default
      attributes.  Let's check if the event is supported before printing like
      we do for hw and cache events.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers&gt;@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20230608232400.3056312-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d1f1cecc
    • Adrian Hunter's avatar
      perf parse: Allow config terms with breakpoints · f0617f52
      Adrian Hunter authored
      Add config terms to the parsing of breakpoint events. Extend "Test event
      parsing" to also cover using a confg term.
      
      This makes breakpoint events consistent with other events which already
      support config terms.
      
      Example:
      
        $ cat dr_test.c
        #include <unistd.h>
        #include <stdio.h>
      
        void func0(void)
        {
        }
      
        int main()
        {
                printf("func0 %p\n", &func0);
                while (1) {
                        func0();
                        usleep(100000);
                }
                return 0;
        }
        $ gcc -g -O0 -o dr_test dr_test.c
        $ ./dr_test &
        [2] 19646
        func0 0x55feb98dd169
        $ perf record -e mem:0x55feb98dd169:x/name=breakpoint/ -p 19646 -- sleep 0.5
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.017 MB perf.data (5 samples) ]
        $ perf script
            dr_test 19646  5632.956628:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
            dr_test 19646  5633.056866:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
            dr_test 19646  5633.157084:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
            dr_test 19646  5633.257309:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
            dr_test 19646  5633.357532:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
        $ sudo perf test "Test event parsing"
          6: Parse event definition strings                                  :
          6.1: Test event parsing                                            : Ok
        $ sudo perf test -v "Test event parsing" |& grep mem
        running test 8 'mem:0'
        running test 9 'mem:0:x'
        running test 10 'mem:0:r'
        running test 11 'mem:0:w'
        running test 19 'mem:0:u'
        running test 20 'mem:0:x:k'
        running test 21 'mem:0:r:hp'
        running test 22 'mem:0:w:up'
        running test 26 'mem:0:rw'
        running test 27 'mem:0:rw:kp'
        running test 42 'mem:0/1'
        running test 43 'mem:0/2:w'
        running test 44 'mem:0/4:rw:u'
        running test 58 'mem:0/name=breakpoint/'
        running test 59 'mem:0:x/name=breakpoint/'
        running test 60 'mem:0:r/name=breakpoint/'
        running test 61 'mem:0:w/name=breakpoint/'
        running test 62 'mem:0/name=breakpoint/u'
        running test 63 'mem:0:x/name=breakpoint/k'
        running test 64 'mem:0:r/name=breakpoint/hp'
        running test 65 'mem:0:w/name=breakpoint/up'
        running test 66 'mem:0:rw/name=breakpoint/'
        running test 67 'mem:0:rw/name=breakpoint/kp'
        running test 68 'mem:0/1/name=breakpoint/'
        running test 69 'mem:0/2:w/name=breakpoint/'
        running test 70 'mem:0/4:rw/name=breakpoint/u'
        running test 71 'mem:0/1/name=breakpoint1/,mem:0/4:rw/name=breakpoint2/'
      
      Committer notes:
      
      Folded follow up patch (see 2nd link below) to address warnings about
      unused tokens:
      
      perf tools: Suppress bison unused value warnings
      
      Patch "perf tools: Allow config terms with breakpoints" introduced parse
      tokens for colons and slashes within breakpoint parsing to prevent mix
      up with colons and slashes related to config terms.
      
      The token values are not needed but introduce bison "unused value"
      warnings.
      
      Suppress those warnings.
      
      Committer testing:
      
        # cat ~acme/c/mem_breakpoint.c
        #include <stdio.h>
        #include <unistd.h>
      
        void func1(void) { }
        void func2(void) { }
        void func3(void) { }
        void func4(void) { }
        void func5(void) { }
      
        int main()
        {
        	printf("func1 %p\n", &func1);
        	printf("func2 %p\n", &func2);
        	printf("func3 %p\n", &func3);
        	printf("func4 %p\n", &func4);
        	printf("func5 %p\n", &func5);
        	while (1) {
        		func1(); func2(); func3(); func4(); func5();
        		usleep(100000);
        	}
        	return 0;
        }
      
        # ~acme/c/mem_breakpoint &
        [1] 3186153
        func1 0x401136
        func2 0x40113d
        func3 0x401144
        func4 0x40114b
        func5 0x401152
        #
      
      Trying to watch the first 4 functions for eXecutable access:
      
        # perf record -e mem:0x401136:x/name=breakpoint1/,mem:0x40113d:x/name=breakpoint2/,mem:0x401144:x/name=breakpoint3/,mem:0x40114b:x/name=breakpoint4/  -p 3186153 -- sleep 0.5
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.026 MB perf.data (20 samples) ]
        [root@five ~]# perf script
          mem_breakpoint 3186153 131612.864793:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.864795:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.864796:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.864797:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.964868:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.964870:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.964871:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131612.964872:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.064945:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.064948:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.064948:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.064949:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.165024:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.165026:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.165027:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.165028:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.265103:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.265105:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.265106:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
          mem_breakpoint 3186153 131613.265107:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
        #
      
      Then all the 5 functions:
      
        # perf record -e mem:0x401136:x/name=breakpoint1/,mem:0x40113d:x/name=breakpoint2/,mem:0x401144:x/name=breakpoint3/,mem:0x40114b:x/name=breakpoint4/,mem:0x401152:x/name=breakpoint5/ -p 3186153 -- sleep 0.5
        Error:
        The sys_perf_event_open() syscall returned with 28 (No space left on device) for event (breakpoint5).
        /bin/dmesg | grep -i perf may provide additional information.
      
        # grep -m1 'model name' /proc/cpuinfo
        model name	: AMD Ryzen 9 5950X 16-Core Processor
        #
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20230525082902.25332-2-adrian.hunter@intel.com
      Link: https://lore.kernel.org/r/f7228dc9-fe18-a8e3-7d3f-52922e0e1113@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f0617f52
    • Arnaldo Carvalho de Melo's avatar
      perf script: Fix allocation of evsel->priv related to per-event dump files · 36d3e413
      Arnaldo Carvalho de Melo authored
      When printing output we may want to generate per event files, where the
      --per-event-dump option should be used, creating perf.data.EVENT.dump
      files instead of printing to stdout.
      
      The callback thar processes event thus expects that evsel->priv->fp
      should point to either the per-event FILE descriptor or to stdout.
      
      The a3af66f5 ("perf script: Fix crash because of missing
      evsel->priv") changeset fixed a case where evsel->priv wasn't setup,
      thus set to NULL, causing a segfault when trying to access
      evsel->priv->fp.
      
      But it did it for the non --per-event-dump case by allocating a 'struct
      perf_evsel_script' just to set its ->fp to stdout.
      
      Since evsel->priv is only freed when --per-event-dump is used, we ended
      up with a memory leak, detected using ASAN.
      
      Fix it by using the same method as perf_script__setup_per_event_dump(),
      and reuse that static 'struct perf_evsel_script'.
      
      Also check if evsel_script__new() failed.
      
      Fixes: a3af66f5 ("perf script: Fix crash because of missing evsel->priv")
      Reported-by: default avatarIan Rogers <irogers@google.com>
      Tested-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: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Link: https://lore.kernel.org/lkml/ZH+F0wGAWV14zvMP@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      36d3e413
  2. 09 Jun, 2023 3 commits
  3. 05 Jun, 2023 8 commits
  4. 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
  5. 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
  6. 30 May, 2023 1 commit
  7. 28 May, 2023 13 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