From df60f92fd21d5ae38f73ad9fa266b7ef15cd9e8a Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 15 Jun 2026 21:39:24 -0400 Subject: [PATCH] cpu: halve octeon bogomips to recover the true core clock --- crates/lib/src/cpu.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/lib/src/cpu.rs b/crates/lib/src/cpu.rs index dca327b..479451d 100644 --- a/crates/lib/src/cpu.rs +++ b/crates/lib/src/cpu.rs @@ -204,6 +204,14 @@ fn get_cpu_freq_mhz() -> Option { mhz = mhz * 10 + u32::from(b - b'0'); } } + + // Octeon presets loops_per_jiffy to clock_rate/HZ, so its BogoMIPS is + // exactly 2x the core clock, unlike the 1:1 of other MIPS. + // https://github.com/torvalds/linux/blob/v6.19/arch/mips/cavium-octeon/csrc-octeon.c#L40 + if *key == b"BogoMIPS" && data.windows(6).any(|w| w == b"Octeon") { + mhz /= 2; + } + if mhz > 0 { return Some(mhz); }