1. 27 May, 2023 12 commits
    • Ian Rogers's avatar
      perf evsel: Add is_pmu_core inorder to interpret own_cpus · 1578e63d
      Ian Rogers authored
      The behaviour of handling cpu maps varies for core and other PMUs. For
      core PMUs the cpu map lists all valid CPUs, whereas for other PMUs the
      map is the default CPU. Add a flag in the evsel to indicate if a PMU
      is core to help with later interpreting of the cpu maps and populate
      it when the evsel is created during parsing. When propagating cpu
      maps, core PMUs should intersect the cpu map of the PMU with the user
      requested one.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1578e63d
    • Ian Rogers's avatar
      perf pmu: Add is_core to pmu · e20d1f2f
      Ian Rogers authored
      Cache is_pmu_core in the pmu to avoid recomputation.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e20d1f2f
    • Ian Rogers's avatar
      perf pmu: Detect ARM and hybrid PMUs with sysfs · 4bf7e81a
      Ian Rogers authored
      is_arm_pmu_core detects a core PMU via the presence of a "cpus" file
      rather than a "cpumask" file. This pattern holds for hybrid PMUs so
      rename the function and remove redundant perf_pmu__is_hybrid
      tests.
      
      Add a new helper is_pmu_hybrid similar to is_pmu_core.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4bf7e81a
    • Ian Rogers's avatar
      libperf cpumap: Add "any CPU"/dummy test function · 916ce34a
      Ian Rogers authored
      It is common in the code currently to test a map for "empty" when in
      fact the "any CPU"/dummy value of -1 is being sought. Add a new
      function to enable this and document the behavior of two other
      functions.
      
      The term "any CPU" comes from perf_event_open, where the value is
      consumed, but it is more typical in the code to see this value/map
      referred to as the dummy value. This could be misleading due to the
      dummy event and also dummy not being intention revealing, so it is hoped
      to migrate the code to referring to this as "any CPU".
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      916ce34a
    • Ian Rogers's avatar
      perf cpumap: Add equal function · 74c075ca
      Ian Rogers authored
      Equality is a useful property to compare after merging and
      intersecting maps.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      74c075ca
    • Ian Rogers's avatar
      perf cpumap: Add internal nr and cpu accessors · 7d1b529f
      Ian Rogers authored
      These accessors assume the map is non-null. Rewrite functions to use
      rather than direct accesses. This also fixes a build regression for
      REFCNT_CHECKING in the intersect function.
      Suggested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230527072210.2900565-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7d1b529f
    • Ian Rogers's avatar
      perf test python: Put perf python at start of sys.path · caa90a7b
      Ian Rogers authored
      This avoids picking up a system installed version of the perf python module.
      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: 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/20230527055517.2711487-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      caa90a7b
    • Namhyung Kim's avatar
      perf test: Fix perf stat JSON output test · 540c910c
      Namhyung Kim authored
      The recent --per-cache option test caused a problem.  According to the
      option name, I think it should check args.per_cache instead of
      args.per_cache_instance.
      
        $ sudo ./perf test -v 99
         99: perf stat JSON output linter                                    :
        --- start ---
        test child forked, pid 3086101
        Checking json output: no args [Success]
        Checking json output: system wide [Success]
        Checking json output: interval [Success]
        Checking json output: event [Success]
        Checking json output: per thread [Success]
        Checking json output: per node [Success]
        Checking json output: system wide no aggregation [Success]
        Checking json output: per core [Success]
        Checking json output: per cache_instance Test failed for input:
        ...
        Traceback (most recent call last):
          File "linux/tools/perf/tests/shell/lib/perf_json_output_lint.py", line 88, in <module>
            elif args.per_core or args.per_socket or args.per_node or args.per_die or args.per_cache_instance:
        AttributeError: 'Namespace' object has no attribute 'per_cache_instance'
        test child finished with -1
        ---- end ----
        perf stat JSON output linter: FAILED!
      
      Fixes: bfce728d ("pert tests: Add tests for new "perf stat --per-cache" aggregation option")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230524210600.3095830-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      540c910c
    • Ian Rogers's avatar
      perf tests: Organize cpu_map tests into a single suite · 5cebb33f
      Ian Rogers authored
      Go from 4 suites to a single suite with 4 test cases.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230526215410.2435674-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5cebb33f
    • Ian Rogers's avatar
      perf cpumap: Add intersect function · 237d41d4
      Ian Rogers authored
      The merge function gives the union of two cpu maps. Add an intersect
      function which is necessary, for example, when intersecting a PMUs
      supported CPUs with user requested.
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230526215410.2435674-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      237d41d4
    • Ian Rogers's avatar
      perf vendor events intel: Add metricgroup descriptions for all models · 6ac2230b
      Ian Rogers authored
      Add metric group descriptions created by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.py
      The descriptions add some additional detail in perf list.
      
      Committer notes:
      
      Removed unrelated changes to tools/perf/pmu-events/arch/x86/mapfile.csv
      that removed AMD mappings and ended up breaking the build with things
      like:
      
          CC      /tmp/build/perf-tools-next/pmu-events/pmu-events.o
        /tmp/build/perf-tools-next/pmu-events/pmu-events.c:23808:39: error: ‘pmu_metrics__amdzen4’ defined but not used [-Werror=unused-const-variable=]
        23808 | static const struct compact_pmu_event pmu_metrics__amdzen4[] = {
              |                                       ^~~~~~~~~~~~~~~~~~~~
        /tmp/build/perf-tools-next/pmu-events/pmu-events.c:23316:39: error: ‘pmu_events__amdzen4’ defined but not used [-Werror=unused-const-variable=]
        23316 | static const struct compact_pmu_event pmu_events__amdzen4[] = {
              |                                       ^~~~~~~~~~~~~~~~~~~
      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: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230517173805.602113-16-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6ac2230b
    • Ian Rogers's avatar
      perf jevents: Add support for metricgroup descriptions · 66c6e0c1
      Ian Rogers authored
      Metrics have a field where the groups they belong to are listed like
      the following from
      tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json:
      
              "MetricGroup": "PGO;TmaL1;TopdownL1;tma_L1_group",
              "MetricName": "tma_frontend_bound",
      
      The metric groups are shown in 'perf list' like the following where
      TopdownL1 is a metric group:
      
      TopdownL1:
        tma_backend_bound
             [This category represents fraction of slots where no uops are being
              delivered due to a lack of required resources for accepting new uops
              in the Backend]
        tma_bad_speculation
             [This category represents fraction of slots wasted due to incorrect
              speculations]
        tma_frontend_bound
             [This category represents fraction of slots where the processor's
              Frontend undersupplies its Backend]
        tma_retiring
             [This category represents fraction of slots utilized by useful work
              i.e. issued uops that eventually get retired]
      
      This patch adds support for a new json file in each model directory
      called metricgroups.json that comprises a dictionary containing
      entries that map from a metric group to a description:
      
      {
      ...
          "TopdownL1": "Metrics for top-down breakdown at level 1",
      ...
      }
      
      perf list is then updated to support this changing the above output
      to:
      
        TopdownL1: [Metrics for top-down breakdown at level 1]
      
      Committer notes:
      
      Added a (int) cast to the ARRAY_SIZE() introduced in this patch to
      address:
      
        /tmp/build/perf-tools-next/pmu-events/pmu-events.c: In function ‘describe_metricgroup’:
        /var/home/acme/git/perf-tools-next/tools/include/linux/kernel.h:102:25: error: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘18446744073709551615’ to ‘-1’ [-Werror=overflow]
          102 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
              |                         ^
        /tmp/build/perf-tools-next/pmu-events/pmu-events.c:61603:29: note: in expansion of macro ‘ARRAY_SIZE’
        61603 |         int low = 0, high = ARRAY_SIZE(metricgroups) - 1;
              |                             ^~~~~~~~~~
        cc1: all warnings being treated as errors
      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: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230517173805.602113-15-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      66c6e0c1
  2. 23 May, 2023 18 commits
  3. 22 May, 2023 2 commits
    • Anup Sharma's avatar
      perf test: Add test validating JSON generated by 'perf data convert --to-json' · 68d12418
      Anup Sharma authored
      This commit adds support for testing the JSON output generated by the
      'perf data' command's conversion to JSON functionality.
      
      The test script now includes a step to ensure that the resulting JSON
      file contains valid data.
      
      Changes:
      V1 -> V2:
      
      Added a check for the existence of the result output file.
      Replaced the usage of jq with json.load for validating the JSON format.
      Checks using ShellCheck and checkpatch, addressing and resolving warnings.
      Removed the unnecessary root permission check.
      Modified the 'perf record' command to avoid requiring root permissions.
      
      Committer testing:
      
        $ perf test to-json
        115: 'perf data convert --to-json' command test                      : Ok
        $ perf test -v to-json
        Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
        115: 'perf data convert --to-json' command test                      :
        --- start ---
        test child forked, pid 1746867
        Testing Perf Data Convertion Command to JSON
        Perf Data Converter Command to JSON [SUCCESS]
        Validating Perf Data Converted JSON file
        The file contains valid JSON format [SUCCESS]
        test child finished with 0
        ---- end ----
        'perf data convert --to-json' command test: Ok
        $
      Signed-off-by: default avatarAnup Sharma <anupnewsmail@gmail.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/ZGcoJBAGlknjsA/n@yogaTested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Anup Sharma <anupnewsmail@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      [ Fixup indentation to use consistently tabs, not a mixture of spaces and tabs, have 'if ... ; then'  on the same line ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      68d12418
    • Arnaldo Carvalho de Melo's avatar
      Merge remote-tracking branch 'acme/perf-tools' into perf-tools-next · 7cdda699
      Arnaldo Carvalho de Melo authored
      To pick up fixes that were already merged upstream.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7cdda699
  4. 19 May, 2023 3 commits
  5. 17 May, 2023 4 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers disabled-features: Sync with the kernel sources · 1b5f159c
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        e0bddc19 ("x86/mm: Reduce untagged_addr() overhead for systems without LAM")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
        diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZGTpdlzrlRjjnY6K@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1b5f159c
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync arch prctl headers with the kernel sources · 29719e31
      Arnaldo Carvalho de Melo authored
      To pick the changes in this cset:
      
        a03c376e ("x86/arch_prctl: Add AMX feature numbers as ABI constants")
        23e5d9ec ("x86/mm/iommu/sva: Make LAM and SVA mutually exclusive")
        2f8794bd ("x86/mm: Provide arch_prctl() interface for LAM")
      
      This picks these new prctls in a third range, that was also added to the
      tools/perf/trace/beauty/arch_prctl.c beautifier.
      
        $ tools/perf/trace/beauty/x86_arch_prctl.sh > /tmp/before
        $ cp arch/x86/include/uapi/asm/prctl.h tools/arch/x86/include/uapi/asm/prctl.h
        $ tools/perf/trace/beauty/x86_arch_prctl.sh > /tmp/after
        $ diff -u /tmp/before /tmp/after
        @@ -20,3 +20,11 @@
         	[0x2003 - 0x2001]= "MAP_VDSO_64",
         };
      
        +#define x86_arch_prctl_codes_3_offset 0x4001
        +static const char *x86_arch_prctl_codes_3[] = {
        +	[0x4001 - 0x4001]= "GET_UNTAG_MASK",
        +	[0x4002 - 0x4001]= "ENABLE_TAGGED_ADDR",
        +	[0x4003 - 0x4001]= "GET_MAX_TAG_BITS",
        +	[0x4004 - 0x4001]= "FORCE_TAGGED_SVA",
        +};
        +
        $
      
      With this 'perf trace' can translate those numbers into strings and use
      the strings in filter expressions:
      
        # perf trace -e prctl
             0.000 ( 0.011 ms): DOM Worker/3722622 prctl(option: SET_NAME, arg2: 0x7f9c014b7df5)     = 0
             0.032 ( 0.002 ms): DOM Worker/3722622 prctl(option: SET_NAME, arg2: 0x7f9bb6b51580)     = 0
             5.452 ( 0.003 ms): StreamT~ns #30/3722623 prctl(option: SET_NAME, arg2: 0x7f9bdbdfeb70) = 0
             5.468 ( 0.002 ms): StreamT~ns #30/3722623 prctl(option: SET_NAME, arg2: 0x7f9bdbdfea70) = 0
            24.494 ( 0.009 ms): IndexedDB #556/3722624 prctl(option: SET_NAME, arg2: 0x7f562a32ae28) = 0
            24.540 ( 0.002 ms): IndexedDB #556/3722624 prctl(option: SET_NAME, arg2: 0x7f563c6d4b30) = 0
           670.281 ( 0.008 ms): systemd-userwo/3722339 prctl(option: SET_NAME, arg2: 0x564be30805c8) = 0
           670.293 ( 0.002 ms): systemd-userwo/3722339 prctl(option: SET_NAME, arg2: 0x564be30800f0) = 0
        ^C#
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/prctl.h' differs from latest version at 'arch/x86/include/uapi/asm/prctl.h'
        diff -u tools/arch/x86/include/uapi/asm/prctl.h arch/x86/include/uapi/asm/prctl.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Chang S. Bae <chang.seok.bae@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZGTjNPpD3FOWfetM@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      29719e31
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update the copy of x86's mem{cpy,set}_64.S used in 'perf bench' · 7f02ce62
      Arnaldo Carvalho de Melo authored
      This is to get the changes from:
      
        68674f94 ("x86: don't use REP_GOOD or ERMS for small memory copies")
        20f3337d ("x86: don't use REP_GOOD or ERMS for small memory clearing")
      
      This also make the 'perf bench mem' files stop referring to the erms
      versions that gone away with the above patches.
      
      That addresses these perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
        diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7f02ce62
    • Arnaldo Carvalho de Melo's avatar
      tools headers x86 cpufeatures: Sync with the kernel sources · 9bc83d6e
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        3d8f61bf ("x86: KVM: Add common feature flag for AMD's PSFD")
        3763bf58 ("x86/cpufeatures: Redefine synthetic virtual NMI bit as AMD's "real" vNMI")
        6449dcb0 ("x86: CPUID and CR3/CR4 flags for Linear Address Masking")
        be8de49b ("x86/speculation: Identify processors vulnerable to SMT RSB predictions")
        e7862eda ("x86/cpu: Support AMD Automatic IBRS")
        faabfcb1 ("x86/cpu, kvm: Add the SMM_CTL MSR not present feature")
        5b909d4a ("x86/cpu, kvm: Add the Null Selector Clears Base feature")
        84168ae7 ("x86/cpu, kvm: Move X86_FEATURE_LFENCE_RDTSC to its native leaf")
        a9dc9ec5 ("x86/cpu, kvm: Add the NO_NESTED_DATA_BP feature")
        f8df91e7 ("x86/cpufeatures: Add macros for Intel's new fast rep string features")
        78335aac ("x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag")
        f334f723 ("x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag")
        a018d2e3 ("x86/cpufeatures: Add Architectural PerfMon Extension bit")
      
      This causes these perf files to be rebuilt and brings some X86_FEATURE
      that will be used when updating the copies of
      tools/arch/x86/lib/mem{cpy,set}_64.S with the kernel sources:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Jim Mattson <jmattson@google.com>
      Cc: Babu Moger <babu.moger@amd.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Link: https://lore.kernel.org/lkml/ZGTTw642q8mWgv2Y@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9bc83d6e
  6. 16 May, 2023 1 commit
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync s390 syscall table file that wires up the memfd_secret syscall · b6338963
      Arnaldo Carvalho de Melo authored
      To pick the changes in these csets:
      
        7608f70a ("s390: wire up memfd_secret system call")
      
      That add support for this new syscall in tools such as 'perf trace'.
      
      For instance, this is now possible (adapted from the x86_64 test output):
      
        # perf trace -v -e memfd_secret
        event qualifier tracepoint filter: (common_pid != 13375 && common_pid != 3713) && (id == 447)
        ^C#
      
      That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ grep memfd_secret tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        447    common  memfd_secret            sys_memfd_secret
        $
      
      This addresses this perf build warnings:
      
        Warning: Kernel ABI header at 'tools/perf/arch/s390/entry/syscalls/syscall.tbl' differs from latest version at 'arch/s390/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/lkml/ZGPMW0p++D1Jdvf6@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b6338963