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)
Tue, Sep 15, 1:41 AM
Unknown Object (File)
Sun, Sep 13, 9:57 AM
Unknown Object (File)
Fri, Sep 11, 2:15 PM
Unknown Object (File)
Fri, Sep 11, 5:04 AM
Unknown Object (File)
Thu, Sep 10, 7:17 AM
Unknown Object (File)
Tue, Sep 8, 10:56 AM
Unknown Object (File)
Fri, Aug 28, 8:01 AM
Unknown Object (File)
Fri, Aug 28, 8:00 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