Skip to content

lscpu: Fix socket information on aarch64 machine

Masayoshi Mizuma util-linux 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 1 replyApplied
  2. v25 patches 2 repliesSuperseded
  3. v14 patches 5 repliesSuperseded

Changelog from the cover letter

v3: Remove cluster/socket column checking. Make lscpu_is_cluster_arm()
static (0001 patch)
v2: Rebased to the latest lscpu

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/5lscpu: use cluster on aarch64 machine which doesn't have ACPI PPTTsys-utils/lscpu-arm.c sys-utils/lscpu.1 sys-utils/lscpu.c +1 more+46 -60 replies
2/5lscpu-virt: split hypervisor_from_dmi_table()sys-utils/lscpu-virt.c sys-utils/lscpu.h+40 -200 replies
3/5lscpu-dmi: Move some functions related to DMI to lscpu-dmisys-utils/Makemodule.am sys-utils/lscpu-dmi.c sys-utils/lscpu-virt.c +1 more+86 -720 replies
4/5lscpu: add helper to get physical socketssys-utils/lscpu-dmi.c sys-utils/lscpu.h+31 -00 replies
5/5lscpu: show the number of physical socket on aarch64 machine without ACPI PPTTsys-utils/lscpu-arm.c sys-utils/lscpu.c sys-utils/lscpu.h+11 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/5] lscpu: Fix socket information on aarch64 machine

lscpu may show the wrong number of physical sockets on aarch64 machine as 'Socket(s)'.

That is because lscpu uses a sysfs entry (cpu/cpuX/topology/core_siblings) to get the number of sockets. For aarch64, the sysfs entry is set from MPIDR_EL1 register if the machine doesn't have ACPI PPTT. According to ARM Architecture Reference Manual, the register shows the topology as the affinity, but doesn't show the physical socket information.

There are such aarch64 machines because ARM SBBR v1.0 and v1.1 don't require ACPI PPTT. SBBR v1.2 requires ACPI PPTT.

For the aarch64 machine, probably 'Cluster(s)' is good instead of 'Socket(s)' according to linux/arch/arm64/kernel/topology.c:store_cpu_topology().

To get the number of sockets on the machine, SMBIOS Processor information (Type04) is useful for lscpu because the SMBIOS information is a mandatory feature for the aarch64 machine which is based on ARM SBBR v1.0 and newer.

With these patches, lscpu shows as following on the machine:

For unprivileged user:

    $ lscpu 
    Architecture:            aarch64
    ...
        Socket(s):           -
        Cluster(s):          4

For root:

    # lscpu 
    Architecture:            aarch64
    ...
        Socket(s):           1
        Cluster(s):          4

Changelog:
v3: Remove cluster/socket column checking. Make lscpu_is_cluster_arm()
static (0001 patch)
v2: Rebased to the latest lscpu

Masayoshi Mizuma (5):
lscpu: use cluster on aarch64 machine which doesn't have ACPI PPTT
lscpu-virt: split hypervisor_from_dmi_table()
lscpu-dmi: Move some functions related to DMI to lscpu-dmi
lscpu: add helper to get physical sockets
lscpu: show the number of physical socket on aarch64 machine without
ACPI PPTT

 sys-utils/Makemodule.am |   1 +
 sys-utils/lscpu-arm.c   |  15 ++++++
 sys-utils/lscpu-dmi.c   | 108 ++++++++++++++++++++++++++++++++++++++++
 sys-utils/lscpu-virt.c  |  62 ++++++-----------------
 sys-utils/lscpu.1       |   3 ++
 sys-utils/lscpu.c       |  39 ++++++++++++---
 sys-utils/lscpu.h       |  38 ++++++--------
 7 files changed, 190 insertions(+), 76 deletions(-)
 create mode 100644 sys-utils/lscpu-dmi.c
Signature · 1 line
2.27.0