Repository navigation
Fix the NetBSD processor frequency recursion on non-x86 machines - #3812
Conversation
NetBsdCentralProcessor.queryCurrentFreq fell back to queryMaxFreq when machdep.tsc_freq was absent, but the inherited queryMaxFreq reads getCurrentFreq, which calls queryCurrentFreq again. On machines without machdep.tsc_freq, such as ARM, any read of the current or maximum frequency, or of the processor identifier, ended in a StackOverflowError, starting a sysctl process on every pass. Both now share one lookup: machdep.tsc_freq, then the frequency in the processor name, then machdep.dmi.processor-frequency, the only source on ARM. Verified on a NetBSD 10.1 aarch64 VM with the JNA (with and without the native library) and FFM implementations: 2 GHz, no crash.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3812 +/- ##
============================================
- Coverage 80.86% 80.83% -0.04%
- Complexity 652 654 +2
============================================
Files 725 725
Lines 26021 26021
Branches 4422 4421 -1
============================================
- Hits 21043 21033 -10
- Misses 2763 2773 +10
Partials 2215 2215
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
On NetBSD machines without
machdep.tsc_freq, such as ARM,NetBsdCentralProcessor.queryCurrentFreqfell back toqueryMaxFreq. The inheritedqueryMaxFreqreadsgetCurrentFreq, which callsqueryCurrentFreqagain. Reading the current or maximum frequency, or the processor identifier, therefore ended in aStackOverflowError, and each pass started asysctlprocess. The fullSystemInfoTestreport crashed in all three configurations.Both lookups now share one helper that tries these sources in order:
machdep.tsc_freq, which exists on x86 only.machdep.dmi.processor-frequency, the only source on ARM. On the test machine it reads "2000 MHz".If none gives a value, the result is -1. The parsing has a unit test.
Testing
This came out of a survey comparing OSHI's NetBSD report against the operating system's own tools. The survey's other findings will follow as separate PRs.
Summary by CodeRabbit