Page MenuHomeFreeBSD

pmcstat: fix duplicate event allocation on CPU 0
ClosedPublic

Authored by mhorne on Sep 25 2023, 5:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 14, 8:41 PM
Unknown Object (File)
Mon, Oct 14, 8:41 PM
Unknown Object (File)
Mon, Oct 14, 8:09 PM
Unknown Object (File)
Oct 8 2024, 10:51 PM
Unknown Object (File)
Oct 2 2024, 5:49 AM
Unknown Object (File)
Sep 18 2024, 2:37 PM
Unknown Object (File)
Sep 18 2024, 4:06 AM
Unknown Object (File)
Sep 17 2024, 4:46 PM

Details

Summary

Commit b6e28991bf3a modified the allocation path for system scope PMCs
so that the event was allocated early for CPU 0. The reason is so that
the PMC's capabilities could be checked, to determine if pmcstat
should allocate the event on every CPU, or just on one CPU in each NUMA
domain. In the current scheme, there is no way to determine this
information without performing the PMC allocation.

This broke the established use-case of log analysis, and so
0aa150775179a was committed to fix the assertion. The result was what
appeared to be functional, but in normal counter measurement pmcstat was
silently allocating two counters for CPU 0.

This cuts the total number of counters that can be allocated from a CPU
in half. Additionally, depending on the particular hardware/event, we
might not be able to allocate the same event twice on a single CPU.

The simplest solution is to release the early-allocated PMC once we have
obtained its capabilities, and reallocate it later on. This restores the
event list logic to behave as it has for many years, and partially
reverts commit b6e28991bf3a.

Reported by: alc, kevans

Diff Detail

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

Event Timeline

This looks pretty good to me. FWIW, I have a test queued to verify this fixes the issue we were seeing; should have results by tomorrow (if not earlier).

Thanks!
--ap

This looks pretty good to me. FWIW, I have a test queued to verify this fixes the issue we were seeing; should have results by tomorrow (if not earlier).

Thanks!
--ap

Just got the results back and this does, indeed, fix the issue. Cheers!
--ap

This revision is now accepted and ready to land.Sep 26 2023, 11:43 AM
ray added a subscriber: ray.

Many thanks, Mitchell!