Page MenuHomeFreeBSD

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

Authored by afscoelho_gmail.com on Jun 18 2026, 7:06 AM.
Tags
None
Referenced Files
F175253693: D57638.diff
Fri, Oct 9, 11:15 AM
Unknown Object (File)
Wed, Oct 7, 6:37 PM
Unknown Object (File)
Wed, Oct 7, 2:59 AM
Unknown Object (File)
Wed, Oct 7, 1:29 AM
Unknown Object (File)
Tue, Oct 6, 7:53 PM
Unknown Object (File)
Tue, Oct 6, 1:35 PM
Unknown Object (File)
Tue, Oct 6, 7:24 AM
Unknown Object (File)
Mon, Oct 5, 10:49 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 77548
Build 74431: arc lint + arc unit

Event Timeline

afscoelho_gmail.com updated this revision to Diff 185752.

Update to the rebuilt PerfMonV2 grouping and multiplexing stack.

Rebase on main (D60141 and D60185 are committed). No change.