Skip to content

Fixes for Intel TMA, particularly for hybrid

Ian Rogers linux-perf-users lkml 3 versions – Applied

Status from this message: Applied to perf-tools-next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest15 patches 2 repliesApplied
  2. v212 patches 1 replySuperseded
  3. v112 patches 9 repliesSuperseded

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/15perf parse-events: Warn if a cpu term is unsupported by a CPUtools/perf/util/evlist.c tools/perf/util/evsel.c tools/perf/util/evsel.h +1 more+35 -180 replies
2/15perf stat: Avoid buffer overflow to the aggregation maptools/perf/builtin-stat.c+1 -10 replies
3/15perf stat: Don't size aggregation ids from user_requested_cpustools/perf/builtin-stat.c+2 -50 replies
4/15perf parse-events: Allow the cpu term to be a PMU or CPU rangetools/perf/Documentation/perf-list.txt tools/perf/util/parse-events.c+54 -180 replies
5/15perf tool_pmu: Allow num_cpus(_online) to be specific to a cpumasktools/perf/util/expr.c tools/perf/util/tool_pmu.c tools/perf/util/tool_pmu.h+51 -90 replies
6/15libperf evsel: Rename own_cpus to pmu_cpustools/lib/perf/evlist.c tools/lib/perf/evsel.c tools/lib/perf/include/internal/evsel.h +6 more+22 -220 replies
7/15libperf evsel: Factor perf_evsel__exit out of perf_evsel__deletetools/lib/perf/evsel.c tools/lib/perf/include/internal/evsel.h+7 -10 replies
8/15perf evsel: Use libperf perf_evsel__exittools/perf/util/evsel.c+1 -30 replies
9/15perf pmus: Factor perf_pmus__find_by_attr out of evsel__find_pmutools/perf/util/pmus.c tools/perf/util/pmus.h+19 -120 replies
10/15perf parse-events: Minor __add_event refactoringtools/perf/util/parse-events.c+48 -210 replies
11/15perf evsel: Add evsel__open_per_cpu_and_threadtools/perf/util/evsel.c tools/perf/util/evsel.h+22 -40 replies
12/15perf parse-events: Support user CPUs mixed with threads/processestools/lib/perf/evlist.c tools/perf/util/parse-events.c tools/perf/util/stat.c+87 -481 reply
13/15perf topdown: Use attribute to see an event is a topdown metic or slotstools/perf/arch/x86/include/arch-tests.h tools/perf/arch/x86/tests/Build tools/perf/arch/x86/tests/arch-tests.c +4 more+108 -550 replies
14/15perf parse-events: Fix missing slots for Intel topdown metric eventstools/perf/arch/x86/util/evlist.c tools/perf/arch/x86/util/topdown.c tools/perf/arch/x86/util/topdown.h +3 more+77 -120 replies
15/15perf metricgroups: Add NO_THRESHOLD_AND_NMI constrainttools/perf/pmu-events/jevents.py tools/perf/pmu-events/pmu-events.h tools/perf/util/metricgroup.c+23 -80 replies

Reviews trailers per patch

12 of 15 patches have a Reviewed-by or Acked-by.

PatchThomas Falcon
1/15R-b
2/15R-b
3/15R-b
4/15R-b
5/15R-b
6/15R-b
7/15R-b
8/15R-b
9/15R-b
10/15R-b
11/15R-b
12/15R-b
13/15
14/15
15/15

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/15] Fixes for Intel TMA, particularly for hybrid

On hybrid systems some PMUs apply to all core types, particularly for metrics the msr PMU and the tsc event. The metrics often only want the values of the counter for their specific core type. These patches allow the cpu term in an event to give a PMU name to take the cpumask from. For example:

  $ perf stat -e msr/tsc,cpu=cpu_atom/ ...

will aggregate the msr/tsc/ value but only for atom cores. In doing this problems were identified in how cpumasks are handled by parsing and event setup when cpumasks are specified along with a task to profile. The event parsing, cpumask evlist propagation code and perf stat code are updated accordingly.

The final result of the patch series is to be able to run:

```
$ perf stat --no-scale -e 'msr/tsc/,msr/tsc,cpu=cpu_core/,msr/tsc,cpu=cpu_atom/' perf test -F 10
 10.1: Basic parsing test                                            : Ok
 10.2: Parsing without PMU name                                      : Ok
 10.3: Parsing with PMU name                                         : Ok

 Performance counter stats for 'perf test -F 10':

        63,704,975      msr/tsc/
        47,060,704      msr/tsc,cpu=cpu_core/                        (4.62%)
        16,640,591      msr/tsc,cpu=cpu_atom/                        (2.18%)
```

