D27362: Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs
jakobkummerow added a comment. Thank you! REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D27362 To: jakobkummerow, davidedmundson, ahiemstra Cc: ngraham, ahiemstra, cfeck, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D27362: Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs
jakobkummerow added a comment. Thanks for landing this! My name is Jakob Kummerow, email: jakob.kumme...@gmail.com I created the diff via Phabricator's web interface (uploading a .diff file), would have expected it to take the author information from my account... REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D27362 To: jakobkummerow, davidedmundson, ahiemstra Cc: ahiemstra, cfeck, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D27362: Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs
jakobkummerow added a comment. ahiemstra: Thanks! I don't have commit access, so I'd appreciate it if you could land this for me. cfeck: Yes, realloc might be a nice improvement (if you think it even matters for this case). Wanna submit a followup PR? REVISION DETAIL https://phabricator.kde.org/D27362 To: jakobkummerow, davidedmundson, ahiemstra Cc: ahiemstra, cfeck, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D27362: Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs
jakobkummerow updated this revision to Diff 75617. jakobkummerow added a comment. Minor update: size_t instead of int. CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D27362?vs=75616&id=75617 REVISION DETAIL https://phabricator.kde.org/D27362 AFFECTED FILES ksysguardd/Linux/cpuinfo.c To: jakobkummerow, davidedmundson, ahiemstra Cc: ahiemstra, cfeck, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D27362: Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs
jakobkummerow updated this revision to Diff 75616. jakobkummerow retitled this revision from "Linux/cpuinfo.c: bump CPUINFOBUFSIZE for 12+ core CPUs" to "Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs". jakobkummerow edited the summary of this revision. jakobkummerow added a comment. OK, here's a version that scales the buffer size as needed. CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D27362?vs=75593&id=75616 REVISION DETAIL https://phabricator.kde.org/D27362 AFFECTED FILES ksysguardd/Linux/cpuinfo.c To: jakobkummerow, davidedmundson, ahiemstra Cc: ahiemstra, cfeck, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D27362: Linux/cpuinfo.c: bump CPUINFOBUFSIZE for 12+ core CPUs
jakobkummerow added a comment. cfeck: Sure, an even better long-term fix would be to stop depending on a hard-coded buffer size. Interleaved reading and parsing would be one way to achieve that; another way would be a dynamic buffer size: start small, and if it's too small then allocate a new buffer that's twice as large and try again. That said, I think the wish for a more scalable solution shouldn't block a (trivially simple) short-term fix that restores functionality for users that are affected **today**. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D27362 To: jakobkummerow, davidedmundson Cc: cfeck, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
D27362: Linux/cpuinfo.c: bump CPUINFOBUFSIZE for 12+ core CPUs
jakobkummerow created this revision. jakobkummerow added a reviewer: davidedmundson. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. jakobkummerow requested review of this revision. REVISION SUMMARY Getting CPU information starts with reading /proc/cpuinfo into a buffer; if that buffer is too small, then no information will be returned at all (updateCpuInfo() will return -1, so initCpuInfo() will return early); the consequence is that ksysguardd/ksysguard/plasmaengineexplorer won't know about "system/cores" or "cpu/system/AverageClock"; that in turn will make the "System Load Viewer" plasmoid completely dysfunctional (it won't show *any* data) because it relies on "system/cores" being available. The buffer is currently 32KB large, which is not enough on modern hardware. This patch bumps it to 256K, in order to accommodate current hardware and be future-proof for a few years. I can provide two specific data points, measured with `cat /proc/cpuinfo | wc -c`: - on a 12C24T AMD machine: ~36K - on a 36C72T Intel machine: ~102K Extrapolating, I estimate that the biggest CPUs available today (Ryzen 3990, 64C128T) will need ~192K (but I don't have one of those available to test on). I've verified locally that this patch fixes the issue: the System Log Viewer plasmoid shows data as expected afterwards. Ref: https://bugs.kde.org/show_bug.cgi?id=384515 REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D27362 AFFECTED FILES ksysguardd/Linux/cpuinfo.c To: jakobkummerow, davidedmundson Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart