1. 06 Jul, 2020 1 commit
  2. 02 Jul, 2020 2 commits
    • Ian Rogers's avatar
      perf parse-events: Disable a subset of bison warnings · 1f16fcad
      Ian Rogers authored
      Rather than disable all warnings with -w, disable specific warnings.
      
      Predicate enabling the warnings on a recent version of bison.
      
      Tested with GCC 9.3.0 and clang 9.0.1.
      
      Committer testing:
      
      The full set of compilers, gcc and clang that this will be tested on
      will be on the signed tag when this change goes upstream.
      
      Had to add -Wno-switch-enum to build on opensuse tumbleweed:
      
        /tmp/build/perf/util/parse-events-bison.c: In function 'yydestruct':
        /tmp/build/perf/util/parse-events-bison.c:1200:3: error: enumeration value 'YYSYMBOL_YYEMPTY' not handled in switch [-Werror=switch-enum]
         1200 |   switch (yykind)
              |   ^~~~~~
        /tmp/build/perf/util/parse-events-bison.c:1200:3: error: enumeration value 'YYSYMBOL_YYEOF' not handled in switch [-Werror=switch-enum]
      
      Also replace -Wno-error=implicit-function-declaration with -Wno-implicit-function-declaration.
      
      Also needed to check just the first two levels of the bison version, as
      the patch was assuming that all versions were of the form x.y.z, and
      there are several cases where it is just x.y, breaking the build.
      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: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-11-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1f16fcad
    • Ian Rogers's avatar
      perf parse-events: Disable a subset of flex warnings · 304d7a90
      Ian Rogers authored
      Rather than disable all warnings with -w, disable specific warnings.
      
      Predicate enabling the warnings on more recent flex versions.
      
      Tested with GCC 9.3.0 and clang 9.0.1.
      
      Committer notes:
      
      The full set of compilers, gcc and clang that this will be tested on
      will be on the signed tag when this change goes upstream.
      
      Added -Wno-misleading-indentation to the flex_flags to overcome this on
      opensuse tumbleweed when building with clang:
      
          CC       /tmp/build/perf/util/parse-events-flex.o
          CC       /tmp/build/perf/util/pmu.o
        /tmp/build/perf/util/parse-events-flex.c:5038:13: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                    if ( ! yyg->yy_state_buf )
                    ^
        /tmp/build/perf/util/parse-events-flex.c:5036:9: note: previous statement is here
                if ( ! yyg->yy_state_buf )
                ^
      
      And we need to use this to redirect stderr to stdin and then grep in a
      way that is acceptable for BusyBox shell:
      
        2>&1 |
      
      Previously I was using:
      
        |&
      
      Which seems to be bash specific.
      
      Added -Wno-sign-compare to overcome this on systems such as centos:7:
      
          CC       /tmp/build/perf/util/parse-events-flex.o
          CC       /tmp/build/perf/util/pmu.o
          CC       /tmp/build/perf/util/pmu-flex.o
        util/parse-events.l: In function 'parse_events_lex':
        /tmp/build/perf/util/parse-events-flex.c:193:36: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                         for ( yyl = n; yyl < yyleng; ++yyl )\
                                            ^
        /tmp/build/perf/util/parse-events-flex.c:204:9: note: in expansion of macro 'YY_LESS_LINENO'
      
      Added -Wno-unused-parameter to overcome this in systems such as
      centos:7:
      
          CC       /tmp/build/perf/util/parse-events-flex.o
          CC       /tmp/build/perf/util/pmu.o
        /tmp/build/perf/util/parse-events-flex.c: In function 'yy_fatal_error':
        /tmp/build/perf/util/parse-events-flex.c:6265:58: error: unused parameter 'yyscanner' [-Werror=unused-parameter]
         static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
                                                                  ^
      Added -Wno-missing-declarations to build in systems such as centos:6:
      
        /tmp/build/perf/util/parse-events-flex.c:6313: error: no previous prototype for 'parse_events_get_column'
        /tmp/build/perf/util/parse-events-flex.c:6389: error: no previous prototype for 'parse_events_set_column'
      
      And -Wno-missing-prototypes to cover older compilers:
      
        -Wmissing-prototypes (C only)
        Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. The aim is to detect global functions that fail to be declared in header files.
        -Wmissing-declarations (C only)
        Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files.
      
      Older C compilers lack -Wno-misleading-indentation, check if it is
      available before using it.
      
      Also needed to check just the first two levels of the flex version, as
      the patch was assuming that all versions were of the form x.y.z, and
      there are several cases where it is just x.y, breaking the build.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      304d7a90
  3. 23 Jun, 2020 2 commits
    • Ian Rogers's avatar
      perf parse-events: Declare bison header file output · ef9894d9
      Ian Rogers authored
      Declare bison header file output so that C files can depend upon them.
      
      As there are multiple output targets $@ is replaced by the target name.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ef9894d9
    • Arnaldo Carvalho de Melo's avatar
      perf expr: Add missing headers noticed when building with NO_LIBBPF=1 · 3744ca1e
      Arnaldo Carvalho de Melo authored
      These will break the build as soon as we stop disabling all warnings
      when building flex and bison generated files, so add them before we do
      that to keep the tree bisectable.
      
      Noticed when building on centos:7 with NO_LIBBPF=1:
      
        util/expr.c: In function 'key_equal':
        util/expr.c:29:2: error: implicit declaration of function 'strcmp' [-Werror=implicit-function-declaration]
          return !strcmp((const char *)key1, (const char *)key2);
          ^
        util/expr.c: In function 'expr__add_id':
        util/expr.c:40:3: error: implicit declaration of function 'malloc' [-Werror=implicit-function-declaration]
           val_ptr = malloc(sizeof(double));
           ^
        util/expr.c:40:13: error: incompatible implicit declaration of built-in function 'malloc' [-Werror]
           val_ptr = malloc(sizeof(double));
                     ^
        util/expr.c:42:12: error: 'ENOMEM' undeclared (first use in this function)
            return -ENOMEM;
                    ^
      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: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3744ca1e
  4. 22 Jun, 2020 33 commits
    • Ian Rogers's avatar
      perf parse-events: Declare flex header file output · 4b971df9
      Ian Rogers authored
      Declare flex header file output so that bison C files can depend upon
      them. As there are multiple output targets $@ is replaced by the target
      name.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4b971df9
    • Ian Rogers's avatar
      perf pmu: Add flex debug build flag · 970a4a34
      Ian Rogers authored
      Allow pmu parser's flex to be debugged as the parse-events and expr
      currently are. Enabling this requires the C code to call
      perf_pmu__flex_debug.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      970a4a34
    • Ian Rogers's avatar
      perf pmu: Add bison debug build flag · 5011a52f
      Ian Rogers authored
      Allow pmu parser to be debugged as the parse-events and expr currently
      are.  Enabling this requires the C code to set perf_pmu_debug.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5011a52f
    • Ian Rogers's avatar
      perf parse-events: Use automatic variable for yacc input · da77a14d
      Ian Rogers authored
      This reduces the command line size slightly.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da77a14d
    • Ian Rogers's avatar
      perf parse-events: Use automatic variable for flex input · 8d54c308
      Ian Rogers authored
      This reduces the command line size slightly.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200619043356.90024-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8d54c308
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Fix the class prefix for 'struct evlist' branch_type methods · 92c7d7cd
      Arnaldo Carvalho de Melo authored
      To differentiate from libperf's 'struct perf_evlist' methods.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      92c7d7cd
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Fix the class prefix for 'struct evlist' sample_id_all methods · 8cedf3a5
      Arnaldo Carvalho de Melo authored
      To differentiate from libperf's 'struct perf_evlist' methods.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8cedf3a5
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Fix the class prefix for 'struct evlist' sample_type methods · b3c2cc2b
      Arnaldo Carvalho de Melo authored
      To differentiate from libperf's 'struct perf_evlist' methods.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3c2cc2b
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Fix the class prefix for 'struct evlist' strerror methods · d1f249ec
      Arnaldo Carvalho de Melo authored
      To differentiate from libperf's 'struct perf_evlist' methods.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d1f249ec
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Fix the class prefix for 'struct evlist' 'add' evsel methods · e251abee
      Arnaldo Carvalho de Melo authored
      To differentiate from libperf's 'struct perf_evlist' methods.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e251abee
    • John Garry's avatar
      perf pmu: Improve CPU core PMU HW event list ordering · ce0dc7d2
      John Garry authored
      For perf list, the CPU core PMU HW event ordering is such that not all
      events may will be listed adjacent - consider this example:
      
        $ tools/perf/perf list
      
        List of pre-defined events (to be used in -e):
      
          duration_time                                      [Tool event]
      
          branch-instructions OR cpu/branch-instructions/    [Kernel PMU event]
          branch-misses OR cpu/branch-misses/                [Kernel PMU event]
          bus-cycles OR cpu/bus-cycles/                      [Kernel PMU event]
          cache-misses OR cpu/cache-misses/                  [Kernel PMU event]
          cache-references OR cpu/cache-references/          [Kernel PMU event]
          cpu-cycles OR cpu/cpu-cycles/                      [Kernel PMU event]
          cstate_core/c3-residency/                          [Kernel PMU event]
          cstate_core/c6-residency/                          [Kernel PMU event]
          cstate_core/c7-residency/                          [Kernel PMU event]
          cstate_pkg/c2-residency/                           [Kernel PMU event]
          cstate_pkg/c3-residency/                           [Kernel PMU event]
          cstate_pkg/c6-residency/                           [Kernel PMU event]
          cstate_pkg/c7-residency/                           [Kernel PMU event]
          cycles-ct OR cpu/cycles-ct/                        [Kernel PMU event]
          cycles-t OR cpu/cycles-t/                          [Kernel PMU event]
          el-abort OR cpu/el-abort/                          [Kernel PMU event]
          el-capacity OR cpu/el-capacity/                    [Kernel PMU event]
      
      Notice in the above example how the cstate_core PMU events are mixed in
      the middle of the CPU core events.
      
      For my arm64 platform, all the uncore events get mixed in, making the list
      very disorganised:
      
          page-faults OR faults                              [Software event]
          task-clock                                         [Software event]
          duration_time                                      [Tool event]
          L1-dcache-load-misses                              [Hardware cache event]
          L1-dcache-loads                                    [Hardware cache event]
          L1-icache-load-misses                              [Hardware cache event]
          L1-icache-loads                                    [Hardware cache event]
          branch-load-misses                                 [Hardware cache event]
          branch-loads                                       [Hardware cache event]
          dTLB-load-misses                                   [Hardware cache event]
          dTLB-loads                                         [Hardware cache event]
          iTLB-load-misses                                   [Hardware cache event]
          iTLB-loads                                         [Hardware cache event]
          br_mis_pred OR armv8_pmuv3_0/br_mis_pred/          [Kernel PMU event]
          br_mis_pred_retired OR armv8_pmuv3_0/br_mis_pred_retired/ [Kernel PMU event]
          br_pred OR armv8_pmuv3_0/br_pred/                  [Kernel PMU event]
          br_retired OR armv8_pmuv3_0/br_retired/            [Kernel PMU event]
          br_return_retired OR armv8_pmuv3_0/br_return_retired/ [Kernel PMU event]
          bus_access OR armv8_pmuv3_0/bus_access/            [Kernel PMU event]
          bus_cycles OR armv8_pmuv3_0/bus_cycles/            [Kernel PMU event]
          cid_write_retired OR armv8_pmuv3_0/cid_write_retired/ [Kernel PMU event]
          cpu_cycles OR armv8_pmuv3_0/cpu_cycles/            [Kernel PMU event]
          dtlb_walk OR armv8_pmuv3_0/dtlb_walk/              [Kernel PMU event]
          exc_return OR armv8_pmuv3_0/exc_return/            [Kernel PMU event]
          exc_taken OR armv8_pmuv3_0/exc_taken/              [Kernel PMU event]
          hisi_sccl1_ddrc0/act_cmd/                          [Kernel PMU event]
          hisi_sccl1_ddrc0/flux_rcmd/                        [Kernel PMU event]
          hisi_sccl1_ddrc0/flux_rd/                          [Kernel PMU event]
          hisi_sccl1_ddrc0/flux_wcmd/                        [Kernel PMU event]
          hisi_sccl1_ddrc0/flux_wr/                          [Kernel PMU event]
          hisi_sccl1_ddrc0/pre_cmd/                          [Kernel PMU event]
          hisi_sccl1_ddrc0/rnk_chg/                          [Kernel PMU event]
      
      ...
      
          hisi_sccl7_l3c21/wr_hit_cpipe/                     [Kernel PMU event]
          hisi_sccl7_l3c21/wr_hit_spipe/                     [Kernel PMU event]
          hisi_sccl7_l3c21/wr_spipe/                         [Kernel PMU event]
          inst_retired OR armv8_pmuv3_0/inst_retired/        [Kernel PMU event]
          inst_spec OR armv8_pmuv3_0/inst_spec/              [Kernel PMU event]
          itlb_walk OR armv8_pmuv3_0/itlb_walk/              [Kernel PMU event]
          l1d_cache OR armv8_pmuv3_0/l1d_cache/              [Kernel PMU event]
          l1d_cache_refill OR armv8_pmuv3_0/l1d_cache_refill/ [Kernel PMU event]
          l1d_cache_wb OR armv8_pmuv3_0/l1d_cache_wb/        [Kernel PMU event]
          l1d_tlb OR armv8_pmuv3_0/l1d_tlb/                  [Kernel PMU event]
          l1d_tlb_refill OR armv8_pmuv3_0/l1d_tlb_refill/    [Kernel PMU event]
      
      So the events are list alphabetically. However, CPU core event listing is
      special from commit dc098b35 ("perf list: List kernel supplied event
      aliases"), in that the alias and full event is shown (in that order).
      As such, the core events may become sparse.
      
      Improve this by grouping the CPU core events and ensure that they are
      listed first for kernel PMU events. For the first example, above, this
      now looks like:
      
          duration_time                                      [Tool event]
          branch-instructions OR cpu/branch-instructions/    [Kernel PMU event]
          branch-misses OR cpu/branch-misses/                [Kernel PMU event]
          bus-cycles OR cpu/bus-cycles/                      [Kernel PMU event]
          cache-misses OR cpu/cache-misses/                  [Kernel PMU event]
          cache-references OR cpu/cache-references/          [Kernel PMU event]
          cpu-cycles OR cpu/cpu-cycles/                      [Kernel PMU event]
          cycles-ct OR cpu/cycles-ct/                        [Kernel PMU event]
          cycles-t OR cpu/cycles-t/                          [Kernel PMU event]
          el-abort OR cpu/el-abort/                          [Kernel PMU event]
          el-capacity OR cpu/el-capacity/                    [Kernel PMU event]
          el-commit OR cpu/el-commit/                        [Kernel PMU event]
          el-conflict OR cpu/el-conflict/                    [Kernel PMU event]
          el-start OR cpu/el-start/                          [Kernel PMU event]
          instructions OR cpu/instructions/                  [Kernel PMU event]
          mem-loads OR cpu/mem-loads/                        [Kernel PMU event]
          mem-stores OR cpu/mem-stores/                      [Kernel PMU event]
          ref-cycles OR cpu/ref-cycles/                      [Kernel PMU event]
          topdown-fetch-bubbles OR cpu/topdown-fetch-bubbles/ [Kernel PMU event]
          topdown-recovery-bubbles OR cpu/topdown-recovery-bubbles/ [Kernel PMU event]
          topdown-slots-issued OR cpu/topdown-slots-issued/  [Kernel PMU event]
          topdown-slots-retired OR cpu/topdown-slots-retired/ [Kernel PMU event]
          topdown-total-slots OR cpu/topdown-total-slots/    [Kernel PMU event]
          tx-abort OR cpu/tx-abort/                          [Kernel PMU event]
          tx-capacity OR cpu/tx-capacity/                    [Kernel PMU event]
          tx-commit OR cpu/tx-commit/                        [Kernel PMU event]
          tx-conflict OR cpu/tx-conflict/                    [Kernel PMU event]
          tx-start OR cpu/tx-start/                          [Kernel PMU event]
          cstate_core/c3-residency/                          [Kernel PMU event]
          cstate_core/c6-residency/                          [Kernel PMU event]
          cstate_core/c7-residency/                          [Kernel PMU event]
          cstate_pkg/c2-residency/                           [Kernel PMU event]
          cstate_pkg/c3-residency/                           [Kernel PMU event]
          cstate_pkg/c6-residency/                           [Kernel PMU event]
          cstate_pkg/c7-residency/                           [Kernel PMU event]
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1592384514-119954-3-git-send-email-john.garry@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ce0dc7d2
    • John Garry's avatar
      perf pmu: List kernel supplied event aliases for arm64 · c1b4745b
      John Garry authored
      In commit dc098b35 ("perf list: List kernel supplied event aliases"),
      the aliases for events are supplied in addition to CPU event in perf list.
      
      This relies on the name of the core PMU being "cpu", which is not the case
      for arm64, so arm64 has always missed this. Use generic is_pmu_core()
      helper which takes account of arm64 to make this feature work for arm64
      (and possibly other archs).
      
      Sample, before:
      
        armv8_pmuv3_0/br_mis_pred/          [Kernel PMU event]
      
      after:
      
        br_mis_pred OR armv8_pmuv3_0/br_mis_pred/          [Kernel PMU event]
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1592384514-119954-2-git-send-email-john.garry@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c1b4745b
    • Mike Leach's avatar
      perf cs-etm: Allow no CoreSight sink to be specified on command line · 47446212
      Mike Leach authored
      Adjust the handling of the session sink selection to allow no sink to be
      selected on the command line. This then forwards the sink selection to
      the CoreSight infrastructure which will attempt to select a sink based
      on the default sink select priorities.
      Signed-off-by: default avatarMike Leach <mike.leach@linaro.org>
      Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      47446212
    • Ian Rogers's avatar
      perf expr: Add < and > operators · ff1a12f9
      Ian Rogers authored
      These are broadly useful but required to handle TMA metrics. For example
      encoding Ports_Utilization from:
      
        https://download.01.org/perfmon/TMA_Metrics.csv
      
      requires '<'.
      
        {
          "BriefDescription": "This metric estimates fraction of cycles the CPU performance was potentially limited due to Core computation issues (non divider-related).  Two distinct categories can be attributed into this metric: (1) heavy data-dependency among contiguous instructions would manifest in this metric - such cases are often referred to as low Instruction Level Parallelism (ILP). (2) Contention on some hardware execution unit other than Divider. For example; when there are too many multiply operations.",
          "MetricExpr": "( ( cpu@EXE_ACTIVITY.EXE_BOUND_0_PORTS@ + cpu@EXE_ACTIVITY.1_PORTS_UTIL@ + ( cpu@EXE_ACTIVITY.2_PORTS_UTIL@ * ( ( ( cpu@UOPS_RETIRED.RETIRE_SLOTS@ ) / ( cpu@CPU_CLK_UNHALTED.THREAD@ ) ) / ( ( 4.000000 ) + 1.000000 ) ) ) ) / ( cpu@CPU_CLK_UNHALTED.THREAD@ ) if ( cpu@ARITH.DIVIDER_ACTIVE\\,cmask\\=1@ < cpu@EXE_ACTIVITY.EXE_BOUND_0_PORTS@ ) else ( ( cpu@EXE_ACTIVITY.EXE_BOUND_0_PORTS@ + cpu@EXE_ACTIVITY.1_PORTS_UTIL@ + ( cpu@EXE_ACTIVITY.2_PORTS_UTIL@ * ( ( ( cpu@UOPS_RETIRED.RETIRE_SLOTS@ ) / ( cpu@CPU_CLK_UNHALTED.THREAD@ ) ) / ( ( 4.000000 ) + 1.000000 ) ) ) ) - cpu@EXE_ACTIVITY.EXE_BOUND_0_PORTS@ ) / ( cpu@CPU_CLK_UNHALTED.THREAD@ ) )",
          "MetricGroup": "Topdown_Group_Ports_Utilization",
          "MetricName": "Topdown_Metric_Ports_Utilization"
        },
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200610235823.52557-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ff1a12f9
    • Ian Rogers's avatar
      perf expr: Add d_ratio operation · 3e21a28a
      Ian Rogers authored
      d_ratio avoids division by 0 yielding infinity, such as when a counter
      doesn't get scheduled. An example usage is:
      
        {
            "BriefDescription": "DCache L1 misses",
            "MetricExpr": "d_ratio(MEM_LOAD_RETIRED.L1_MISS, MEM_LOAD_RETIRED.L1_HIT + MEM_LOAD_RETIRED.L1_MISS + MEM_LOAD_RETIRED.FB_HIT)",
            "MetricGroup": "DCache;DCache_L1",
            "MetricName": "DCache_L1_Miss",
            "ScaleUnit": "100%",
        }
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200610235823.52557-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3e21a28a
    • Arnaldo Carvalho de Melo's avatar
      perf script: Fixup some evsel/evlist method names · afdd63f5
      Arnaldo Carvalho de Melo authored
      Fixups related to the introduction of libperf, where the
      perf_{evsel,evlist}__ prefix is reserved for functions operating on
      struct perf_{evsel,evlist}.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      afdd63f5
    • Jiri Olsa's avatar
      perf tests: Add parse metric test for frontend metric · 218ca91d
      Jiri Olsa authored
      Adding new metric test for frontend metric. It's stolen from x86 pmu
      events.
      
      Committer testing:
      
        # perf test "Parse and process metrics"
        67: Parse and process metrics                             : Ok
        # perf test -v "Parse and process metrics"
        #
        67: Parse and process metrics                             :
        --- start ---
        test child forked, pid 104881
        metric expr inst_retired.any / cpu_clk_unhalted.thread for IPC
        found event inst_retired.any
        found event cpu_clk_unhalted.thread
        adding {inst_retired.any,cpu_clk_unhalted.thread}:W
        metric expr idq_uops_not_delivered.core / (4 * (( ( cpu_clk_unhalted.thread / 2 ) * ( 1 + cpu_clk_unhalted.one_thread_active / cpu_clk_unhalted.ref_xclk ) ))) for Frontend_Bound_SMT
        found event cpu_clk_unhalted.one_thread_active
        found event cpu_clk_unhalted.ref_xclk
        found event idq_uops_not_delivered.core
        found event cpu_clk_unhalted.thread
        adding {cpu_clk_unhalted.one_thread_active,cpu_clk_unhalted.ref_xclk,idq_uops_not_delivered.core,cpu_clk_unhalted.thread}:W
        test child finished with 0
        ---- end ----
        Parse and process metrics: Ok
        #
      
      Had to fix it to initialize that 'struct value' array sentinel with a
      named initializer to fix the build with some versions of clang:
      
        tests/parse-metric.c:154:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
                      { 0 },
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-14-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      218ca91d
    • Jiri Olsa's avatar
      perf tests: Add parse metric test for ipc metric · 0a507af9
      Jiri Olsa authored
      Adding new test that process metrics code and checks the expected
      results. Starting with easy ipc metric.
      
      Committer testing:
      
        # perf test "Parse and process metrics"
        67: Parse and process metrics                             : Ok
        #
        # perf test -v "Parse and process metrics"
        67: Parse and process metrics                             :
        --- start ---
        test child forked, pid 103402
        metric expr inst_retired.any / cpu_clk_unhalted.thread for IPC
        found event inst_retired.any
        found event cpu_clk_unhalted.thread
        adding {inst_retired.any,cpu_clk_unhalted.thread}:W
        test child finished with 0
        ---- end ----
        Parse and process metrics: Ok
        #
      
      Had to fix it to initialize that 'struct value' array sentinel with a
      named initializer to fix the build with some versions of clang:
      
        tests/parse-metric.c:135:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
                      { 0 },
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-13-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a507af9
    • Jiri Olsa's avatar
      perf tools: Add test_generic_metric function · 6d432c4c
      Jiri Olsa authored
      Adding test_generic_metric that prepares and runs given metric over the
      data from struct runtime_stat object.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-12-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6d432c4c
    • Jiri Olsa's avatar
      perf tools: Release metric_events rblist · 9afe5658
      Jiri Olsa authored
      We don't release metric_events rblist, add the missing delete hook and
      call the release before leaving cmd_stat.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-11-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9afe5658
    • Jiri Olsa's avatar
      perf tools: Factor out prepare_metric function · 2cfaa853
      Jiri Olsa authored
      Factoring out prepare_metric function so it can be used in test
      interface coming in following changes.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-10-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2cfaa853
    • Jiri Olsa's avatar
      perf tools: Add metricgroup__parse_groups_test function · f78ac00a
      Jiri Olsa authored
      Add the metricgroup__parse_groups_test function. It will be used as
      test's interface to metric parsing in following changes.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-9-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f78ac00a
    • Jiri Olsa's avatar
      perf tools: Add map to parse_groups() function · 1381396b
      Jiri Olsa authored
      For testing purposes we need to pass our own map of events from
      parse_groups() through metricgroup__add_metric.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-8-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1381396b
    • Jiri Olsa's avatar
      perf tools: Add fake_pmu to parse_group() function · 68173bda
      Jiri Olsa authored
      Allow to pass fake_pmu in parse_groups function so it can be used in
      parse_events call.
      
      It's will be passed by the upcoming metricgroup__parse_groups_test
      function.
      
      Committer notes:
      
      Made it a 'struct perf_pmu' pointer, in line with the changes at the
      start of this patchkit to avoid statics deep down in library code.
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-6-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      68173bda
    • Jiri Olsa's avatar
      perf parse: Factor out parse_groups() function · 8b4468a2
      Jiri Olsa authored
      Factor out the parse_groups function, it will be used for new test
      interface coming in following changes.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-6-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8b4468a2
    • Jiri Olsa's avatar
      perf tests: Add another metric parsing test · e1c92a7f
      Jiri Olsa authored
      The test goes through all metrics compiled for arch within pmu events
      and try to parse them.
      
      This test is different from 'test_parsing' in that we go through all the
      events in the current arch, not just one defined for current CPU model.
      Using 'fake_pmu' to parse events which do not have PMUs defined in the
      system.
      
      Say there's bad change in ivybridge metrics file, like:
      
        - a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
        + b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
        @@ -8,7 +8,7 @@
        -        "MetricExpr": "IDQ_UOPS_NOT_DELIVERED.CORE / (4 * ((
        +        "MetricExpr": "IDQ_UOPS_NOT_DELIVERED.CORE / / (4 *
      
      the test fails with (on my kabylake laptop):
      
        $ perf test 'Parsing of PMU event table metrics with fake PMUs' -v
        parsing 'idq_uops_not_delivered.core / / (4 * (( ( cpu_clk_unh...
        syntax error, line 1
        expr__parse failed
        test child finished with -1
        ...
      
      The test also defines its own list of metrics and tries to parse them.
      It's handy for developing.
      
      Committer notes:
      
      Testing it:
      
        $ perf test fake
        10: PMU events                                            :
        10.4: Parsing of PMU event table metrics with fake PMUs   : FAILED!
        $ perf test -v fake |& tail
        parsing '(unc_p_freq_trans_cycles / unc_p_clockticks) * 100.'
        parsing '(unc_m_power_channel_ppd / unc_m_clockticks) * 100.'
        parsing '(unc_m_power_critical_throttle_cycles / unc_m_clockticks) * 100.'
        parsing '(unc_m_power_self_refresh / unc_m_clockticks) * 100.'
        parsing 'idq_uops_not_delivered.core / * (4 * cycles)'
        syntax error
        expr__parse failed
        test child finished with -1
        ---- end ----
        PMU events subtest 4: FAILED!
        $
      
      And fix this error:
      
        tests/pmu-events.c:437:40: error: missing field 'idx' initializer [-Werror,-Wmissing-field-initializers]
              struct parse_events_error error = { 0 };
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-5-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e1c92a7f
    • Arnaldo Carvalho de Melo's avatar
      perf pmu: Add a perf_pmu__fake object to use with __parse_events() · e46fc8d9
      Arnaldo Carvalho de Melo authored
      When wanting to use the support in __parse_events() for fake pmus, just
      pass it.
      
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e46fc8d9
    • Arnaldo Carvalho de Melo's avatar
      perf parse: Provide a way to pass a fake_pmu to parse_events() · 3bf91aa5
      Arnaldo Carvalho de Melo authored
      This is an alternative patch to what Jiri sent that instead of changing
      all callers to parse_events() for allowing to pass a fake_pmu, provide
      another function specifically for that.
      
      From Jiri's patch:
      
      This way it's possible to parse events from PMUs which are not present
      in the system. It's available only for testing purposes coming in
      following changes, so all the current users set fake_pmu argument as
      false.
      Based-on-a-patch-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-3-jolsa@kernel.orgAcked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3bf91aa5
    • Jiri Olsa's avatar
      perf tests: Factor check_parse_id function · 34bacc95
      Jiri Olsa authored
      Separating the generic part of check_parse_id function,
      so it can be used in following changes for the new test.
      
      Committer notes:
      
      Fix this error:
      
        tests/pmu-events.c:413:40: error: missing field 'idx' initializer [-Werror,-Wmissing-field-initializers]
              struct parse_events_error error = { 0 };
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-4-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      34bacc95
    • Jiri Olsa's avatar
      perf tools: Add fake pmu support · 387ad33f
      Jiri Olsa authored
      Add a way to create a pmu event without the actual PMU being in place.
      
      This way we can test metrics defined for any processor.
      
      The interface is to define fake_pmu in struct parse_events_state data.
      It will be used only in tests via special interface function added in
      following changes.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602214741.1218986-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      387ad33f
    • Jason Yan's avatar
      perf annotate: Remove unneeded conversion to bool · a1f8bc95
      Jason Yan authored
      The '>' expression itself is bool, no need to convert it to bool again.
      This fixes the following coccicheck warning:
      
        tools/perf/ui/browsers/annotate.c:212:30-35: WARNING: conversion to bool
        not needed here
      Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200420123528.11655-1-yanaijie@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a1f8bc95
    • Andreas Gerstmayr's avatar
      perf flamegraph: Explicitly set utf-8 encoding · c42ad5d4
      Andreas Gerstmayr authored
      On some platforms the default encoding is not utf-8, which causes an
      UnicodeDecodeError when reading the flamegraph template and writing the
      flamegraph
      Signed-off-by: default avatarAndreas Gerstmayr <agerstmayr@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200619153232.203537-1-agerstmayr@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c42ad5d4
    • Jason A. Donenfeld's avatar
      Revert "kernel/printk: add kmsg SEEK_CUR handling" · 625d3449
      Jason A. Donenfeld authored
      This reverts commit 8ece3b3e.
      
      This commit broke userspace. Bash uses ESPIPE to determine whether or
      not the file should be read using "unbuffered I/O", which means reading
      1 byte at a time instead of 128 bytes at a time. I used to use bash to
      read through kmsg in a really quite nasty way:
      
          while read -t 0.1 -r line 2>/dev/null || [[ $? -ne 142 ]]; do
             echo "SARU $line"
          done < /dev/kmsg
      
      This will show all lines that can fit into the 128 byte buffer, and skip
      lines that don't. That's pretty awful, but at least it worked.
      
      With this change, bash now tries to do 1-byte reads, which means it
      skips all the lines, which is worse than before.
      
      Now, I don't really care very much about this, and I'm already look for
      a workaround. But I did just spend an hour trying to figure out why my
      scripts were broken. Either way, it makes no difference to me personally
      whether this is reverted, but it might be something to consider. If you
      declare that "trying to read /dev/kmsg with bash is terminally stupid
      anyway," I might be inclined to agree with you. But do note that bash
      uses lseek(fd, 0, SEEK_CUR)==>ESPIPE to determine whether or not it's
      reading from a pipe.
      
      Cc: Bruno Meneguele <bmeneg@redhat.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: David Laight <David.Laight@ACULAB.COM>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      625d3449
  5. 21 Jun, 2020 2 commits