1. 27 May, 2023 28 commits
    • Ian Rogers's avatar
      perf stat: Avoid hybrid PMU list · 3d88055f
      Ian Rogers authored
      perf_pmu__is_hybrid implicitly uses the hybrid PMU list. Instead
      return false if hybrid isn't present, if it is then see if any evsel's
      PMUs are 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-23-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d88055f
    • Ian Rogers's avatar
      perf metrics: Remove perf_pmu__is_hybrid use · ec6a4a8b
      Ian Rogers authored
      Switch from perf_pmu__is_hybrid to avoid implicitly using the hybrid
      PMU list.
      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-22-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ec6a4a8b
    • Ian Rogers's avatar
      perf header: Avoid hybrid PMU list in write_pmu_caps · 178ddf3b
      Ian Rogers authored
      Avoid perf_pmu__for_each_hybrid_pmu by iterating all PMUs are dumping
      the core ones. This will eventually allow removal of the hybrid PMU
      list.
      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-21-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      178ddf3b
    • Ian Rogers's avatar
      perf evsel: Compute is_hybrid from PMU being core · 5d9fb666
      Ian Rogers authored
      Short-cut when has_hybrid is false, otherwise return if the evsel's
      PMU is core. Add a comment for the some what surprising no PMU cases
      of hardware and legacy cache events.
      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-20-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d9fb666
    • Ian Rogers's avatar
      perf topology: Avoid hybrid list for hybrid topology · 1215795c
      Ian Rogers authored
      Avoid perf_pmu__for_each_hybrid_pmu in hybrid_topology__new by
      scanning all PMUs and processing the is_core ones. Add early exit for
      non-hybrid.
      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-19-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1215795c
    • Ian Rogers's avatar
      perf x86: Iterate hybrid PMUs as core PMUs · dd64647e
      Ian Rogers authored
      Rather than iterating over a separate hybrid list, iterate all PMUs
      with the hybrid ones having is_core as true.
      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-18-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd64647e
    • Ian Rogers's avatar
      perf pmu: Rewrite perf_pmu__has_hybrid to avoid list · ab1a1c77
      Ian Rogers authored
      Rather than list empty on perf_pmu__hybrid_pmus, detect if any core
      PMUs match the hybrid name. Computed values held in statics 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-17-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ab1a1c77
    • Ian Rogers's avatar
      perf pmu: Remove perf_pmu__hybrid_mounted · 4ced2c24
      Ian Rogers authored
      perf_pmu__hybrid_mounted is used to detect whether cpu_core or
      cpu_atom is mounted with a non-empty cpus file by
      pmu_lookup. Discussion [1] showed the empty cpus file check to be
      redundant and so pmu_lookup needn't have a call to
      perf_pmu__hybrid_mounted.
      
      Checking hybrid_mounted in pmu_is_uncore is redundant as the next
      cpumask read will fail returning false.
      
      Reduce the scope of perf_pmu__find_hybrid_pmu by making it static.
      
      [1] https://lore.kernel.org/lkml/20230524221831.1741381-17-irogers@google.com/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-16-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4ced2c24
    • Ian Rogers's avatar
      perf evlist: Reduce scope of evlist__has_hybrid · b167b530
      Ian Rogers authored
      Function is only used in printout, reduce scope to
      stat-display.c. Remove the now empty evlist-hybrid.c and
      evlist-hybrid.h.
      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-15-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b167b530
    • Ian Rogers's avatar
      perf evlist: Remove __evlist__add_default · 7b100989
      Ian Rogers authored
      __evlist__add_default adds a cycles event to a typically empty evlist
      and was extended for hybrid with evlist__add_default_hybrid, as more
      than 1 PMU was necessary. Rather than have dedicated logic for the
      cycles event, this change switches to parsing 'cycles:P' which will
      handle wildcarding the PMUs appropriately for hybrid.
      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-14-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7b100989
    • Ian Rogers's avatar
      perf evlist: Remove evlist__warn_hybrid_group · b4388dfa
      Ian Rogers authored
      Parse events now corrects PMU groups in
      parse_events__sort_events_and_fix_groups and so this warning is no
      longer possible.
      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-13-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b4388dfa
    • Ian Rogers's avatar
      perf tools: Warn if no user requested CPUs match PMU's CPUs · 5ac72634
      Ian Rogers authored
      In commit 1d3351e6 ("perf tools: Enable on a list of CPUs for hybrid")
      perf on hybrid will warn if a user requested CPU doesn't match the PMU
      of the given event but only for hybrid PMUs. Make the logic generic
      for all PMUs and remove the hybrid logic.
      
      Warn if a CPU is requested that isn't present/offline for events not
      on the core. Warn if a CPU is requested for a core PMU, but the CPU
      isn't within the cpu map of that PMU.
      
      For example on a 16 (0-15) CPU system:
      ```
      $ perf stat -e imc_free_running/data_read/,cycles -C 16 true
      WARNING: A requested CPU in '16' is not supported by PMU 'uncore_imc_free_running_1' (CPUs 0-15) for event 'imc_free_running/data_read/'
      WARNING: A requested CPU in '16' is not supported by PMU 'uncore_imc_free_running_0' (CPUs 0-15) for event 'imc_free_running/data_read/'
      WARNING: A requested CPU in '16' is not supported by PMU 'cpu' (CPUs 0-15) for event 'cycles'
      
       Performance counter stats for 'CPU(s) 16':
      
         <not supported> MiB  imc_free_running/data_read/
         <not supported>      cycles
      
             0.000575312 seconds time elapsed
      ```
      
      Remove evlist__fix_hybrid_cpus that previously produced the warnings
      and also perf_pmu__cpus_match that worked with evlist__fix_hybrid_cpus
      to change CPU maps for hybrid CPUs, something that is no longer
      necessary as CPU map propagation properly intersects user requested
      CPUs with the core PMU's CPU map.
      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-12-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5ac72634
    • Ian Rogers's avatar
      perf target: Remove unused hybrid value · 8ec984d5
      Ian Rogers authored
      Previously this was used to modify CPU map propagation, but it is now
      unnecessary as map propagation ensure core PMUs only have valid PMUs
      in the CPU map from user requested CPUs.
      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-11-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8ec984d5
    • Ian Rogers's avatar
      perf evlist: Allow has_user_cpus to be set on hybrid · 42249160
      Ian Rogers authored
      Now that CPU map propagation only sets valid CPUs for core PMUs, there
      is no reason to disable "has_user_cpus" for hybrid.
      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-10-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      42249160
    • Ian Rogers's avatar
      perf evlist: Propagate user CPU maps intersecting core PMU maps · ef91871c
      Ian Rogers authored
      The CPU map for a non-core PMU gives a default CPU value for
      perf_event_open. For core PMUs the CPU map lists all CPUs the evsel
      may be opened on. If there are >1 core PMU, the CPU maps will list the
      CPUs for that core PMU, but the user_requested_cpus may contain CPUs
      that are invalid for the PMU and cause perf_event_open to fail. To
      avoid this, when propagating the CPU map for core PMUs intersect it
      with the CPU map of the PMU (the evsel's "own_cpus").
      
      Add comments to __perf_evlist__propagate_maps to explain its somewhat
      complex behavior. Fix the related comments for system_wide in struct
      perf_evsel.
      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-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ef91871c
    • Ian Rogers's avatar
      perf pmu: Add CPU map for "cpu" PMUs · a0c41cae
      Ian Rogers authored
      A typical "cpu" PMU has no "cpus" or "cpumask" file meaning the CPU
      map is set to NULL, which also encodes an empty CPU map. Update
      pmu_cpumask so that if the "cpu" PMU fails to load a CPU map, use a
      default of all online PMUs.
      
      Remove const from cpu_map__online for the sake of reference counting.
      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-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a0c41cae
    • 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 12 commits
    • K Prateek Nayak's avatar
      pert tests: Add tests for new "perf stat --per-cache" aggregation option · bfce728d
      K Prateek Nayak authored
      Add tests for the new "--per-cache" option in 'perf stat' for CSV and
      JSON generation as well as for the JSON linting.
      Suggested-by: default avatarGautham Shenoy <gautham.shenoy@amd.com>
      Signed-off-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wen Pu <puwen@hygon.cn>
      Link: https://lore.kernel.org/r/20230517172745.5833-6-kprateek.nayak@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bfce728d
    • K Prateek Nayak's avatar
      perf stat: Add "--per-cache" aggregation option and document it · aab667ca
      K Prateek Nayak authored
      This patch adds support for "--per-cache" option for aggregation at a
      particular cache level and documents the same.
      
      Following is the output of 'perf stat' with aggregation at L3 for the
      event "ls_dmnd_fills_from_sys.ext_cache_remote" on a dual socket 3rd
      Generation EPYC Processor (2 x 64C/128T - 16 LLCs) when running
      hackbench pinned to 4 LLCs:
      
        $ sudo perf stat --per-cache=L3 -a -e ls_dmnd_fills_from_sys.ext_cache_remote -- \
          taskset -c 0-15,64-79,128-143,192-207 \
          perf bench sched messaging -p -t -l 100000 -g 8
      
        ...
      
         Performance counter stats for 'system wide':
      
        S0-D0-L3-ID0             16          9,500,803      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID8             16          6,338,099      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID16            16            355,005      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID24            16             22,067      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID32            16             16,321      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID40            16             11,619      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID48            16              4,238      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID56            16             31,158      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID64            16         28,242,452      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID72            16         22,906,973      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID80            16             72,898      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID88            16             56,907      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID96            16             20,456      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID104           16             40,913      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID112           16             78,113      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID120           16             37,897      ls_dmnd_fills_from_sys.ext_cache_remote
      
      Also support 'perf stat record' and 'perf stat report' with the ability
      to specify a different cache level to aggregate data at when running
      'perf stat report'.
      
        $ sudo perf stat record --per-cache=L2 -a -e ls_dmnd_fills_from_sys.ext_cache_remote -- \
          taskset -c 0-15,64-79,128-143,192-207 \
          perf bench sched messaging -p -t -l 100000 -g 8
      
        ...
      
         Performance counter stats for 'system wide':
      
        S0-D0-L2-ID0              2          1,442,061      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID1              2          1,548,994      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID2              2          1,553,557      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID3              2          1,420,122      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID4              2          1,465,461      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID5              2          1,455,153      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID6              2          1,595,237      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID7              2          1,499,321      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L2-ID8              2          1,919,025      ls_dmnd_fills_from_sys.ext_cache_remote
        ...
        S1-D1-L2-ID127            2             21,295      ls_dmnd_fills_from_sys.ext_cache_remote
      
        $ sudo perf stat report --per-cache=L3
      
         Performance counter stats for 'perf stat record --per-cache=L2 -a -e ls_dmnd_fills_from_sys.ext_cache_remote --\
                                        taskset -c 0-15,64-79,128-143,192-207 \
                                        perf bench sched messaging -p -t -l 100000 -g 8':
      
        S0-D0-L3-ID0             16         11,979,906      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID8             16         14,257,202      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID16            16            377,484      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID24            16             27,224      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID32            16             26,816      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID40            16             14,461      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID48            16             10,499      ls_dmnd_fills_from_sys.ext_cache_remote
        S0-D0-L3-ID56            16             53,817      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID64            16         27,361,987      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID72            16         37,299,024      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID80            16             84,125      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID88            16             64,561      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID96            16             13,403      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID104           16             20,138      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID112           16             93,220      ls_dmnd_fills_from_sys.ext_cache_remote
        S1-D1-L3-ID120           16             35,465      ls_dmnd_fills_from_sys.ext_cache_remote
      
      On the above system, the domain covered by S0-D0-L3-ID0 contains
      S0-D0-L2-ID0 to S0-D0-L2-ID7, the corresponding count for L3-ID0 is
      equal to the sum of counts for L2-ID0 to L2-ID7.
      
      Add documentation for the newly introduced "--per-cache" option.
      Suggested-by: default avatarGautham Shenoy <gautham.shenoy@amd.com>
      Signed-off-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wen Pu <puwen@hygon.cn>
      Link: https://lore.kernel.org/r/20230517172745.5833-5-kprateek.nayak@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aab667ca
    • K Prateek Nayak's avatar
      perf stat record: Save cache level information · 4b87406a
      K Prateek Nayak authored
      When aggregating based on cache-topology, in addition to the aggregation
      mode, knowing the cache level at which data is aggregated is necessary
      to ensure consistency when running 'perf stat record' and later 'perf
      stat report'.
      
      Save the cache level for aggregation as a part of the env data that can
      be later retrieved when running perf stat report.
      Suggested-by: default avatarGautham Shenoy <gautham.shenoy@amd.com>
      Signed-off-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wen Pu <puwen@hygon.cn>
      Link: https://lore.kernel.org/r/20230517172745.5833-4-kprateek.nayak@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4b87406a
    • K Prateek Nayak's avatar
      perf stat: Setup the foundation to allow aggregation based on cache topology · 995ed074
      K Prateek Nayak authored
      Processors based on chiplet architecture, such as AMD EPYC and Hygon do
      not expose the chiplet details in the sysfs CPU topology information.
      However, this information can be derived from the per CPU cache level
      information from the sysfs.
      
      'perf stat' has already supported aggregation based on topology
      information using core ID, socket ID, etc. It'll be useful to aggregate
      based on the cache topology to detect problems like imbalance and
      cache-to-cache sharing at various cache levels.
      
      This patch lays the foundation for aggregating data in 'perf stat' based
      on the processor's cache topology. The cmdline option to aggregate data
      based on the cache topology is added in Patch 4 of the series while this
      patch sets up all the necessary functions and variables required to
      support the new aggregation option.
      
      The patch also adds support to display per-cache aggregation, or save it
      as a JSON or CSV, as splitting it into a separate patch would break
      builds when compiling with "-Werror=switch-enum" where the compiler will
      complain about the lack of handling for the AGGR_CACHE case in the
      output functions.
      
      Committer notes:
      
      Don't use perf_stat_config in tools/perf/util/cpumap.c, this would make
      code that is in util/, thus not really specific to a single builtin, use
      a specific builtin config structure.
      
      Move the functions introduced in this patch from
      tools/perf/util/cpumap.c since it needs access to builtin specific
      and is not strictly needed to live in the util/ directory.
      
      With this 'perf test python' is back building.
      Suggested-by: default avatarGautham Shenoy <gautham.shenoy@amd.com>
      Signed-off-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wen Pu <puwen@hygon.cn>
      Link: https://lore.kernel.org/r/20230517172745.5833-3-kprateek.nayak@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      995ed074
    • K Prateek Nayak's avatar
      perf: Extract building cache level for a CPU into separate function · 2b72cec9
      K Prateek Nayak authored
      build_caches() builds the complete cache topology of the system by
      iterating over all CPU, building and comparing cache levels of each CPU,
      keeping only the unique ones at the end.
      
      Extract the unit that build the cache levels for a single CPU into a
      separate function. Expose this function, and the MAX_CACHE_LVL value to
      be used elsewhere in perf too.
      Signed-off-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Gautham Shenoy <gautham.shenoy@amd.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wen Pu <puwen@hygon.cn>
      Link: https://lore.kernel.org/r/20230517172745.5833-2-kprateek.nayak@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2b72cec9
    • Ian Rogers's avatar
      perf vendor events intel: Update tigerlake events/metrics · bc4e4121
      Ian Rogers authored
      Update tigerlake events to v1.12 including the new events
      MEM_LOAD_MISC_RETIRED.UC and SQ_MISC.BUS_LOCK. Metrics are updated to
      make TMA info metric names synchronized. Events and metrics were
      generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-14-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bc4e4121
    • Ian Rogers's avatar
      perf vendor events intel: Update snowridgex events · d97b82ae
      Ian Rogers authored
      Update snowridgex to v1.21 that marks deprecated a number of events
      and adds improves descriptions. The events data was generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-13-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d97b82ae
    • Ian Rogers's avatar
      perf vendor events intel: Update skylake/skylakex events/metrics · b522c8af
      Ian Rogers authored
      Update skylake events to v60 and skylakex events to v1.30, adding the
      events FP_ARITH_INST_RETIRED.4_FLOPS, FP_ARITH_INST_RETIRED.8_FLOPS,
      FP_ARITH_INST_RETIRED.SCALAR, FP_ARITH_INST_RETIRED.VECTOR and
      INT_MISC.CLEARS_COUNT. Metrics are updated to make TMA info metric
      names synchronized. Events and metrics were generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-12-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b522c8af
    • Ian Rogers's avatar
      perf vendor events intel: Update sapphirerapids events/metrics · 9a5511ea
      Ian Rogers authored
      Update sapphirerapids events to v1.13 improving event
      descriptions. Metrics are updated to make TMA info metric names
      synchronized. Events and metrics were generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-11-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a5511ea
    • Ian Rogers's avatar
      perf vendor events intel: Update sandybridge metrics · 98f17fb4
      Ian Rogers authored
      Metrics are updated to make TMA info metric names
      synchronized. Metrics were generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-10-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      98f17fb4
    • Ian Rogers's avatar
      perf vendor events intel: Update jaketown metrics · e08d2ae9
      Ian Rogers authored
      Metrics are updated to make TMA info metric names
      synchronized. Metrics were generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e08d2ae9
    • Ian Rogers's avatar
      perf vendor events intel: Update ivybridge/ivytown metrics · b27d3ece
      Ian Rogers authored
      Metrics are updated to make TMA info metric names
      synchronized. Metrics were generated by:
      https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.pyReviewed-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-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b27d3ece