Page MenuHomeFreeBSD

hwpmc: Always set pmc_cpuid to something
ClosedPublic

Authored by freqlabs on Jul 14 2020, 9:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 12:50 PM
Unknown Object (File)
Feb 22 2024, 5:37 PM
Unknown Object (File)
Jan 13 2024, 11:23 AM
Unknown Object (File)
Dec 23 2023, 12:31 AM
Unknown Object (File)
Dec 3 2023, 6:09 PM
Unknown Object (File)
Dec 3 2023, 1:42 PM
Unknown Object (File)
Dec 3 2023, 1:42 PM
Unknown Object (File)
Dec 3 2023, 1:27 PM
Subscribers

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 - subversion
Lint
Lint Not Applicable
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.