Skip to content

perf/amd/ibs: Fix sample period computations

Ravi Bangoria linux-perf-users lkml 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 Latest9 patches 2 repliesApplied
  2. v310 patches 5 repliesSuperseded
  3. v210 patches 8 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v18 patches10 repliesSuperseded

Changes in v4 from the cover letter

- No need to add pmu->adjust_period() callback. Adjust sample_period within IBS driver itself.
- Fix perf IBS period test when sampling freq is more than perf_event_max_sample_rate.
- Add unit test with sample_period beyond IBS PMU supported max period.
- Fix i386 perf tool build failure.
- Patch to introduce DEFINE_SUITE_EXCLUSIVE() is already picked up by Arnaldo and is in the perf-tools-next/perf-tools-next. So remove it from the series.

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/9perf/amd/ibs: Remove IBS_{FETCH|OP}_CONFIG_MASK macrosarch/x86/events/amd/ibs.c+2 -50 replies
2/9perf/amd/ibs: Remove pointless sample period checkarch/x86/events/amd/ibs.c+2 -70 replies
3/9perf/amd/ibs: Fix ->config to sample period calculation for OP PMUarch/x86/events/amd/ibs.c+13 -40 replies
4/9perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCntarch/x86/events/amd/ibs.c arch/x86/include/asm/perf_event.h+3 -10 replies
5/9perf/amd/ibs: Don't allow freq mode event creation through ->config interfacearch/x86/events/amd/ibs.c+3 -02 replies
6/9perf/amd/ibs: Add PMU specific minimum periodarch/x86/events/amd/ibs.c+16 -80 replies
7/9perf/amd/ibs: Add ->check_period() callbackarch/x86/events/amd/ibs.c+24 -00 replies
8/9perf/amd/ibs: Ceil sample_period to min_periodarch/x86/events/amd/ibs.c+7 -00 replies
9/9perf test amd ibs: Add sample period unit testtools/perf/arch/x86/include/arch-tests.h tools/perf/arch/x86/tests/Build tools/perf/arch/x86/tests/amd-ibs-period.c +1 more+955 -00 replies

Reviews trailers per patch

7 of 9 patches have a Reviewed-by or Acked-by.

PatchNamhyung Kim
1/9A-b
2/9A-b
3/9A-b
4/9A-b
5/9A-b
6/9A-b
7/9A-b
8/9
9/9

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

Read the v4 thread

Cover letter [PATCH v4 0/9] perf/amd/ibs: Fix sample period computations

IBS Fetch and IBS Op PMUs have constraints on supported sample period values. The IBS hw behavior could be undefined if they are not followed. Currently, IBS driver does not honor them correctly and thus a malicious event could cause issues to the system. Fortunately, the IBS hw is very resilient so far and IBS PMUs are restricted to root only, so the attack vector is minimal. In any case, these are genuine bugs and must be fixed.

Patches are prepared on tip/perf/core (b709eb872e19) with 4cd67bac9d4e ("perf test: Introduce DEFINE_SUITE_EXCLUSIVE().") cherry-picked from perf-tools-next/perf-tools-next.

v3: https://lore.kernel.org/r/[email protected]
v3->v4:
- No need to add pmu->adjust_period() callback. Adjust sample_period within IBS driver itself.
- Fix perf IBS period test when sampling freq is more than perf_event_max_sample_rate.
- Add unit test with sample_period beyond IBS PMU supported max period.
- Fix i386 perf tool build failure.
- Patch to introduce DEFINE_SUITE_EXCLUSIVE() is already picked up by Arnaldo and is in the perf-tools-next/perf-tools-next. So remove it from the series.

Ravi Bangoria (9):
perf/amd/ibs: Remove IBS_{FETCH|OP}_CONFIG_MASK macros perf/amd/ibs: Remove pointless sample period check perf/amd/ibs: Fix ->config to sample period calculation for OP PMU perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt perf/amd/ibs: Don't allow freq mode event creation through ->config
interface
perf/amd/ibs: Add PMU specific minimum period perf/amd/ibs: Add ->check_period() callback perf/amd/ibs: Ceil sample_period to min_period
perf test amd ibs: Add sample period unit test

 arch/x86/events/amd/ibs.c                  |  92 +-
 arch/x86/include/asm/perf_event.h          |   1 +
 tools/perf/arch/x86/include/arch-tests.h   |   1 +
 tools/perf/arch/x86/tests/Build            |   1 +
 tools/perf/arch/x86/tests/amd-ibs-period.c | 951 +++++++++++++++++++++
 tools/perf/arch/x86/tests/arch-tests.c     |   2 +
 6 files changed, 1024 insertions(+), 24 deletions(-)
 create mode 100644 tools/perf/arch/x86/tests/amd-ibs-period.c
Signature · 1 line
2.43.0