lscpu shows wrong amount of threads per core if logical CPU is disabled in a run-time on a Hyper-Threading system
Issue
- After disabling one or several virtual CPUs on a Hyper-Threading system with
echo 0 >/sys/devices/system/cpu/cpuX/online
command,lscpu
tool output shows wrongThread(s) per core
field value, telling that Hyper-Threading is disabled now.
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 2 <------
Core(s) per socket: 32
Socket(s): 2
NUMA node(s): 2
Vendor ID: AuthenticAMD
BIOS Vendor ID: Advanced Micro Devices, Inc.
CPU family: 23
Model: 49
Model name: AMD EPYC 7502 32-Core Processor
BIOS Model name: AMD EPYC 7502 32-Core Processor
Stepping: 0
CPU MHz: 2495.331
BogoMIPS: 4990.66
Virtualization: AMD-V
L1d cache: 32K
L1i cache: 32K
L2 cache: 512K
L3 cache: 16384K
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
----------------------------------------------------
Lets disable cpu.
# chcpu -d 10
CPU 10 disabled
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-9,11-127
Off-line CPU(s) list: 10 <-----
Thread(s) per core: 1 <------
Core(s) per socket: 32
Socket(s): 2
NUMA node(s): 2
Vendor ID: AuthenticAMD
BIOS Vendor ID: Advanced Micro Devices, Inc.
CPU family: 23
Model: 49
Model name: AMD EPYC 7502 32-Core Processor
BIOS Model name: AMD EPYC 7502 32-Core Processor
Stepping: 0
CPU MHz: 1791.369
BogoMIPS: 4990.66
Virtualization: AMD-V
L1d cache: 32K
L1i cache: 32K
L2 cache: 512K
L3 cache: 16384K
NUMA node0 CPU(s): 0-9,11-31,64-95
NUMA node1 CPU(s): 32-63,96-127
Environment
- Red Hat Enterprise Linux 7.
- Red Hat Enterprise Linux 8.
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.