1. 03 Apr, 2024 2 commits
  2. 21 Mar, 2024 38 commits
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move uapi/linux/vhost.h copy out of the directory used to build perf · 4962e194
      Arnaldo Carvalho de Melo authored
      It is only used to generate string tables, not to build perf, so move it
      to the tools/perf/trace/beauty/include/ hierarchy, that is used just for
      scraping.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      
      No other tools/ living code uses it, just <linux/vhost.h> coming from
      either 'make install_headers' or from the system /usr/include/
      directory.
      Suggested-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4962e194
    • Ian Rogers's avatar
      perf dso: Reorder members to save space in 'struct dso' · b3ad832d
      Ian Rogers authored
      Save 40 bytes and move from 8 to 7 cache lines. Make member dwfl
      dependent on being a powerpc build. Squeeze bits of int/enum types
      when appropriate. Remove holes/padding by reordering variables.
      
      Before:
      
        struct dso {
                struct mutex               lock;                 /*     0    40 */
                struct list_head           node;                 /*    40    16 */
                struct rb_node             rb_node __attribute__((__aligned__(8))); /*    56    24 */
                /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
                struct rb_root *           root;                 /*    80     8 */
                struct rb_root_cached      symbols;              /*    88    16 */
                struct symbol * *          symbol_names;         /*   104     8 */
                size_t                     symbol_names_len;     /*   112     8 */
                struct rb_root_cached      inlined_nodes;        /*   120    16 */
                /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
                struct rb_root_cached      srclines;             /*   136    16 */
                struct {
                        u64                addr;                 /*   152     8 */
                        struct symbol *    symbol;               /*   160     8 */
                } last_find_result;                              /*   152    16 */
                void *                     a2l;                  /*   168     8 */
                char *                     symsrc_filename;      /*   176     8 */
                unsigned int               a2l_fails;            /*   184     4 */
                enum dso_space_type        kernel;               /*   188     4 */
                /* --- cacheline 3 boundary (192 bytes) --- */
                _Bool                      is_kmod;              /*   192     1 */
      
                /* XXX 3 bytes hole, try to pack */
      
                enum dso_swap_type         needs_swap;           /*   196     4 */
                enum dso_binary_type       symtab_type;          /*   200     4 */
                enum dso_binary_type       binary_type;          /*   204     4 */
                enum dso_load_errno        load_errno;           /*   208     4 */
                u8                         adjust_symbols:1;     /*   212: 0  1 */
                u8                         has_build_id:1;       /*   212: 1  1 */
                u8                         header_build_id:1;    /*   212: 2  1 */
                u8                         has_srcline:1;        /*   212: 3  1 */
                u8                         hit:1;                /*   212: 4  1 */
                u8                         annotate_warned:1;    /*   212: 5  1 */
                u8                         auxtrace_warned:1;    /*   212: 6  1 */
                u8                         short_name_allocated:1; /*   212: 7  1 */
                u8                         long_name_allocated:1; /*   213: 0  1 */
                u8                         is_64_bit:1;          /*   213: 1  1 */
      
                /* XXX 6 bits hole, try to pack */
      
                _Bool                      sorted_by_name;       /*   214     1 */
                _Bool                      loaded;               /*   215     1 */
                u8                         rel;                  /*   216     1 */
      
                /* XXX 7 bytes hole, try to pack */
      
                struct build_id            bid;                  /*   224    32 */
                /* --- cacheline 4 boundary (256 bytes) --- */
                u64                        text_offset;          /*   256     8 */
                u64                        text_end;             /*   264     8 */
                const char  *              short_name;           /*   272     8 */
                const char  *              long_name;            /*   280     8 */
                u16                        long_name_len;        /*   288     2 */
                u16                        short_name_len;       /*   290     2 */
      
                /* XXX 4 bytes hole, try to pack */
      
                void *                     dwfl;                 /*   296     8 */
                struct auxtrace_cache *    auxtrace_cache;       /*   304     8 */
                int                        comp;                 /*   312     4 */
      
                /* XXX 4 bytes hole, try to pack */
      
                /* --- cacheline 5 boundary (320 bytes) --- */
                struct {
                        struct rb_root     cache;                /*   320     8 */
                        int                fd;                   /*   328     4 */
                        int                status;               /*   332     4 */
                        u32                status_seen;          /*   336     4 */
      
                        /* XXX 4 bytes hole, try to pack */
      
                        u64                file_size;            /*   344     8 */
                        struct list_head   open_entry;           /*   352    16 */
                        u64                elf_base_addr;        /*   368     8 */
                        u64                debug_frame_offset;   /*   376     8 */
                        /* --- cacheline 6 boundary (384 bytes) --- */
                        u64                eh_frame_hdr_addr;    /*   384     8 */
                        u64                eh_frame_hdr_offset;  /*   392     8 */
                } data;                                          /*   320    80 */
                struct {
                        u32                id;                   /*   400     4 */
                        u32                sub_id;               /*   404     4 */
                        struct perf_env *  env;                  /*   408     8 */
                } bpf_prog;                                      /*   400    16 */
                union {
                        void *             priv;                 /*   416     8 */
                        u64                db_id;                /*   416     8 */
                };                                               /*   416     8 */
                struct nsinfo *            nsinfo;               /*   424     8 */
                struct dso_id              id;                   /*   432    24 */
                /* --- cacheline 7 boundary (448 bytes) was 8 bytes ago --- */
                refcount_t                 refcnt;               /*   456     4 */
                char                       name[];               /*   460     0 */
      
                /* size: 464, cachelines: 8, members: 49 */
                /* sum members: 440, holes: 4, sum holes: 18 */
                /* sum bitfield members: 10 bits, bit holes: 1, sum bit holes: 6 bits */
                /* padding: 4 */
                /* forced alignments: 1 */
                /* last cacheline: 16 bytes */
        } __attribute__((__aligned__(8)));
      
      After:
      
        struct dso {
                struct mutex               lock;                 /*     0    40 */
                struct list_head           node;                 /*    40    16 */
                struct rb_node             rb_node __attribute__((__aligned__(8))); /*    56    24 */
                /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
                struct rb_root *           root;                 /*    80     8 */
                struct rb_root_cached      symbols;              /*    88    16 */
                struct symbol * *          symbol_names;         /*   104     8 */
                size_t                     symbol_names_len;     /*   112     8 */
                struct rb_root_cached      inlined_nodes;        /*   120    16 */
                /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
                struct rb_root_cached      srclines;             /*   136    16 */
                struct {
                        u64                addr;                 /*   152     8 */
                        struct symbol *    symbol;               /*   160     8 */
                } last_find_result;                              /*   152    16 */
                struct build_id            bid;                  /*   168    32 */
                /* --- cacheline 3 boundary (192 bytes) was 8 bytes ago --- */
                u64                        text_offset;          /*   200     8 */
                u64                        text_end;             /*   208     8 */
                const char  *              short_name;           /*   216     8 */
                const char  *              long_name;            /*   224     8 */
                void *                     a2l;                  /*   232     8 */
                char *                     symsrc_filename;      /*   240     8 */
                struct nsinfo *            nsinfo;               /*   248     8 */
                /* --- cacheline 4 boundary (256 bytes) --- */
                struct auxtrace_cache *    auxtrace_cache;       /*   256     8 */
                union {
                        void *             priv;                 /*   264     8 */
                        u64                db_id;                /*   264     8 */
                };                                               /*   264     8 */
                struct {
                        struct perf_env *  env;                  /*   272     8 */
                        u32                id;                   /*   280     4 */
                        u32                sub_id;               /*   284     4 */
                } bpf_prog;                                      /*   272    16 */
                struct {
                        struct rb_root     cache;                /*   288     8 */
                        struct list_head   open_entry;           /*   296    16 */
                        u64                file_size;            /*   312     8 */
                        /* --- cacheline 5 boundary (320 bytes) --- */
                        u64                elf_base_addr;        /*   320     8 */
                        u64                debug_frame_offset;   /*   328     8 */
                        u64                eh_frame_hdr_addr;    /*   336     8 */
                        u64                eh_frame_hdr_offset;  /*   344     8 */
                        int                fd;                   /*   352     4 */
                        int                status;               /*   356     4 */
                        u32                status_seen;          /*   360     4 */
                } data;                                          /*   288    80 */
      
                /* XXX last struct has 4 bytes of padding */
      
                struct dso_id              id;                   /*   368    24 */
                /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
                unsigned int               a2l_fails;            /*   392     4 */
                int                        comp;                 /*   396     4 */
                refcount_t                 refcnt;               /*   400     4 */
                enum dso_load_errno        load_errno;           /*   404     4 */
                u16                        long_name_len;        /*   408     2 */
                u16                        short_name_len;       /*   410     2 */
                enum dso_binary_type       symtab_type:8;        /*   412: 0  4 */
                enum dso_binary_type       binary_type:8;        /*   412: 8  4 */
                enum dso_space_type        kernel:2;             /*   412:16  4 */
                enum dso_swap_type         needs_swap:2;         /*   412:18  4 */
      
                /* Bitfield combined with next fields */
      
                _Bool                      is_kmod:1;            /*   414: 4  1 */
                u8                         adjust_symbols:1;     /*   414: 5  1 */
                u8                         has_build_id:1;       /*   414: 6  1 */
                u8                         header_build_id:1;    /*   414: 7  1 */
                u8                         has_srcline:1;        /*   415: 0  1 */
                u8                         hit:1;                /*   415: 1  1 */
                u8                         annotate_warned:1;    /*   415: 2  1 */
                u8                         auxtrace_warned:1;    /*   415: 3  1 */
                u8                         short_name_allocated:1; /*   415: 4  1 */
                u8                         long_name_allocated:1; /*   415: 5  1 */
                u8                         is_64_bit:1;          /*   415: 6  1 */
      
                /* XXX 1 bit hole, try to pack */
      
                _Bool                      sorted_by_name;       /*   416     1 */
                _Bool                      loaded;               /*   417     1 */
                u8                         rel;                  /*   418     1 */
                char                       name[];               /*   419     0 */
      
                /* size: 424, cachelines: 7, members: 48 */
                /* sum members: 415 */
                /* sum bitfield members: 31 bits, bit holes: 1, sum bit holes: 1 bits */
                /* padding: 5 */
                /* paddings: 1, sum paddings: 4 */
                /* forced alignments: 1 */
                /* last cacheline: 40 bytes */
        } __attribute__((__aligned__(8)));
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ben Gainey <ben.gainey@arm.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Chengen Du <chengen.du@canonical.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.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@linux.dev>
      Cc: Li Dong <lidong@vivo.com>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Markus Elfring <Markus.Elfring@web.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Sun Haiyong <sunhaiyong@loongson.cn>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
      Link: https://lore.kernel.org/r/20240321160300.1635121-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3ad832d
    • Anne Macedo's avatar
      perf lock contention: Trim backtrace by skipping traceiter functions · 2a5049b7
      Anne Macedo authored
      The 'perf lock contention' program currently shows the caller of the locks
      as __traceiter_contention_begin+0x??. This caller can be ignored, as it is
      from the traceiter itself. Instead, it should show the real callers for
      the locks.
      
      When fiddling with the --stack-skip parameter, the actual callers for
      the locks start to show up. However, just ignore the
      __traceiter_contention_begin and the __traceiter_contention_end symbols
      so the actual callers will show up.
      
      Before this patch is applied:
      
      sudo perf lock con -a -b -- sleep 3
       contended   total wait     max wait     avg wait         type   caller
      
               8      2.33 s       2.28 s     291.18 ms     rwlock:W   __traceiter_contention_begin+0x44
               4      2.33 s       2.28 s     582.35 ms     rwlock:W   __traceiter_contention_begin+0x44
               7    140.30 ms     46.77 ms     20.04 ms     rwlock:W   __traceiter_contention_begin+0x44
               2     63.35 ms     33.76 ms     31.68 ms        mutex   trace_contention_begin+0x84
               2     46.74 ms     46.73 ms     23.37 ms     rwlock:W   __traceiter_contention_begin+0x44
               1     13.54 us     13.54 us     13.54 us        mutex   trace_contention_begin+0x84
               1      3.67 us      3.67 us      3.67 us      rwsem:R   __traceiter_contention_begin+0x44
      
      Before this patch is applied - using --stack-skip 5
      
      sudo perf lock con --stack-skip 5 -a -b -- sleep 3
       contended   total wait     max wait     avg wait         type   caller
      
               2      2.24 s       2.24 s       1.12 s      rwlock:W   do_epoll_wait+0x5a0
               4      1.65 s     824.21 ms    412.08 ms     rwlock:W   do_exit+0x338
               2    824.35 ms    824.29 ms    412.17 ms     spinlock   get_signal+0x108
               2    824.14 ms    824.14 ms    412.07 ms     rwlock:W   release_task+0x68
               1     25.22 ms     25.22 ms     25.22 ms        mutex   cgroup_kn_lock_live+0x58
               1     24.71 us     24.71 us     24.71 us     spinlock   do_exit+0x44
               1     22.04 us     22.04 us     22.04 us      rwsem:R   lock_mm_and_find_vma+0xb0
      
      After this patch is applied:
      
      sudo ./perf lock con -a -b -- sleep 3
       contended   total wait     max wait     avg wait         type   caller
      
               4      4.13 s       2.07 s       1.03 s      rwlock:W   release_task+0x68
               2      2.07 s       2.07 s       1.03 s      rwlock:R   mm_update_next_owner+0x50
               2      2.07 s       2.07 s       1.03 s      rwlock:W   do_exit+0x338
               1     41.56 ms     41.56 ms     41.56 ms        mutex   cgroup_kn_lock_live+0x58
               2     36.12 us     18.83 us     18.06 us     rwlock:W   do_exit+0x338
      Signed-off-by: default avatarAnne Macedo <retpolanne@posteo.net>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.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: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240319143629.3422590-1-retpolanne@posteo.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2a5049b7
    • Ian Rogers's avatar
      perf vendor events intel: Remove info metrics erroneously in TopdownL1 · af34a16d
      Ian Rogers authored
      Bug affected server metrics only. This doesn't impact default metrics
      but if the TopdownL1 metric group is specified. Passes on the fix in:
      
        https://github.com/intel/perfmon/commit/b09f0a3953234ec592b4a872b87764c78da05d8bReviewed-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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-13-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      af34a16d
    • Ian Rogers's avatar
      perf vendor events intel: Update snowridgex to 1.22 · 7bce27f8
      Ian Rogers authored
      Update events from 1.21 to 1.22 as released in:
      
        https://github.com/intel/perfmon/commit/ba4f96039f96231b51e3eb69d5a21e2b00f6de5b
      
      Updates various descriptions and removes the event
      UNC_IIO_NUM_REQ_FROM_CPU.IRP.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-12-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7bce27f8
    • Ian Rogers's avatar
      perf vendor events intel: Update skylake to v58 · 70e7028c
      Ian Rogers authored
      Update events from:
      
        https://github.com/intel/perfmon/commit/f2e5136e062a91ae554dc40530132e66f9271848
      
      This change didn't increase the version number from v58.
      
      Updates various descriptions.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-11-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70e7028c
    • Ian Rogers's avatar
      perf vendor events intel: Update skylakex to 1.33 · d70cc755
      Ian Rogers authored
      Update events from 1.32 to 1.33 as released in:
      
        https://github.com/intel/perfmon/commit/3fe7390dd18496c35ec3a9cf17de0473fd5485cb
      
      Various description updates. Adds the event
      OFFCORE_RESPONSE.ALL_READS.L3_HIT.HIT_OTHER_CORE_FWD.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-10-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d70cc755
    • Ian Rogers's avatar
      perf vendor events intel: Update sierraforest to 1.02 · bf270b15
      Ian Rogers authored
      Update events from 1.01 to 1.02 as released in:
      
        https://github.com/intel/perfmon/commit/451dd41ae627b56433ad4065bf3632789eb70834
      
      Various description updates. Adds topdown events
      TOPDOWN_BAD_SPECULATION.ALL_P, TOPDOWN_BE_BOUND.ALL_P,
      TOPDOWN_FE_BOUND.ALL_P and TOPDOWN_RETIRING.ALL_P.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bf270b15
    • Ian Rogers's avatar
      perf vendor events intel: Update sapphirerapids to 1.20 · 2edee9e6
      Ian Rogers authored
      Update events from 1.17 to 1.20 as released in:
      
        https://github.com/intel/perfmon/commit/6f674057745acf0125395638ca6be36458a59bda
      
      Various description updates. Adds uncore events
      UNC_CHA_TOR_INSERTS.IO_ITOMCACHENEAR_LOCAL,
      UNC_CHA_TOR_INSERTS.IO_ITOMCACHENEAR_REMOTE,
      UNC_CHA_TOR_INSERTS.IO_ITOM_LOCAL, UNC_CHA_TOR_INSERTS.IO_ITOM_REMOTE,
      UNC_CHA_TOR_INSERTS.IO_PCIRDCUR_LOCAL,
      UNC_CHA_TOR_INSERTS.IO_PCIRDCUR_REMOTE,
      UNC_CHA_TOR_OCCUPANCY.IO_MISS_ITOMCACHENEAR_LOCAL,
      UNC_CHA_TOR_OCCUPANCY.IO_MISS_ITOMCACHENEAR_REMOTE,
      UNC_CHA_TOR_OCCUPANCY.IO_MISS_ITOM_LOCAL,
      UNC_CHA_TOR_OCCUPANCY.IO_MISS_ITOM_REMOTE,
      UNC_CHA_TOR_OCCUPANCY.IO_MISS_PCIRDCUR_LOCAL,
      UNC_CHA_TOR_OCCUPANCY.IO_MISS_PCIRDCUR_REMOTE and removes core events
      AMX_OPS_RETIRED.BF16 and AMX_OPS_RETIRED.INT8.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2edee9e6
    • Ian Rogers's avatar
      perf vendor events intel: Update meteorlake to 1.08 · 84d0e8c6
      Ian Rogers authored
      Update events from 1.07 to 1.08 as released in:
      
        https://github.com/intel/perfmon/commit/f0f8f3e163d9eb84e6ce8e2108a22cb43b2527e5
      
      Various description updates. Adds topdown, offcore and uncore events
      OCR.DEMAND_DATA_RD.L3_HIT, OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HIT_NO_FWD,
      OCR.DEMAND_RFO.L3_HIT, OCR.DEMAND_DATA_RD.L3_MISS,
      OCR.DEMAND_RFO.L3_MISS, OCR.DEMAND_DATA_RD.ANY_RESPONSE,
      OCR.DEMAND_DATA_RD.DRAM, OCR.DEMAND_RFO.ANY_RESPONSE,
      OCR.DEMAND_RFO.DRAM, TOPDOWN_BAD_SPECULATION.ALL_P,
      TOPDOWN_BE_BOUND.ALL_P, TOPDOWN_FE_BOUND.ALL_P,
      TOPDOWN_RETIRING.ALL_P, UNC_ARB_DAT_OCCUPANCY.RD and
      UNC_HAC_ARB_COH_TRK_REQUESTS.ALL.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84d0e8c6
    • Ian Rogers's avatar
      perf vendor events intel: Update lunarlake to 1.01 · 3670ffbd
      Ian Rogers authored
      Update events from 1.00 to 1.01 as released in:
      
        https://github.com/intel/perfmon/commit/56ab8d837ac566d51a4d8748b6b4b817a22c9b84
      
      Various encoding and description updates. Adds the events
      CPU_CLK_UNHALTED.CORE, CPU_CLK_UNHALTED.CORE_P,
      CPU_CLK_UNHALTED.REF_TSC_P, CPU_CLK_UNHALTED.THREAD,
      MISC_RETIRED.LBR_INSERTS, TOPDOWN_BAD_SPECULATION.ALL_P,
      TOPDOWN_BE_BOUND.ALL_P, TOPDOWN_FE_BOUND.ALL_P,
      TOPDOWN_RETIRING.ALL_P.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3670ffbd
    • Ian Rogers's avatar
      perf vendor events intel: Update icelakex to 1.24 · 5157c204
      Ian Rogers authored
      Update events from 1.23 to 1.24 as released in:
      
        https://github.com/intel/perfmon/commit/d883888ae60882028e387b6fe1ebf683beb693fa
      
      Fixes spelling and descriptions. Adds the uncore events
      UNC_CHA_TOR_INSERTS.IO_PCIRDCUR_LOCAL and
      UNC_CHA_TOR_INSERTS.IO_PCIRDCUR_REMOTE, while removing
      UNC_IIO_NUM_REQ_FROM_CPU.IRP.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5157c204
    • Ian Rogers's avatar
      perf vendor events intel: Update grandridge to 1.02 · a02dc01c
      Ian Rogers authored
      Update events from 1.01 to 1.02 as released in:
      
        https://github.com/intel/perfmon/commit/b2a81e803add1ba0af68a442c975683d226d868c
      
      Fixes spelling and descriptions. Adds topdown events and uncore cache
      UNC_CHA_TOR_OCCUPANCY.IA_HIT_DRD_OPT,
      UNC_CHA_TOR_OCCUPANCY.IA_MISS_DRD_OPT,
      UNC_CHA_TOR_OCCUPANCY.IA_DRD_OPT.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a02dc01c
    • Ian Rogers's avatar
      perf vendor events intel: Update emeraldrapids to 1.06 · 36f353a1
      Ian Rogers authored
      Update events from 1.03 to 1.96 as released in:
      
        https://github.com/intel/perfmon/commit/21a8be3ea7918749141db4036fb65a2343cd865d
      
      Fixes spelling and descriptions. Adds cache miss latency events
      UNC_CHA_TOR_(INSERTS|OCCUPANCY).IO_(PCIRDCUR|ITOM|ITOMCACHENEAR)_(LOCAL|REMOTE).
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      36f353a1
    • Ian Rogers's avatar
      perf vendor events intel: Update cascadelakex to 1.21 · 4376424a
      Ian Rogers authored
      Update events from 1.20 to 1.21 as released in:
      
        https://github.com/intel/perfmon/commit/fcfdba3be8f3be81ad6b509fdebf953ead92dc2c
      
      Largely fixes spelling and descriptions.
      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: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@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: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Link: https://lore.kernel.org/r/20240321060016.1464787-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4376424a
    • Arnaldo Carvalho de Melo's avatar
      perf probe: Add missing libgen.h header needed for using basename() · 58103715
      Arnaldo Carvalho de Melo authored
      This prototype is obtained indirectly, by luck, from some other header
      in probe-event.c in most systems, but recently exploded on alpine:edge:
      
         8    13.39 alpine:edge                   : FAIL gcc version 13.2.1 20240309 (Alpine 13.2.1_git20240309)
          util/probe-event.c: In function 'convert_exec_to_group':
          util/probe-event.c:225:16: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
            225 |         ptr1 = basename(exec_copy);
                |                ^~~~~~~~
          util/probe-event.c:225:14: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
            225 |         ptr1 = basename(exec_copy);
                |              ^
          cc1: all warnings being treated as errors
          make[3]: *** [/git/perf-6.8.0/tools/build/Makefile.build:158: util] Error 2
      
      Fix it by adding the libgen.h header where basename() is prototyped.
      
      Fixes: fb7345bb ("perf probe: Support basic dwarf-based operations on uprobe events")
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      58103715
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Fix 'newfstatat'/'fstatat' argument pretty printing · 0831638e
      Arnaldo Carvalho de Melo authored
      There were needless two entries, one for 'newfstatat' and another for
      'fstatat', keep just one and pretty print its 'flags' argument using the
      fs_at_flags scnprintf that is also used by other FS syscalls such as
      'stat', now:
      
        root@number:~# perf trace -e newfstatat --max-events=5
             0.000 ( 0.010 ms): abrt-dump-jour/1400 newfstatat(dfd: 7, filename: "", statbuf: 0x7fff0d127000, flag: EMPTY_PATH) = 0
             0.020 ( 0.003 ms): abrt-dump-jour/1400 newfstatat(dfd: 9, filename: "", statbuf: 0x55752507b0e8, flag: EMPTY_PATH) = 0
             0.039 ( 0.004 ms): abrt-dump-jour/1400 newfstatat(dfd: 19, filename: "", statbuf: 0x557525061378, flag: EMPTY_PATH) = 0
             0.047 ( 0.003 ms): abrt-dump-jour/1400 newfstatat(dfd: 20, filename: "", statbuf: 0x5575250b8cc8, flag: EMPTY_PATH) = 0
             0.053 ( 0.003 ms): abrt-dump-jour/1400 newfstatat(dfd: 22, filename: "", statbuf: 0x5575250535d8, flag: EMPTY_PATH) = 0
        root@number:~#
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240320193115.811899-6-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0831638e
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Beautify the 'flags' arg of unlinkat · 4d923282
      Arnaldo Carvalho de Melo authored
      Reusing the fs_at_flags array done for the 'stat' syscall.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240320193115.811899-5-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4d923282
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Introduce faccessat2 flags scnprintf routine · b8171a84
      Arnaldo Carvalho de Melo authored
      The fsaccessat and fsaccessat2 now have beautifiers for its arguments.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240320193115.811899-4-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b8171a84
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument · f122b3d6
      Arnaldo Carvalho de Melo authored
      It was using the first variation on producing a string representation
      for a binary flag, one that used the system's stat.h and preprocessor
      tricks that had to be updated everytime a new flag was introduced.
      
      Use the more recent scrape script + strarray +
      strarray__scnprintf_flags() combo.
      
        $ tools/perf/trace/beauty/statx_mask.sh
        static const char *statx_mask[] = {
        	[ilog2(0x00000001) + 1] = "TYPE",
        	[ilog2(0x00000002) + 1] = "MODE",
        	[ilog2(0x00000004) + 1] = "NLINK",
        	[ilog2(0x00000008) + 1] = "UID",
        	[ilog2(0x00000010) + 1] = "GID",
        	[ilog2(0x00000020) + 1] = "ATIME",
        	[ilog2(0x00000040) + 1] = "MTIME",
        	[ilog2(0x00000080) + 1] = "CTIME",
        	[ilog2(0x00000100) + 1] = "INO",
        	[ilog2(0x00000200) + 1] = "SIZE",
        	[ilog2(0x00000400) + 1] = "BLOCKS",
        	[ilog2(0x00000800) + 1] = "BTIME",
        	[ilog2(0x00001000) + 1] = "MNT_ID",
        	[ilog2(0x00002000) + 1] = "DIOALIGN",
        	[ilog2(0x00004000) + 1] = "MNT_ID_UNIQUE",
        };
        $
      
      Now we need a copy of uapi/linux/stat.h from tools/include/ in the
      scrape only directory tools/perf/trace/beauty/include.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240320193115.811899-3-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f122b3d6
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Introduce scrape script for various fs syscalls 'flags' arguments · 3d6cfbaf
      Arnaldo Carvalho de Melo authored
      It was using the first variation on producing a string representation
      for a binary flag, one that used the system's fcntl.h and preprocessor
      tricks that had to be updated everytime a new flag was introduced.
      
      Use the more recent scrape script + strarray + strarray__scnprintf_flags() combo.
      
        $ tools/perf/trace/beauty/fs_at_flags.sh
        static const char *fs_at_flags[] = {
        	[ilog2(0x100) + 1] = "SYMLINK_NOFOLLOW",
        	[ilog2(0x200) + 1] = "REMOVEDIR",
        	[ilog2(0x400) + 1] = "SYMLINK_FOLLOW",
        	[ilog2(0x800) + 1] = "NO_AUTOMOUNT",
        	[ilog2(0x1000) + 1] = "EMPTY_PATH",
        	[ilog2(0x0000) + 1] = "STATX_SYNC_AS_STAT",
        	[ilog2(0x2000) + 1] = "STATX_FORCE_SYNC",
        	[ilog2(0x4000) + 1] = "STATX_DONT_SYNC",
        	[ilog2(0x8000) + 1] = "RECURSIVE",
        	[ilog2(0x80000000) + 1] = "GETATTR_NOSEC",
        };
        $
      
      Now we need a copy of uapi/linux/fcntl.h from tools/include/ in the
      scrape only directory tools/perf/trace/beauty/include and will use that
      fs_at_flags array for other fs syscalls.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240320193115.811899-2-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d6cfbaf
    • Ian Rogers's avatar
      perf tests: Run tests in parallel by default · 4cef0e7a
      Ian Rogers authored
      Switch from running tests sequentially to running in parallel by
      default. Change the opt-in '-p' or '--parallel' flag to '-S' or
      '--sequential'.
      
      On an 8 core tigerlake an address sanitizer run time changes from:
      
        326.54user 622.73system 6:59.91elapsed 226%CPU
      
      to:
      
        973.02user 583.98system 3:01.17elapsed 859%CPU
      
      So over twice as fast, saving 4 minutes.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240301174711.2646944-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4cef0e7a
    • Ian Rogers's avatar
      perf help: Lower levenshtein penality for deleting character · 7aea01ea
      Ian Rogers authored
      The levenshtein penalty for deleting a character was far higher than
      subsituting or inserting a character. Lower the penalty to match that
      of inserting a character.
      
      Before:
      
        $ perf recccord
        perf: 'recccord' is not a perf-command. See 'perf --help'.
        $
      
      After:
      
        $ perf recccord
        perf: 'recccord' is not a perf-command. See 'perf --help'.
      
        Did you mean this?
                record
        $
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240301201306.2680986-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7aea01ea
    • Ian Rogers's avatar
      perf tools: Suggest inbuilt commands for unknown command · f664d515
      Ian Rogers authored
      The existing unknown command code looks for perf scripts like
      perf-archive.sh and perf-iostat.sh, however, inbuilt commands aren't
      suggested. Add the inbuilt commands so they may be suggested too.
      
      Before:
      
        $ perf reccord
        perf: 'reccord' is not a perf-command. See 'perf --help'.
        $
      
      After:
      
        $ perf reccord
        perf: 'reccord' is not a perf-command. See 'perf --help'.
      
        Did you mean this?
                record
        $
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240301201306.2680986-1-irogers@google.com
      [ Added some fixes from Ian to problems I noticed while testing ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f664d515
    • Ian Rogers's avatar
      perf test: Read child test 10 times a second rather than 1 · 5f2f051a
      Ian Rogers authored
      Make the perf test output smoother by timing out the poll of the child
      process after 100ms rather than 1s.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      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: Song Liu <songliubraving@fb.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Yicong Yang <yangyicong@hisilicon.com>
      Link: https://lore.kernel.org/r/20240301074639.2260708-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5f2f051a
    • Ian Rogers's avatar
      perf test: Use a single fd for the child process out/err · e120f709
      Ian Rogers authored
      Switch from dumping err then out, to a single file descriptor for both
      of them. This allows the err and output to be correctly interleaved in
      verbose output.
      
      Fixes: b482f5f8 ("perf tests: Add option to run tests in parallel")
      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: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Disha Goel <disgoel@linux.ibm.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: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Yicong Yang <yangyicong@hisilicon.com>
      Link: https://lore.kernel.org/r/20240301074639.2260708-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e120f709
    • Ian Rogers's avatar
      perf test: Stat output per thread of just the parent process · f68c981b
      Ian Rogers authored
      Per-thread mode requires either system-wide (-a), a pid (-p) or a tid
      (-t).
      
      The stat output tests were using system-wide mode but this is racy when
      threads are starting and exiting - something that happens a lot when
      running the tests in parallel (perf test -p).
      
      Avoid the race conditions by using pid mode with the pid of the parent
      process.
      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: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      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: Song Liu <songliubraving@fb.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Yicong Yang <yangyicong@hisilicon.com>
      Link: https://lore.kernel.org/r/20240301074639.2260708-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f68c981b
    • Ian Rogers's avatar
      perf record: Delete session after stopping sideband thread · 88ce0106
      Ian Rogers authored
      The session has a header in it which contains a perf env with
      bpf_progs. The bpf_progs are accessed by the sideband thread and so
      the sideband thread must be stopped before the session is deleted, to
      avoid a use after free.  This error was detected by AddressSanitizer
      in the following:
      
        ==2054673==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000161e00 at pc 0x55769289de54 bp 0x7f9df36d4ab0 sp 0x7f9df36d4aa8
        READ of size 8 at 0x61d000161e00 thread T1
            #0 0x55769289de53 in __perf_env__insert_bpf_prog_info util/env.c:42
            #1 0x55769289dbb1 in perf_env__insert_bpf_prog_info util/env.c:29
            #2 0x557692bbae29 in perf_env__add_bpf_info util/bpf-event.c:483
            #3 0x557692bbb01a in bpf_event__sb_cb util/bpf-event.c:512
            #4 0x5576928b75f4 in perf_evlist__poll_thread util/sideband_evlist.c:68
            #5 0x7f9df96a63eb in start_thread nptl/pthread_create.c:444
            #6 0x7f9df9726a4b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      
        0x61d000161e00 is located 384 bytes inside of 2136-byte region [0x61d000161c80,0x61d0001624d8)
        freed by thread T0 here:
            #0 0x7f9dfa6d7288 in __interceptor_free libsanitizer/asan/asan_malloc_linux.cpp:52
            #1 0x557692978d50 in perf_session__delete util/session.c:319
            #2 0x557692673959 in __cmd_record tools/perf/builtin-record.c:2884
            #3 0x55769267a9f0 in cmd_record tools/perf/builtin-record.c:4259
            #4 0x55769286710c in run_builtin tools/perf/perf.c:349
            #5 0x557692867678 in handle_internal_command tools/perf/perf.c:402
            #6 0x557692867a40 in run_argv tools/perf/perf.c:446
            #7 0x557692867fae in main tools/perf/perf.c:562
            #8 0x7f9df96456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
      
      Fixes: 657ee553 ("perf evlist: Introduce side band thread")
      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: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Yicong Yang <yangyicong@hisilicon.com>
      Link: https://lore.kernel.org/r/20240301074639.2260708-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      88ce0106
    • Ian Rogers's avatar
      perf tools: Add/use PMU reverse lookup from config to name · 67ee8e71
      Ian Rogers authored
      Add perf_pmu__name_from_config that does a reverse lookup from a
      config number to an alias name. The lookup is expensive as the config
      is computed for every alias by filling in a perf_event_attr, but this
      is only done when verbose output is enabled. The lookup also only
      considers config, and not config1, config2 or config3.
      
      An example of the output:
      
        $ perf stat -vv -e data_read true
        ...
        perf_event_attr:
          type                             24 (uncore_imc_free_running_0)
          size                             136
          config                           0x20ff (data_read)
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
          disabled                         1
          inherit                          1
          exclude_guest                    1
        ...
      
      Committer notes:
      
      Fix the python binding build by adding dummies for not strictly
      needed perf_pmu__name_from_config() and perf_pmus__find_by_type().
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.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: James Clark <james.clark@arm.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: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20240308001915.4060155-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      67ee8e71
    • Ian Rogers's avatar
      perf tools: Use pmus to describe type from attribute · 70938820
      Ian Rogers authored
      When dumping a perf_event_attr, use pmus to find the PMU and its name
      by the type number. This allows dynamically added PMUs to be described.
      
      Before:
      
        $ perf stat -vv -e data_read true
        ...
        perf_event_attr:
          type                             24
          size                             136
          config                           0x20ff
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
          disabled                         1
          inherit                          1
          exclude_guest                    1
        ...
      
      After:
      
        $ perf stat -vv -e data_read true
        ...
        perf_event_attr:
          type                             24 (uncore_imc_free_running_0)
          size                             136
          config                           0x20ff
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
          disabled                         1
          inherit                          1
          exclude_guest                    1
        ...
      
      However, it also means that when we have a PMU name we prefer it to a
      hard coded name:
      
      Before:
      
        $ perf stat -vv -e faults true
        ...
        perf_event_attr:
          type                             1 (PERF_TYPE_SOFTWARE)
          size                             136
          config                           0x2 (PERF_COUNT_SW_PAGE_FAULTS)
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
          disabled                         1
          inherit                          1
          enable_on_exec                   1
          exclude_guest                    1
        ...
      
      After:
      
        $ perf stat -vv -e faults true
        ...
        perf_event_attr:
          type                             1 (software)
          size                             136
          config                           0x2 (PERF_COUNT_SW_PAGE_FAULTS)
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
          disabled                         1
          inherit                          1
          enable_on_exec                   1
          exclude_guest                    1
        ...
      
      It feels more consistent to do this, rather than only prefer a PMU
      name when a hard coded name isn't available.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.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: James Clark <james.clark@arm.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: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20240308001915.4060155-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70938820
    • Ian Rogers's avatar
      perf list: Give more details about raw event encodings · 4ccf3bb7
      Ian Rogers authored
      List all the PMUs, not just the first core one, and list real format
      specifiers with value ranges.
      
      Before:
      
        $ perf list
        ...
          rNNN                                               [Raw hardware event descriptor]
          cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
               [(see 'man perf-list' on how to encode it)]
          mem:<addr>[/len][:access]                          [Hardware breakpoint]
        ...
      
      After:
      
        $ perf list
        ...
          rNNN                                               [Raw event descriptor]
          cpu/event=0..255,pc,edge,.../modifier              [Raw event descriptor]
               [(see 'man perf-list' or 'man perf-record' on how to encode it)]
          breakpoint//modifier                               [Raw event descriptor]
          cstate_core/event=0..0xffffffffffffffff/modifier   [Raw event descriptor]
          cstate_pkg/event=0..0xffffffffffffffff/modifier    [Raw event descriptor]
          i915/i915_eventid=0..0x1fffff/modifier             [Raw event descriptor]
          intel_bts//modifier                                [Raw event descriptor]
          intel_pt/ptw,event,cyc_thresh=0..15,.../modifier   [Raw event descriptor]
          kprobe/retprobe/modifier                           [Raw event descriptor]
          msr/event=0..0xffffffffffffffff/modifier           [Raw event descriptor]
          power/event=0..255/modifier                        [Raw event descriptor]
          software//modifier                                 [Raw event descriptor]
          tracepoint//modifier                               [Raw event descriptor]
          uncore_arb/event=0..255,edge,inv,.../modifier      [Raw event descriptor]
          uncore_cbox/event=0..255,edge,inv,.../modifier     [Raw event descriptor]
          uncore_clock/event=0..255/modifier                 [Raw event descriptor]
          uncore_imc_free_running/event=0..255,umask=0..255/modifier[Raw event descriptor]
          uprobe/ref_ctr_offset=0..0xffffffff,retprobe/modifier[Raw event descriptor]
          mem:<addr>[/len][:access]                          [Hardware breakpoint]
        ...
      
      With '--details' provide more details on the formats encoding:
      
        cpu/event=0..255,pc,edge,.../modifier              [Raw event descriptor]
             [(see 'man perf-list' or 'man perf-record' on how to encode it)]
              cpu/event=0..255,pc,edge,offcore_rsp=0..0xffffffffffffffff,ldlat=0..0xffff,inv,
              umask=0..255,frontend=0..0xffffff,cmask=0..255,config=0..0xffffffffffffffff,
              config1=0..0xffffffffffffffff,config2=0..0xffffffffffffffff,config3=0..0xffffffffffffffff,
              name=string,period=number,freq=number,branch_type=(u|k|hv|any|...),time,
              call-graph=(fp|dwarf|lbr),stack-size=number,max-stack=number,nr=number,inherit,no-inherit,
              overwrite,no-overwrite,percore,aux-output,aux-sample-size=number/modifier
        breakpoint//modifier                               [Raw event descriptor]
              breakpoint//modifier
        cstate_core/event=0..0xffffffffffffffff/modifier   [Raw event descriptor]
              cstate_core/event=0..0xffffffffffffffff/modifier
        cstate_pkg/event=0..0xffffffffffffffff/modifier    [Raw event descriptor]
              cstate_pkg/event=0..0xffffffffffffffff/modifier
        i915/i915_eventid=0..0x1fffff/modifier             [Raw event descriptor]
              i915/i915_eventid=0..0x1fffff/modifier
        intel_bts//modifier                                [Raw event descriptor]
              intel_bts//modifier
        intel_pt/ptw,event,cyc_thresh=0..15,.../modifier   [Raw event descriptor]
              intel_pt/ptw,event,cyc_thresh=0..15,pt,notnt,branch,tsc,pwr_evt,fup_on_ptw,cyc,noretcomp,
              mtc,psb_period=0..15,mtc_period=0..15/modifier
        kprobe/retprobe/modifier                           [Raw event descriptor]
              kprobe/retprobe/modifier
        msr/event=0..0xffffffffffffffff/modifier           [Raw event descriptor]
              msr/event=0..0xffffffffffffffff/modifier
        power/event=0..255/modifier                        [Raw event descriptor]
              power/event=0..255/modifier
        software//modifier                                 [Raw event descriptor]
              software//modifier
        tracepoint//modifier                               [Raw event descriptor]
              tracepoint//modifier
        uncore_arb/event=0..255,edge,inv,.../modifier      [Raw event descriptor]
              uncore_arb/event=0..255,edge,inv,umask=0..255,cmask=0..31/modifier
        uncore_cbox/event=0..255,edge,inv,.../modifier     [Raw event descriptor]
              uncore_cbox/event=0..255,edge,inv,umask=0..255,cmask=0..31/modifier
        uncore_clock/event=0..255/modifier                 [Raw event descriptor]
              uncore_clock/event=0..255/modifier
        uncore_imc_free_running/event=0..255,umask=0..255/modifier[Raw event descriptor]
              uncore_imc_free_running/event=0..255,umask=0..255/modifier
        uprobe/ref_ctr_offset=0..0xffffffff,retprobe/modifier[Raw event descriptor]
              uprobe/ref_ctr_offset=0..0xffffffff,retprobe/modifier
      
      Committer notes:
      
      Address this build error in various distros:
      
        55    58.44 ubuntu:24.04                  : FAIL gcc version 13.2.0 (Ubuntu 13.2.0-17ubuntu2)
          util/pmu.c:1638:70: error: '_Static_assert' with no message is a C2x extension [-Werror,-Wc2x-extensions]
           1638 |         _Static_assert(ARRAY_SIZE(terms) == __PARSE_EVENTS__TERM_TYPE_NR - 6);
                |                                                                             ^
                |                                                                             , ""
          1 error generated.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.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: James Clark <james.clark@arm.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: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20240308001915.4060155-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4ccf3bb7
    • Ian Rogers's avatar
      perf list: Allow wordwrap to wrap on commas · aa1f4ad2
      Ian Rogers authored
      A raw event encoding may be a block with terms separated by commas. If
      wrapping such a string it would be useful to break at the commas, so
      add this ability to wordwrap.
      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: James Clark <james.clark@arm.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: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20240308001915.4060155-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aa1f4ad2
    • Ian Rogers's avatar
      perf pmu: Drop "default_core" from alias names · 39aa4ff6
      Ian Rogers authored
      "default_core" is used by jevents.py for json events' PMU name when
      none is specified. On x86 the "default_core" is typically the PMU
      "cpu". When creating an alias see if the event's PMU name is
      "default_core" in which case don't record it. This means in places
      like "perf list" the PMU's name will be used in its place.
      
      Before:
      
      $ perf list --details
        ...
        cache:
          l1d.replacement
               [Counts the number of cache lines replaced in L1 data cache]
                default_core/event=0x51,period=0x186a3,umask=0x1/
        ...
      
      After:
      
      $ perf list --details
        ...
        cache:
          l1d.replacement
               [Counts the number of cache lines replaced in L1 data cache. Unit: cpu]
                cpu/event=0x51,period=0x186a3,umask=0x1/
        ...
      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: James Clark <james.clark@arm.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: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20240308001915.4060155-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      39aa4ff6
    • Ian Rogers's avatar
      perf list: Add tracepoint encoding to detailed output · 525615ef
      Ian Rogers authored
      The tracepoint id holds the config value and is probed in determining
      what an event is. Add reading of the id so that we can display the
      event encoding as:
      
        $ perf list --details
        ...
          alarmtimer:alarmtimer_cancel                       [Tracepoint event]
                tracepoint/config=0x18c/
        ...
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.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: James Clark <james.clark@arm.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: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20240308001915.4060155-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      525615ef
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Introduce scrape script for 'clone' syscall 'flags' argument · 2316ef58
      Arnaldo Carvalho de Melo authored
      It was using the first variation on producing a string representation
      for a binary flag, one that used the copy of uapi/linux/sched.h with
      preprocessor tricks that had to be updated everytime a new flag was
      introduced.
      
      Use the more recent scrape script + strarray + strarray__scnprintf_flags() combo.
      
        $ tools/perf/trace/beauty/clone.sh | head -5
        static const char *clone_flags[] = {
        	[ilog2(0x00000100) + 1] = "VM",
        	[ilog2(0x00000200) + 1] = "FS",
        	[ilog2(0x00000400) + 1] = "FILES",
        	[ilog2(0x00000800) + 1] = "SIGHAND",
        $
      
      Now we can move uapi/linux/sched.h from tools/include/, that is used for
      building perf to the scrape only directory tools/perf/trace/beauty/include.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZfnULIn3XKDq0bpc@x1Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2316ef58
    • Namhyung Kim's avatar
      perf annotate-data: Do not retry for invalid types · bd62de08
      Namhyung Kim authored
      In some cases, it was able to find a type or location info (for per-cpu
      variable) but cannot match because of invalid offset or missing global
      information.  In those cases, it's meaningless to go to the outer scope
      and retry because there will be no additional information.
      
      Let's change the return type of find_matching_type() and bail out if it
      returns -1 for the cases.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-24-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bd62de08
    • Namhyung Kim's avatar
      perf annotate-data: Add a cache for global variable types · 55ee3d00
      Namhyung Kim authored
      They are often searched by many different places.  Let's add a cache
      for them to reduce the duplicate DWARF access.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-23-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      55ee3d00
    • Namhyung Kim's avatar
      perf annotate-data: Add stack canary type · b3c95109
      Namhyung Kim authored
      When the stack protector is enabled, compiler would generate code to
      check stack overflow with a special value called 'stack carary' at
      runtime.  On x86_64, GCC hard-codes the stack canary as %gs:40.
      
      While there's a definition of fixed_percpu_data in asm/processor.h,
      it seems that the header is not included everywhere and many places
      it cannot find the type info.  As it's in the well-known location (at
      %gs:40), let's add a pseudo stack canary type to handle it specially.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-22-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3c95109