util-linux/0076-lscpu-update-tests-follow-max-freq-for-scaling.patch
Karel Zak 29001915b1 RHEL-9.4.0: lscpu tests
Related: RHEL-12783
2024-02-08 10:41:10 +01:00

94 lines
3.6 KiB
Diff

From c24caf60a92b8e8dbfbc6a00920fa2a59d5a02d0 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 8 Feb 2024 10:36:08 +0100
Subject: lscpu: update tests, follow max freq for scaling
Addresses: https://issues.redhat.com/browse/RHEL-12783
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/lscpu-topology.c | 3 +++
tests/expected/lscpu/lscpu-vbox-win | 1 +
tests/expected/lscpu/lscpu-vmware_fpe | 1 +
tests/expected/lscpu/lscpu-x86_64-64cpu | 1 +
tests/expected/lscpu/lscpu-x86_64-dell_e4310 | 1 +
tests/expected/lscpu/lscpu-x86_64-epyc_7451 | 1 +
6 files changed, 8 insertions(+)
diff --git a/sys-utils/lscpu-topology.c b/sys-utils/lscpu-topology.c
index fe4da7cd5..23021df72 100644
--- a/sys-utils/lscpu-topology.c
+++ b/sys-utils/lscpu-topology.c
@@ -561,6 +561,9 @@ static int read_mhz(struct lscpu_cxt *cxt, struct lscpu_cpu *cpu)
if (ul_path_readf_s32(sys, &mhz, "cpu%d/cpufreq/scaling_cur_freq", num) == 0)
cpu->mhz_cur_freq = (float) mhz / 1000;
+ if (cpu->mhz_cur_freq > cpu->mhz_max_freq)
+ cpu->mhz_cur_freq = cpu->mhz_max_freq;
+
if (cpu->type && (cpu->mhz_min_freq || cpu->mhz_max_freq))
cpu->type->has_freq = 1;
diff --git a/tests/expected/lscpu/lscpu-vbox-win b/tests/expected/lscpu/lscpu-vbox-win
index ab8a25c2c..bc0ed4cb6 100644
--- a/tests/expected/lscpu/lscpu-vbox-win
+++ b/tests/expected/lscpu/lscpu-vbox-win
@@ -10,6 +10,7 @@ Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
Stepping: 9
+CPU(s) scaling MHz: 42%
CPU max MHz: 3800.0000
CPU min MHz: 1600.0000
BogoMIPS: 3355.62
diff --git a/tests/expected/lscpu/lscpu-vmware_fpe b/tests/expected/lscpu/lscpu-vmware_fpe
index 363bdd931..80a51b1ae 100644
--- a/tests/expected/lscpu/lscpu-vmware_fpe
+++ b/tests/expected/lscpu/lscpu-vmware_fpe
@@ -11,6 +11,7 @@ Core(s) per socket: 4
Socket(s): 2
Stepping: 0
Frequency boost: enabled
+CPU(s) scaling MHz: 52%
CPU max MHz: 3200.0000
CPU min MHz: 1400.0000
BogoMIPS: 6399.69
diff --git a/tests/expected/lscpu/lscpu-x86_64-64cpu b/tests/expected/lscpu/lscpu-x86_64-64cpu
index cd84ad46a..b5b6c85c3 100644
--- a/tests/expected/lscpu/lscpu-x86_64-64cpu
+++ b/tests/expected/lscpu/lscpu-x86_64-64cpu
@@ -10,6 +10,7 @@ Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 4
Stepping: 6
+CPU(s) scaling MHz: 54%
CPU max MHz: 1996.0000
CPU min MHz: 1064.0000
BogoMIPS: 3990.31
diff --git a/tests/expected/lscpu/lscpu-x86_64-dell_e4310 b/tests/expected/lscpu/lscpu-x86_64-dell_e4310
index a0a9962c7..f7f0291c9 100644
--- a/tests/expected/lscpu/lscpu-x86_64-dell_e4310
+++ b/tests/expected/lscpu/lscpu-x86_64-dell_e4310
@@ -10,6 +10,7 @@ Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
Stepping: 5
+CPU(s) scaling MHz: 59%
CPU max MHz: 2667.0000
CPU min MHz: 1199.0000
BogoMIPS: 5319.92
diff --git a/tests/expected/lscpu/lscpu-x86_64-epyc_7451 b/tests/expected/lscpu/lscpu-x86_64-epyc_7451
index 6e5085e84..335f391b5 100644
--- a/tests/expected/lscpu/lscpu-x86_64-epyc_7451
+++ b/tests/expected/lscpu/lscpu-x86_64-epyc_7451
@@ -11,6 +11,7 @@ Core(s) per socket: 24
Socket(s): 2
Stepping: 2
Frequency boost: enabled
+CPU(s) scaling MHz: 100%
CPU max MHz: 2300.0000
CPU min MHz: 1200.0000
BogoMIPS: 4590.83
--
2.43.0