Page MenuHomeFreeBSD

hwpmc: Always set pmc_cpuid to something
ClosedPublic

Authored by freqlabs on Jul 14 2020, 9:02 PM.
Tags
None
Referenced Files
F133543929: D25673.diff
Sun, Oct 26, 1:26 PM
Unknown Object (File)
Tue, Oct 14, 9:55 PM
Unknown Object (File)
Tue, Oct 14, 9:55 PM
Unknown Object (File)
Tue, Oct 14, 9:55 PM
Unknown Object (File)
Tue, Oct 14, 12:40 PM
Unknown Object (File)
Aug 15 2025, 8:07 PM
Unknown Object (File)
Jul 26 2025, 10:36 AM
Unknown Object (File)
Jul 4 2025, 5:02 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 Skipped
Unit
Tests Skipped

Event Timeline

lib/libpmc/libpmc_pmu_util.c
172

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

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

lib/libpmc/libpmc_pmu_util.c
178

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

Right.

178

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.