HomeFreeBSD

hwpmc: add regression tests for counting-PMC counter wraparound

Description

hwpmc: add regression tests for counting-PMC counter wraparound

Exercise a process-mode counting PMC whose accumulated count crosses,
or already exceeds, the range of the underlying hardware counter.
Before the previous commit, the first context switch after the
hardware counter wrapped panicked INVARIANTS kernels with "negative
increment" and silently corrupted the accumulated count on other
kernels.

The tests need a hardware counting event backed by a counter narrower
than 64 bits and skip where none is available (hwpmc(4) not loaded,
or a VM without a vPMU).

Reviewed by: adrian
MFC after: 2 weeks
Assisted-by: Claude Code (Fable 5)
Differential Revision: https://reviews.freebsd.org/D58341

Details

Provenance
netchildAuthored on Jul 19 2026, 8:08 AM
Reviewer
adrian
Differential Revision
D58341: hwpmc: add regression tests for counting-PMC counter wraparound
Parents
rGe42703f5c4b2: hwpmc: handle counter wraparound for process-mode counting PMCs
Branches
Unknown
Tags
Unknown