]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: skip frequencies of 0 MHz when getting minmhz
authorRicardo Neri <ricardo.neri-calderon@linux.intel.com>
Fri, 31 Jan 2025 03:25:32 +0000 (19:25 -0800)
committerKarel Zak <kzak@redhat.com>
Mon, 3 Feb 2025 12:32:26 +0000 (13:32 +0100)
commit533c4210b197cb59c323fbb943d6f3bcd8799579
treec6a3ecbf60682f4b76a97e62f5c58316d75e5833
parentff59272f8973127d00383976e687279127eaab80
lscpu: skip frequencies of 0 MHz when getting minmhz

read_mhz() sets cpu->mhz_min_freq from /sys/devices/system/cpu/cpuN/
cpufreq/cpuinfo_min_freq. The file read fails if cpuN is offline and
cpu->mhz_min_freq is left as 0. 0 MHz is treated as invalid frequency.

lsblk_cputype_get_minmhz() iterates through all possible CPUs to find the
minimum frequency. If one or more CPUs are offline, the minimum frequency
will be 0. This is reflected in the output of lscpu:

$ ./lscpu | grep min
CPU min MHz:                        0.0000

Ignore 0-MHz frequencies to find the actual minimum frequency:

$ ./lscpu | grep min
CPU min MHz:                     1200.0000

Reported-by: Thangamani Krishnan <thangamani.krishnan@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
sys-utils/lscpu-topology.c