linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/43] Fix perf on Intel hybrid CPUs
@ 2023-04-28  7:37 Ian Rogers
  2023-04-28  7:37 ` [PATCH v2 01/43] perf stat: Disable TopdownL1 on hybrid Ian Rogers
                   ` (41 more replies)
  0 siblings, 42 replies; 50+ messages in thread
From: Ian Rogers @ 2023-04-28  7:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Kan Liang, Ahmad Yasin, Peter Zijlstra,
	Ingo Molnar, Stephane Eranian, Andi Kleen, Perry Taylor,
	Samantha Alt, Caleb Biggers, Weilin Wang, Edward Baker,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Adrian Hunter, Florian Fischer, Rob Herring, Zhengjun Xing,
	John Garry, Kajol Jain, Sumanth Korikkar, Thomas Richter,
	Tiezhu Yang, Ravi Bangoria, Leo Yan, Yang Jihong, James Clark,
	Suzuki Poulouse, Kang Minchul, Athira Rajeev, linux-perf-users,
	linux-kernel
  Cc: Ian Rogers

TL;DR: hybrid doesn't crash, json metrics work on hybrid on both PMUs
or individually, event parsing doesn't always scan all PMUs, more and
new tests that also run without hybrid, less code.

The first 3 patches are proposed to address Linux 6.4 issues with the
remainder to be the basis for 6.5. The first patch is a 1 liner, plus
comment, workaround for Intel hybrid platforms crashing perf stat when
running with no events/metrics. The second patch works around an issue
with platforms like Skylake where certain events fail to open at
higher paranoia levels even if kernel and hypervisor profiling is
disabled. Events are marked as skippable and not placed in the output,
while remaining events are and metrics are computed. The third patch
makes it so that TopdownL1 and TopdownL2 json metric groups don't
group events on Intel, this is done via a new json flag. Adding the
json flag in each of the json files is two-thirds of the 300 lines of
these patches. Patch 42 removes the disabling of TopdownL1 on hybrid
as the underlying problems are fixed. The json file updates are
created with the usual script updated in:
https://github.com/intel/perfmon/pull/73

The next 5 patches avoid grouping events for metrics where is could
never succeed and were previously posted as:
"perf vendor events intel: Add xxx metric constraints"
https://lore.kernel.org/all/20230419005423.343862-1-irogers@google.com/

Next are some general and test improvements.

Next event parsing is rewritten to not scan all PMUs for the benefit
of raw and legacy cache parsing, instead these are handled by the
lexer and a new term type. This ultimately removes the need for the
event parser for hybrid to be recursive as legacy cache can be just a
term. Tests are re-enabled for events with hyphens, so AMD's
branch-brs event is now parsable.

The cputype option is made a generic pmu filter flag and is tested
even on non-hybrid systems.

The final patches address specific json metric issues on hybrid, in
both the json metrics and the metric code.

The patches add slightly more code than they remove, in areas like
better json metric constraints and tests, but in the core util code,
the removal of hybrid is a net reduction:
 20 files changed, 641 insertions(+), 960 deletions(-)

Sample output is contained in the v1 patch set:
https://lore.kernel.org/lkml/bff481ba-e60a-763f-0aa0-3ee53302c480@linux.intel.com/

Tested on Tigerlake, Skylake and Alderlake CPUs.

The v2 patch set:
 - restructures the 3 Linux 6.4 patches first;
 - makes it so that is_event_supported isn't called during core event parsing;
 - displays skippable 0 count events that were enabled;
 - addresses output formatting review comments;
 - addresses some test issues and an uninitialized variable use in strchr;
 - addresses checkpatch.pl reported issues;
 - adds reviewed-by to some patches.

