Fix Base::CpuCurrentFrequency on ARM/ARM64 Neoverse-N2 (Linux) - #854
Merged
Conversation
Add fallbacks when cpufreq sysfs and /proc/cpuinfo MHz are unavailable (dmidecode and lscpu BIOS model @ghz), and document the fix in 7.2.165. Co-authored-by: igor.ermolaev <igor.ermolaev@altezza.org>
Read sysfs via ifstream, add ACPI CPPC/SMBIOS/device-tree fallbacks, scan neighboring CPUs when AMU reports 0 on an idle core, and avoid relying on root-only dmidecode or lscpu @ghz strings. Co-authored-by: igor.ermolaev <igor.ermolaev@altezza.org>
Avoid int Round() on GHz-scale values, scan all CPUs/policies for the first non-zero cpufreq/CPPC reading, and keep SMBIOS/dmidecode/lscpu plus perf measurement as fallbacks when sysfs has no frequency. Co-authored-by: igor.ermolaev <igor.ermolaev@altezza.org>
ermig1979
marked this pull request as ready for review
August 13, 2026 08:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Base::CpuCurrentFrequency()returned 0 Hz on ARM/ARM64 Neoverse-N2 Linux.Root causes addressed
scaling_cur_freqcan be0on the current core; old code returned immediately without trying other CPUs / max freq.Round()overflow (prior revision):Round()returnsint, sokHz * 1000/MHz * 1e6overflows around 2.1 GHz.MHzin/proc/cpuinfo; need CPPC / SMBIOS / other fallbacks.Fix (
SimdBaseCpu.cpp)cpu*/cpufreq+policy*files; take first value> 0(kHz → Hz via 64-bit multiply)nominal_freq/lowest_freq(MHz)/proc/cpuinfoMHz/sys/firmware/dmi/...(no root)dmidecode/lscpuclock-frequencyperf_event_opencycle measurement (when permitted)Also documents the fix in
docs/2026.htmlrelease 7.2.165.Test plan
libSimd.so(g++)/proc/cpuinfo)awk '$1 > 0'skips leading idle0readings and selects2600000SimdBaseCpu.cppsucceeds97aff938fIf still 0 on Neoverse-N2, please share: