Skip to content

perf: Fix the throttle logic for group

[email protected] bpf linux-alpha linux-csky linux-mips linux-perf-users linux-s390 linux-snps-arc linuxppc-dev lkml loongarch sparclinux 4 versions – Applied

Status from this message: The following commit has been merged into the perf/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest16 patches 17 repliesApplied
  2. v316 patches 6 repliesApplied
  3. v215 patches 10 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC15 patches9 repliesSuperseded

Changes in v4 from the cover letter

- Add a new patch to only dump the throttle log for the leader
- Apply the perf_event_unthrottle() in event_sched_in() as well
- Not include the cleanup patch since it has been merged
- Add Acked-by from Vineet

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/16perf: Fix the throttle logic for a groupkernel/events/core.c+46 -2010 replies
2/16perf: Only dump the throttle log for the leaderkernel/events/core.c+4 -23 replies
3/16perf/x86/intel: Remove driver-specific throttle supportarch/x86/events/core.c arch/x86/events/intel/core.c arch/x86/events/intel/ds.c +2 more+8 -140 replies
4/16perf/x86/amd: Remove driver-specific throttle supportarch/x86/events/amd/core.c arch/x86/events/amd/ibs.c+2 -50 replies
5/16perf/x86/zhaoxin: Remove driver-specific throttle supportarch/x86/events/zhaoxin/core.c+1 -20 replies
6/16powerpc/perf: Remove driver-specific throttle supportarch/powerpc/perf/core-book3s.c arch/powerpc/perf/core-fsl-emb.c+3 -60 replies
7/16s390/perf: Remove driver-specific throttle supportarch/s390/kernel/perf_cpum_cf.c arch/s390/kernel/perf_cpum_sf.c+1 -64 replies
8/16perf/arm: Remove driver-specific throttle supportdrivers/perf/arm_pmuv3.c drivers/perf/arm_v6_pmu.c drivers/perf/arm_v7_pmu.c +1 more+5 -100 replies
9/16perf/apple_m1: Remove driver-specific throttle supportdrivers/perf/apple_m1_cpu_pmu.c+1 -20 replies
10/16alpha/perf: Remove driver-specific throttle supportarch/alpha/kernel/perf_event.c+3 -80 replies
11/16arc/perf: Remove driver-specific throttle supportarch/arc/kernel/perf_event.c+2 -40 replies
12/16csky/perf: Remove driver-specific throttle supportarch/csky/kernel/perf_event.c+1 -20 replies
13/16loongarch/perf: Remove driver-specific throttle supportarch/loongarch/kernel/perf_event.c+1 -20 replies
14/16sparc/perf: Remove driver-specific throttle supportarch/sparc/kernel/perf_event.c+1 -20 replies
15/16xtensa/perf: Remove driver-specific throttle supportarch/xtensa/kernel/perf_event.c+1 -20 replies
16/16mips/perf: Remove driver-specific throttle supportarch/mips/kernel/perf_event_mipsxx.c+1 -20 replies

Reviews trailers per patch

6 of 16 patches have a Reviewed-by or Acked-by.

PatchRavi BangoriaVineet GuptaThomas RichterLeo YanGuo RenMax FilippovNamhyung KimAlexei StarovoitovSumanth Korikkar
1/16A-b T-b
2/16A-b
3/16
4/16R-b
5/16
6/16
7/16T-b T-b
8/16T-b
9/16
10/16
11/16A-b
12/16A-b
13/16
14/16
15/16R-b
16/16

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 9 reviewers.

Read the v4 thread

Cover letter [PATCH V4 00/16] perf: Fix the throttle logic for group

From: Kan Liang <[email protected]>

Changes since V3:
- Add a new patch to only dump the throttle log for the leader
- Apply the perf_event_unthrottle() in event_sched_in() as well
- Not include the cleanup patch since it has been merged
- Add Acked-by from Vineet

Changes since V2:
- Add a cleanup patch to check if an event is in freq mode
- Rename the parameter of the perf_event_unthrottle_group()
- Add Tested-by from Leo and Thomas
- Add Acked-by from Guo Ren

