Managing CPUs

Red Hat Enterprise Linux 9.2 LPAR mode z/VM guest KVM guest

You can control the online status, check the capability, and, for LPAR mode, examine the topology of CPUs.

Use the lscpu and chcpu commands to manage CPUs. These commands are part of the util-linux package. For details, see the man pages. Alternatively, you can manage CPUs through the attributes of their entries in sysfs.

Some attributes that govern CPUs are available in sysfs under:
/sys/devices/system/cpu/cpu<N>
where <N> is the number of the logical CPU. Both the sysfs interface and the lscpu and chcpu commands manage CPUs through their logical representation in Linux®.
You can obtain a mapping of logical CPU numbers to physical CPU addresses by issuing the lscpu command with the -e option.
Example:
# lscpu -e
CPU NODE DRAWER BOOK SOCKET CORE L1d:L1i:L2d:L2i ONLINE CONFIGURED POLARIZATION ADDRESS
0   1    0      0    0      0    0:0:0:0         yes    yes        horizontal   0
1   1    0      0    0      0    1:1:1:1         yes    yes        horizontal   1
2   1    0      0    0      1    2:2:2:2         yes    yes        horizontal   2
3   1    0      0    0      1    3:3:3:3         yes    yes        horizontal   3
4   1    0      0    0      2    4:4:4:4         yes    yes        horizontal   4
5   1    0      0    0      2    5:5:5:5         yes    yes        horizontal   5
6   1    0      0    0      3    6:6:6:6         yes    yes        horizontal   6
7   1    0      0    0      3    7:7:7:7         yes    yes        horizontal   7
8   0    1      1    1      4    8:8:8:8         yes    yes        horizontal   8
...
The logical CPU numbers are shown in the CPU column and the physical address in the ADDRESS column of the output table.
Alternatively, you can find the physical address of a CPU in the sysfs address attribute of a logical CPU.
Example:
# cat /sys/devices/system/cpu/cpu0/address
0