Ian Rogers (43):
  perf stat: Disable TopdownL1 on hybrid
  perf stat: Introduce skippable evsels
  perf metric: Json flag to not group events if gathering a metric group
  perf vendor events intel: Add alderlake metric constraints
  perf vendor events intel: Add icelake metric constraints
  perf vendor events intel: Add icelakex metric constraints
  perf vendor events intel: Add sapphirerapids metric constraints
  perf vendor events intel: Add tigerlake metric constraints
  perf stat: Avoid segv on counter->name
  perf test: Test more sysfs events
  perf test: Use valid for PMU tests
  perf test: Mask config then test
  perf test: Test more with config_cache
  perf test: Roundtrip name, don't assume 1 event per name
  perf parse-events: Set attr.type to PMU type early
  perf parse-events: Set pmu_name whenever a pmu is given
  perf print-events: Avoid unnecessary strlist
  perf parse-events: Avoid scanning PMUs before parsing
  perf evsel: Modify group pmu name for software events
  perf test: Move x86 hybrid tests to arch/x86
  perf test x86 hybrid: Update test expectations
  perf parse-events: Support PMUs for legacy cache events
  perf parse-events: Wildcard legacy cache events
  perf print-events: Print legacy cache events for each PMU
  perf parse-events: Support wildcards on raw events
  perf parse-events: Remove now unused hybrid logic
  perf parse-events: Minor type safety cleanup
  perf parse-events: Add pmu filter
  perf stat: Make cputype filter generic
  perf test: Add cputype testing to perf stat
  perf test: Fix parse-events tests for >1 core PMU
  perf parse-events: Support hardware events as terms
  perf parse-events: Avoid error when assigning a term
  perf parse-events: Avoid error when assigning a legacy cache term
  perf parse-events: Don't auto merge hybrid wildcard events
  perf parse-events: Don't reorder atom cpu events
  perf metrics: Be PMU specific for referenced metrics.
  perf stat: Command line PMU metric filtering
  perf vendor events intel: Correct alderlake metrics
  perf jevents: Don't rewrite metrics across PMUs
  perf metrics: Be PMU specific in event match
  perf stat: Don't disable TopdownL1 metric on hybrid
  perf parse-events: Reduce scope of is_event_supported

 tools/perf/arch/x86/include/arch-tests.h      |   1 +
 tools/perf/arch/x86/tests/Build               |   1 +
 tools/perf/arch/x86/tests/arch-tests.c        |  10 +
 tools/perf/arch/x86/tests/hybrid.c            | 275 ++++++
 tools/perf/arch/x86/util/evlist.c             |   4 +-
 tools/perf/builtin-list.c                     |  19 +-
 tools/perf/builtin-record.c                   |  13 +-
 tools/perf/builtin-stat.c                     |  73 +-
 tools/perf/builtin-top.c                      |   5 +-
 tools/perf/builtin-trace.c                    |   5 +-
 .../arch/x86/alderlake/adl-metrics.json       | 275 +++---
 .../arch/x86/alderlaken/adln-metrics.json     |  20 +-
 .../arch/x86/broadwell/bdw-metrics.json       |  12 +
 .../arch/x86/broadwellde/bdwde-metrics.json   |  12 +
 .../arch/x86/broadwellx/bdx-metrics.json      |  12 +
 .../arch/x86/cascadelakex/clx-metrics.json    |  12 +
 .../arch/x86/haswell/hsw-metrics.json         |  12 +
 .../arch/x86/haswellx/hsx-metrics.json        |  12 +
 .../arch/x86/icelake/icl-metrics.json         |  23 +
 .../arch/x86/icelakex/icx-metrics.json        |  23 +
 .../arch/x86/ivybridge/ivb-metrics.json       |  12 +
 .../arch/x86/ivytown/ivt-metrics.json         |  12 +
 .../arch/x86/jaketown/jkt-metrics.json        |  12 +
 .../arch/x86/sandybridge/snb-metrics.json     |  12 +
 .../arch/x86/sapphirerapids/spr-metrics.json  |  23 +
 .../arch/x86/skylake/skl-metrics.json         |  12 +
 .../arch/x86/skylakex/skx-metrics.json        |  12 +
 .../arch/x86/tigerlake/tgl-metrics.json       |  23 +
 tools/perf/pmu-events/jevents.py              |  10 +-
 tools/perf/pmu-events/metric.py               |  28 +-
 tools/perf/pmu-events/metric_test.py          |   6 +-
 tools/perf/pmu-events/pmu-events.h            |   2 +
 tools/perf/tests/evsel-roundtrip-name.c       | 119 +--
 tools/perf/tests/parse-events.c               | 836 +++++++++---------
 tools/perf/tests/pmu-events.c                 |  12 +-
 tools/perf/tests/shell/stat.sh                |  44 +
 tools/perf/util/Build                         |   1 -
 tools/perf/util/evlist.h                      |   1 -
 tools/perf/util/evsel.c                       |  30 +-
 tools/perf/util/evsel.h                       |   1 +
 tools/perf/util/metricgroup.c                 | 111 ++-
 tools/perf/util/metricgroup.h                 |   3 +-
 tools/perf/util/parse-events-hybrid.c         | 214 -----
 tools/perf/util/parse-events-hybrid.h         |  25 -
 tools/perf/util/parse-events.c                | 697 ++++++---------
 tools/perf/util/parse-events.h                |  63 +-
 tools/perf/util/parse-events.l                | 108 +--
 tools/perf/util/parse-events.y                | 222 ++---
 tools/perf/util/pmu-hybrid.c                  |  20 -
 tools/perf/util/pmu-hybrid.h                  |   1 -
 tools/perf/util/pmu.c                         |  16 +-
 tools/perf/util/pmu.h                         |   3 +
 tools/perf/util/pmus.c                        |  25 +-
 tools/perf/util/pmus.h                        |   3 +
 tools/perf/util/print-events.c                | 124 ++-
 tools/perf/util/stat-display.c                |  13 +-
 56 files changed, 2000 insertions(+), 1675 deletions(-)
 create mode 100644 tools/perf/arch/x86/tests/hybrid.c
 delete mode 100644 tools/perf/util/parse-events-hybrid.c
 delete mode 100644 tools/perf/util/parse-events-hybrid.h