Changes since V1:
- Apply the suggested throttle/unthrottle functions from Peter. The MAX_INTERRUPTS and throttle logs are applied to all events.
- Update the description and comments accordingly
- Add Reviewed-by from Ravi and Max

The sampling read doesn't work well with a group.
The issue was originally found by the 'Basic leader sampling test' case failed on s390.
https://lore.kernel.org/all/[email protected]/

Stephane debugged it and found it was caused by the throttling logic.
https://lore.kernel.org/all/CABPqkBQzCMNS_PfLZBWVuX9o8Z55PovwJvpVWMWzyeExFJ5R4Q@mail.gmail.com/

The throttle logic is generic and shared by all ARCHs. It also impacts other ARCHs, e.g., X86.

On an Intel GNR machine,

$ perf record -e "{cycles,cycles}:S" ...
$ perf report -D | grep THROTTLE | tail -2
            THROTTLE events:        426  ( 9.0%)
          UNTHROTTLE events:        425  ( 9.0%)
$ perf report -D | grep PERF_RECORD_SAMPLE -a4 | tail -n 5
0 1020120874009167 0x74970 [0x68]: PERF_RECORD_SAMPLE(IP, 0x1):
... sample_read:
.... group nr 2
..... id 0000000000000327, value 000000000cbb993a, lost 0
..... id 0000000000000328, value 00000002211c26df, lost 0

The patch set tries to provide a generic fix for the group throttle support. So the buggy driver-specific implementation can be removed.

The patch set is verified on newer Intel platforms (Kan), ARM (Leo Yan), and s390 (Thomas Richter).

Kan Liang (16):
perf: Fix the throttle logic for a group
perf: Only dump the throttle log for the leader perf/x86/intel: Remove driver-specific throttle support perf/x86/amd: Remove driver-specific throttle support perf/x86/zhaoxin: Remove driver-specific throttle support powerpc/perf: Remove driver-specific throttle support s390/perf: Remove driver-specific throttle support perf/arm: Remove driver-specific throttle support perf/apple_m1: Remove driver-specific throttle support alpha/perf: Remove driver-specific throttle support arc/perf: Remove driver-specific throttle support csky/perf: Remove driver-specific throttle support loongarch/perf: Remove driver-specific throttle support sparc/perf: Remove driver-specific throttle support xtensa/perf: Remove driver-specific throttle support mips/perf: Remove driver-specific throttle support

 arch/alpha/kernel/perf_event.c       | 11 ++---
 arch/arc/kernel/perf_event.c         |  6 +--
 arch/csky/kernel/perf_event.c        |  3 +-
 arch/loongarch/kernel/perf_event.c   |  3 +-
 arch/mips/kernel/perf_event_mipsxx.c |  3 +-
 arch/powerpc/perf/core-book3s.c      |  6 +--
 arch/powerpc/perf/core-fsl-emb.c     |  3 +-
 arch/s390/kernel/perf_cpum_cf.c      |  2 -
 arch/s390/kernel/perf_cpum_sf.c      |  5 +-
 arch/sparc/kernel/perf_event.c       |  3 +-
 arch/x86/events/amd/core.c           |  3 +-
 arch/x86/events/amd/ibs.c            |  4 +-
 arch/x86/events/core.c               |  3 +-
 arch/x86/events/intel/core.c         |  6 +--
 arch/x86/events/intel/ds.c           |  7 ++-
 arch/x86/events/intel/knc.c          |  3 +-
 arch/x86/events/intel/p4.c           |  3 +-
 arch/x86/events/zhaoxin/core.c       |  3 +-
 arch/xtensa/kernel/perf_event.c      |  3 +-
 drivers/perf/apple_m1_cpu_pmu.c      |  3 +-
 drivers/perf/arm_pmuv3.c             |  3 +-
 drivers/perf/arm_v6_pmu.c            |  3 +-
 drivers/perf/arm_v7_pmu.c            |  3 +-
 drivers/perf/arm_xscale_pmu.c        |  6 +--
 kernel/events/core.c                 | 68 ++++++++++++++++++++--------
 25 files changed, 79 insertions(+), 87 deletions(-)
Signature · 1 line
2.38.1