Add an ATF test suite for AMD Performance Monitoring Counter (PMC)
features exposed by hwpmc(4) on amd64.
The suite is organized under tests/sys/amd/pmc/ and covers:
hwpmc_exterr_test -- extended error propagation for PMCALLOCATE,
PMCATTACH and PMCRW ioctls (AMD K8 and IBS)
hwpmc_pidtrack_test -- per-process PMC lifecycle: context-switch
save/restore, no-leakage across siblings,
live self-read semantics
hwpmc_callchain_ur_test -- PMC_UR callchain regression (rGaf3929c5152b,
rG66118c3f1011)
pmu_detect_test -- AMD vendor check, hwpmc init, PMC_CLASS_K8,
Zen-generation pool sizing
pmu_event_test -- pmu-events table lookup, evsel/umask encoding
including EventSelect[11:8] for Zen4+,
end-to-end counter read
pmu_event_neg_test -- rejection of reserved bits, guest/host bits,
PRECISERETIRE without capability
pmu_mux_test -- slot count from CPUID Fn80000022 at runtime,
fill/over-allocate/reuse
pmu_cross_class_alloc_test -- simultaneous K8+RAPL allocation
rapl_test -- PMC_CLASS_RAPL: detect, PKG/CORES delta
under load, 30-sample monotonicity, DRAM
and process-mode rejection on AMD
pmcstat_tsc_test -- pmcstat TSC column format and flamegraph
pmcstat_grouping_test -- system-event grouping; AMD core runtime
tests opt-in via amd.pmc.grouping.runtime=true
pmcstat_ibs_errata_test -- IBS errata #1238 suppression (Zen 3 B0)
pmcstat_group_alloc_atomicity_test -- concurrent process allocations
pmc_cli_smoke_test -- pmc(8) frontend: record, info, IBS traceShared helpers included in this diff:
amd_pmc_test_common.h -- CPUID vendor check, skip guards, pmc_release
wrapper; used by all ATF-C programs
tests/sys/amd/umcdf/amd_umcdf_decode.h, amd_umcdf_common.h --
CPU generation detection and skip helpers
(also used by the follow-on umcdf suite)tests/sys/Makefile is modified to wire tests/sys/amd/ into the build
via _amd, following the _pmc/_audit pattern, restricted to amd64.
All test cases pass or skip with documented reasons on AMD EPYC 9654
(Zen 4, 192 logical CPUs) running FreeBSD 16.0-CURRENT with hwpmc(4).
Result: 70/79 passed, 0 failed, 9 skipped.
Expected skips:
- PMC_CLASS_PERF (APERF/MPERF): requires a follow-on hwpmc diff
- pmcstat grouping process tests: opt-in via amd.pmc.grouping.runtime
- IBS Zen3 B0 errata test: skip on non-affected CPUIDs
The following programs are present in the source tree but excluded from
this diff and submitted separately:
hwpmc_aperf_mperf_test -- requires PMC_CLASS_PERF hwpmc_grouping_test -- requires PerfMonV2/grouping kernel structs hwpmc_group_api_test -- same pmu_perfmonv2_test -- same pmcstat_batch_grouping_test -- requires pmcstat -b
Tested on: amd64 (EPYC 9654, Zen 4, 192 logical CPUs)
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com>