Skip to content

Commit 67eafb3

Browse files
committed
Handle special cases for CPU frequency data in /proc/cpuinfo
This adds special cases for: - loongarch: https://github.com/torvalds/linux/blob/v6.15/arch/loongarch/kernel/proc.c#L42 - s390: https://github.com/torvalds/linux/blob/v6.15/arch/s390/kernel/processor.c#L335 These differ from all the other platforms in the Linux kernel and weren't matched properly previously. There's an additional value of "CPU MHz static" available for s390, which is always given AFTER the dynamic value and thus would override the dynamic value; we thus ignore the static CPU frequency given for s390 in favour of the dynamic entry. Fixes: #1711
1 parent a1f6502 commit 67eafb3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

linux/LinuxMachine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,8 @@ static void scanCPUFrequencyFromCPUinfo(LinuxMachine* this) {
594594
continue;
595595
} else if (
596596
(sscanf(buffer, "cpu MHz : %lf", &frequency) == 1) ||
597+
(sscanf(buffer, "CPU MHz : %lf", &frequency) == 1) || // LooooongArch: https://github.com/torvalds/linux/blob/v6.15/arch/loongarch/kernel/proc.c#L42
598+
(sscanf(buffer, "cpu MHz dynamic : %lf", &frequency) == 1) || // s390: https://github.com/torvalds/linux/blob/v6.15/arch/s390/kernel/processor.c#L335
597599
(sscanf(buffer, "clock : %lfMHz", &frequency) == 1)
598600
) {
599601
if (cpuid < 0 || (unsigned int)cpuid > (super->existingCPUs - 1)) {

0 commit comments

Comments
 (0)