Page MenuHomeFreeBSD

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

Authored by darkfiberiru_gmail.com on Nov 13 2020, 10:17 PM.

Details

Summary

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

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

sysutils/turbostat/files/patch-turbostat.c
153

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

155

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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251113

darkfiberiru_gmail.com 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.