-- 
2.40.1.495.gc816e09b53d-goog


^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2023-04-29  1:20 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-28  7:37 [PATCH v2 00/43] Fix perf on Intel hybrid CPUs Ian Rogers
2023-04-28  7:37 ` [PATCH v2 01/43] perf stat: Disable TopdownL1 on hybrid Ian Rogers
2023-04-28 13:31   ` Liang, Kan
2023-04-29  1:17     ` Arnaldo Carvalho de Melo
2023-04-28  7:37 ` [PATCH v2 02/43] perf stat: Introduce skippable evsels Ian Rogers
2023-04-28 13:30   ` Liang, Kan
2023-04-28  7:37 ` [PATCH v2 04/43] perf vendor events intel: Add alderlake metric constraints Ian Rogers
2023-04-28  7:37 ` [PATCH v2 05/43] perf vendor events intel: Add icelake " Ian Rogers
2023-04-28  7:37 ` [PATCH v2 06/43] perf vendor events intel: Add icelakex " Ian Rogers
2023-04-28  7:37 ` [PATCH v2 07/43] perf vendor events intel: Add sapphirerapids " Ian Rogers
2023-04-28  7:37 ` [PATCH v2 08/43] perf vendor events intel: Add tigerlake " Ian Rogers
2023-04-28  7:37 ` [PATCH v2 09/43] perf stat: Avoid segv on counter->name Ian Rogers
2023-04-29  1:20   ` Arnaldo Carvalho de Melo
2023-04-28  7:37 ` [PATCH v2 10/43] perf test: Test more sysfs events Ian Rogers
2023-04-28  7:37 ` [PATCH v2 11/43] perf test: Use valid for PMU tests Ian Rogers
2023-04-28  7:37 ` [PATCH v2 12/43] perf test: Mask config then test Ian Rogers
2023-04-28  7:37 ` [PATCH v2 13/43] perf test: Test more with config_cache Ian Rogers
2023-04-28  7:37 ` [PATCH v2 14/43] perf test: Roundtrip name, don't assume 1 event per name Ian Rogers
2023-04-28  7:37 ` [PATCH v2 15/43] perf parse-events: Set attr.type to PMU type early Ian Rogers
2023-04-28  7:37 ` [PATCH v2 16/43] perf parse-events: Set pmu_name whenever a pmu is given Ian Rogers
2023-04-28  7:37 ` [PATCH v2 17/43] perf print-events: Avoid unnecessary strlist Ian Rogers
2023-04-28  7:37 ` [PATCH v2 18/43] perf parse-events: Avoid scanning PMUs before parsing Ian Rogers
2023-04-28  7:37 ` [PATCH v2 19/43] perf evsel: Modify group pmu name for software events Ian Rogers
2023-04-28  7:37 ` [PATCH v2 20/43] perf test: Move x86 hybrid tests to arch/x86 Ian Rogers
2023-04-28 13:35   ` Liang, Kan
2023-04-28 13:46     ` Liang, Kan
2023-04-28  7:37 ` [PATCH v2 21/43] perf test x86 hybrid: Update test expectations Ian Rogers
2023-04-28 13:57   ` Liang, Kan
2023-04-28  7:37 ` [PATCH v2 22/43] perf parse-events: Support PMUs for legacy cache events Ian Rogers
2023-04-28  7:37 ` [PATCH v2 23/43] perf parse-events: Wildcard " Ian Rogers
2023-04-28  7:37 ` [PATCH v2 24/43] perf print-events: Print legacy cache events for each PMU Ian Rogers
2023-04-28  7:37 ` [PATCH v2 25/43] perf parse-events: Support wildcards on raw events Ian Rogers
2023-04-28  7:37 ` [PATCH v2 26/43] perf parse-events: Remove now unused hybrid logic Ian Rogers
2023-04-28  7:37 ` [PATCH v2 27/43] perf parse-events: Minor type safety cleanup Ian Rogers
2023-04-28  7:37 ` [PATCH v2 28/43] perf parse-events: Add pmu filter Ian Rogers
2023-04-28  7:37 ` [PATCH v2 29/43] perf stat: Make cputype filter generic Ian Rogers
2023-04-28  7:37 ` [PATCH v2 30/43] perf test: Add cputype testing to perf stat Ian Rogers
2023-04-28  7:37 ` [PATCH v2 31/43] perf test: Fix parse-events tests for >1 core PMU Ian Rogers
2023-04-28  7:37 ` [PATCH v2 32/43] perf parse-events: Support hardware events as terms Ian Rogers
2023-04-28  7:37 ` [PATCH v2 33/43] perf parse-events: Avoid error when assigning a term Ian Rogers
2023-04-28  7:38 ` [PATCH v2 34/43] perf parse-events: Avoid error when assigning a legacy cache term Ian Rogers
2023-04-28  7:38 ` [PATCH v2 35/43] perf parse-events: Don't auto merge hybrid wildcard events Ian Rogers
2023-04-28  7:38 ` [PATCH v2 36/43] perf parse-events: Don't reorder atom cpu events Ian Rogers
2023-04-28  7:38 ` [PATCH v2 37/43] perf metrics: Be PMU specific for referenced metrics Ian Rogers
2023-04-28  7:38 ` [PATCH v2 38/43] perf stat: Command line PMU metric filtering Ian Rogers
2023-04-28  7:38 ` [PATCH v2 39/43] perf vendor events intel: Correct alderlake metrics Ian Rogers
2023-04-28  7:38 ` [PATCH v2 40/43] perf jevents: Don't rewrite metrics across PMUs Ian Rogers
2023-04-28  7:38 ` [PATCH v2 41/43] perf metrics: Be PMU specific in event match Ian Rogers
2023-04-28  7:38 ` [PATCH v2 42/43] perf stat: Don't disable TopdownL1 metric on hybrid Ian Rogers
2023-04-28  7:38 ` [PATCH v2 43/43] perf parse-events: Reduce scope of is_event_supported Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).