[PATCH v2 00/10] perf/amd/ibs: Fix sample period computations

Ravi Bangoria posted 10 patches 1 year ago
There is a newer version of this series
arch/x86/events/amd/ibs.c                  |  97 ++-
arch/x86/include/asm/perf_event.h          |   1 +
include/linux/perf_event.h                 |   5 +
kernel/events/core.c                       |  12 +-
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 | 953 +++++++++++++++++++++
tools/perf/arch/x86/tests/arch-tests.c     |   2 +
tools/perf/tests/tests.h                   |  10 +
9 files changed, 1055 insertions(+), 27 deletions(-)
create mode 100644 tools/perf/arch/x86/tests/amd-ibs-period.c
[PATCH v2 00/10] perf/amd/ibs: Fix sample period computations
Posted by Ravi Bangoria 1 year ago
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 rebased to peterz/queue/perf/core (f7372965c41d).

v1: https://lore.kernel.org/r/20241007034810.754-1-ravi.bangoria@amd.com
v1->v2:
- Patch #1 to #8: No code changes. Include Acked-by from Namhyung.
- Patch #9 and #10: Add perf test to test IBS pmus with various valid
  and invalid sample periods.

Ravi Bangoria (10):
  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/core: Introduce pmu->adjust_period() callback
  perf test: Introduce DEFINE_SUITE_EXCLUSIVE()
  perf test amd ibs: Add sample period unit test

 arch/x86/events/amd/ibs.c                  |  97 ++-
 arch/x86/include/asm/perf_event.h          |   1 +
 include/linux/perf_event.h                 |   5 +
 kernel/events/core.c                       |  12 +-
 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 | 953 +++++++++++++++++++++
 tools/perf/arch/x86/tests/arch-tests.c     |   2 +
 tools/perf/tests/tests.h                   |  10 +
 9 files changed, 1055 insertions(+), 27 deletions(-)
 create mode 100644 tools/perf/arch/x86/tests/amd-ibs-period.c

-- 
2.47.0