Page MenuHomeFreeBSD

hwpmc: add regression tests for counting-PMC counter wraparound
ClosedPublic

Authored by netchild on Jul 19 2026, 12:15 PM.
Tags
Referenced Files
Unknown Object (File)
Fri, Aug 28, 8:01 AM
Unknown Object (File)
Fri, Aug 28, 8:00 AM
Unknown Object (File)
Fri, Aug 28, 8:00 AM
Unknown Object (File)
Fri, Aug 28, 12:00 AM
Unknown Object (File)
Fri, Aug 28, 12:00 AM
Unknown Object (File)
Thu, Aug 27, 2:28 PM
Unknown Object (File)
Thu, Aug 27, 1:55 PM
Unknown Object (File)
Tue, Aug 25, 11:07 AM
Subscribers

Details

Summary

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).

MFC after: 2 weeks
Assisted-by: Claude Code (Fable 5)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable