Page MenuHomeFreeBSD

hwpmc: Always set pmc_cpuid to something
ClosedPublic

Authored by freqlabs on Jul 14 2020, 9:02 PM.

Details

Summary

pmc_cpuid was uninitialized for most AMD processor families. We still can populate this string for unimplemented families.

Also removed an extra call to sysctlbyname in libpmc, added a CPUID_TO_STEPPING macro, and converted existing code to use it. I can commit these changes separately, if preferable.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

lib/libpmc/libpmc_pmu_util.c
172 ↗(On Diff #74462)

Ah this can be removed and NULL passed to sysctlbyname instead, too.

freqlabs marked an inline comment as not done.Jul 14 2020, 9:06 PM
lib/libpmc/libpmc_pmu_util.c
172 ↗(On Diff #74462)

No it should be initialized to the size of the buffer instead.

lib/libpmc/libpmc_pmu_util.c
178 ↗(On Diff #74462)

This should probably be a strlcpy while I'm making changes here.

Looks good to me.

Generally it is not recommended to mix unrelated changes, but too small granularity create too much noise and also is not great, so best is somewhere in the middle. In this case libpmc part looks unrelated and could be committed separately.

This revision is now accepted and ready to land.Jul 14 2020, 9:15 PM
lib/libpmc/libpmc_pmu_util.c
172 ↗(On Diff #74462)

Right.

178 ↗(On Diff #74462)

Yes, would not harm, considering it is passed as an argument to the library function,

This revision was automatically updated to reflect the committed changes.