]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libpmc: fall-back to kernel tables if pmu-events fails
authorMitchell Horne <mhorne@FreeBSD.org>
Thu, 13 May 2021 18:57:37 +0000 (15:57 -0300)
committerMitchell Horne <mhorne@FreeBSD.org>
Thu, 13 May 2021 19:01:24 +0000 (16:01 -0300)
commitdfdc57e8aa8ba4b4e4484f736e8c7645ab69b54a
tree6161787b5ded7f6477be068d4bf0aba515dd121a
parentda13ef6aa0565c8d79326bba5606671062033bbf
libpmc: fall-back to kernel tables if pmu-events fails

On x86, the pmu_events table is the source of truth for finding
supported events. However, events not found there may still be present
in the kernel's static event tables. For example, the pmc.soft(3) events
will never be available from pmu-events.

Update pmc_allocate() to search the legacy event tables if
pmc_pmu_pmcallocate() fails to return a result. This allows both event
sources to be consulted before giving up, thus restoring pmc.soft(3) and
pmc.tsc(3) on x86.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30216
lib/libpmc/libpmc.c