Page MenuHomeFreeBSD

sysutils/turbostat: Update to fix sysctl kern.sched.topology_spec max length

Authored by on Nov 13 2020, 10:17 PM.
Referenced Files
Unknown Object (File)
Tue, Nov 21, 5:56 AM
Unknown Object (File)
Tue, Nov 21, 5:14 AM
Unknown Object (File)
Sat, Nov 11, 12:37 PM
Unknown Object (File)
Thu, Nov 9, 10:10 AM
Unknown Object (File)
Oct 24 2023, 11:55 PM
Unknown Object (File)
Oct 15 2023, 12:04 PM
Unknown Object (File)
Oct 10 2023, 5:30 PM
Unknown Object (File)
Sep 6 2023, 4:32 AM



sysctl kern.sched.topology_spec can be over 16k characters. This code written by @freqlabs to help me as I was troubleshooting other issues on AMD epyc dynamically allocates a buffer instead of a fixed length to fix this issue.

Test Plan

Test on xeon 6242R should work fully
Test on AMD EPYC 7551 should fix sysctl size issue but still have other issues to be resolved.

Diff Detail

rP FreeBSD ports repository
Lint Skipped
Tests Skipped

Event Timeline


I think this should be if (sysctlbyname() != 0 && errno != ENOMEM)


No need for the extra byte if you're not zeroing it for paranoia's sake.

Also, it's not hurting anything, but may as well free(spec) down at the end of the function.

Otherwise this looks like a good change.

I'll second Scott's three suggested changes.

This revision now requires changes to proceed.Nov 15 2020, 8:59 PM

Update commit to fix according to feedback.

Resolved all three requested fixes

This build has been tested on dual intel 6242R where turbostat works as expected and and on dual AMD EPYC 7551 32-Core where this code fixes the sysctl issues but fails on futher issues which I have a bug report for here edited the test plan for this revision. (Show Details)

Thank you ryan for catching my mess up using git diff instead of git show for the commit.

This revision is now accepted and ready to land.Dec 4 2020, 6:13 PM

I don't have my commit bit. Can someone commit this fix?

I don't have my commit bit. Can someone commit this fix?

I Can if anyone did not commit it already.