This has (further) identified a kernel bug for task events around the enabled time being too large leading to invalid scaling (hence the
--no-scale in the command line above).

Additionally the series corrects topdown event processing and starts injecting slots events as preparation for TMA 5.1 whose updates will be sent as a follow-up patch series.

v3: Fix CPU map computation for uncore/requires_cpu, don't simplify
for the "any"(-1) CPU case. Combine with topdown slots/fix and injection previously:
https://lore.kernel.org/lkml/[email protected]/
This has a grouping fix added for the injected slots event. Add new no grouping constraint for threshold + NMI for issue with alderlake metrics failing to schedule when thresholds are enabled along with the NMI watchdog.

v2: Add additional documentation of the cpu term to perf list
(Namhyung), extend the term to also allow CPU ranges. Add Thomas Falcon's reviewed-by. Still open for discussion whether the term cpu should have >1 variant for PMUs, etc. or whether the single term is okay. We could refactor later and add a term, but that would break existing users, but they are most likely to be metrics so probably not a huge issue.

Ian Rogers (15):
perf parse-events: Warn if a cpu term is unsupported by a CPU perf stat: Avoid buffer overflow to the aggregation map perf stat: Don't size aggregation ids from user_requested_cpus perf parse-events: Allow the cpu term to be a PMU or CPU range perf tool_pmu: Allow num_cpus(_online) to be specific to a cpumask libperf evsel: Rename own_cpus to pmu_cpus
libperf evsel: Factor perf_evsel__exit out of perf_evsel__delete perf evsel: Use libperf perf_evsel__exit
perf pmus: Factor perf_pmus__find_by_attr out of evsel__find_pmu perf parse-events: Minor __add_event refactoring
perf evsel: Add evsel__open_per_cpu_and_thread
perf parse-events: Support user CPUs mixed with threads/processes perf topdown: Use attribute to see an event is a topdown metic or
slots
perf parse-events: Fix missing slots for Intel topdown metric events perf metricgroups: Add NO_THRESHOLD_AND_NMI constraint

 tools/lib/perf/evlist.c                  | 119 +++++++++++++++-------
 tools/lib/perf/evsel.c                   |   9 +-
 tools/lib/perf/include/internal/evsel.h  |   3 +-
 tools/perf/Documentation/perf-list.txt   |  25 +++--
 tools/perf/arch/x86/include/arch-tests.h |   4 +
 tools/perf/arch/x86/tests/Build          |   1 +
 tools/perf/arch/x86/tests/arch-tests.c   |   1 +
 tools/perf/arch/x86/tests/topdown.c      |  76 ++++++++++++++
 tools/perf/arch/x86/util/evlist.c        |  24 +++++
 tools/perf/arch/x86/util/evsel.c         |  46 +++------
 tools/perf/arch/x86/util/topdown.c       |  59 +++++++----
 tools/perf/arch/x86/util/topdown.h       |   6 ++
 tools/perf/builtin-stat.c                |   9 +-
 tools/perf/pmu-events/jevents.py         |   1 +
 tools/perf/pmu-events/pmu-events.h       |  14 ++-
 tools/perf/tests/event_update.c          |   4 +-
 tools/perf/tests/parse-events.c          |  24 ++---
 tools/perf/util/evlist.c                 |  15 +--
 tools/perf/util/evlist.h                 |   1 +
 tools/perf/util/evsel.c                  |  55 ++++++++--
 tools/perf/util/evsel.h                  |   5 +
 tools/perf/util/expr.c                   |   2 +-
 tools/perf/util/header.c                 |   4 +-
 tools/perf/util/metricgroup.c            |  16 ++-
 tools/perf/util/parse-events.c           | 122 ++++++++++++++++++-----
 tools/perf/util/pmus.c                   |  29 +++---
 tools/perf/util/pmus.h                   |   2 +
 tools/perf/util/stat.c                   |   6 +-
 tools/perf/util/synthetic-events.c       |   4 +-
 tools/perf/util/tool_pmu.c               |  56 +++++++++--
 tools/perf/util/tool_pmu.h               |   2 +-
 31 files changed, 532 insertions(+), 212 deletions(-)
 create mode 100644 tools/perf/arch/x86/tests/topdown.c
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog