Page MenuHomeFreeBSD

tools/regression/pmc: hwpmc grouping regression test
Needs ReviewPublic

Authored by raghavendra.kt_amd.com on Jun 18 2026, 7:06 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Aug 15, 9:10 AM
Unknown Object (File)
Wed, Aug 12, 8:16 PM
Unknown Object (File)
Wed, Aug 12, 12:49 AM
Unknown Object (File)
Mon, Aug 10, 9:40 AM
Unknown Object (File)
Mon, Aug 10, 6:05 AM
Unknown Object (File)
Sun, Aug 9, 7:58 PM
Unknown Object (File)
Sun, Aug 9, 1:35 PM
Unknown Object (File)
Sun, Aug 9, 12:51 PM
Subscribers
None

Details

Summary

Self-contained regression test for the grouping-only paths:

  • allocate two deferred PMCs, group them, commit, attach, start, stop, read, release;
  • all-or-none semantics: build a 4-event group on a 6-counter Zen, expect commit to succeed; build a (cores+1)-event group, expect ENOSPC;
  • row exclusivity: assigner gives each sibling a distinct global ri.

The probe_core_pmcs() helper allocates "instructions" counters until
EBUSY/EAGAIN to discover the actual core-PMC count at run time
(pmc_npmc(0) returns the sum across classes -- e.g., 47 on Zen5 --
which is wrong for sizing CORE-class group tests). Every sibling is
also explicitly pmc_attach()-ed before pmc_start(), now mandatory
under multiplexing semantics.

A companion pmcstat_test.sh exercises the pmcstat(8) -b / {a,b,c}
brace syntax end to end (basic group, two groups, system mode,
sampling, single-element brace, mixed grouped/ungrouped, malformed
brace, and an over-subscribed multiplex group). The regression
Makefile invokes it from "make check-root" when present.

The C test is x86-only (PMC_CLASS_K8) and skips itself politely on
hosts that do not have AMD core PMCs; the shell test SKIPs on
non-AMD CPUs.

Sponsored by: AMD
Signed-off-by: Raghavendra K T <raghavendra.kt@amd.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73966
Build 70849: arc lint + arc unit