diff options
| author | Paulo Fragoso <paulo@nlink.com.br> | 2026-09-22 14:00:31 +0000 |
|---|---|---|
| committer | Mitchell Horne <mhorne@FreeBSD.org> | 2026-09-22 14:01:24 +0000 |
| commit | 6d9f435739e5fb604f452d03ad7f2eb280bfc968 (patch) | |
| tree | 3d0a71067576eda0295fd1c6c0fb4291700dec82 /lld | |
| parent | 34c40126fd10abac06cd628c0563c57e777c9eef (diff) | |
pmc_ibs_initialize() allocates the ibs_pcpu[] pointer array, and
pmc_ibs_finalize() exists to free it, but pmc_ibs_finalize() is
never called. Every hwpmc unload on a CPU with IBS therefore leaks
one pmc_cpu_max()-sized pointer array.
Call pmc_ibs_finalize() from pmc_amd_finalize(), alongside the RAPL,
TSC and perf classes. IBS is only initialized on CPUs that support
it, so make pmc_ibs_finalize() return early when ibs_pcpu is NULL,
making it safe to call when the class was skipped at initialize
time, as pmc_rapl_finalize() already is.
Tested on an AMD Ryzen 5 5600X (Zen 3, 12 threads) with INVARIANTS.
Before the change, each kldload/kldunload cycle leaked one 96-byte
M_PMC allocation, and DTrace showed the ibs_pcpu[] allocation from
pmc_ibs_initialize() as the only one never freed. After the change,
50 load/unload cycles leave M_PMC InUse and MemUse unchanged, and
every allocation made at load is freed at unload.
Reviewed by: mhorne
Fixes: e51ef8ae490f ("hwpmc: Initial support for AMD IBS")
Sponsored by: NLINK (https://nlink.com.br), Recife, Brazil
Differential Revision: https://reviews.freebsd.org/D59881
Diffstat (limited to 'lld')
0 files changed, 0 insertions, 0 deletions
