]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: Skip aarch64 decode path for rest of the architectures
authorPratik R. Sampat <pratikrajesh.sampat@amd.com>
Mon, 22 Jul 2024 16:00:46 +0000 (16:00 +0000)
committerPratik R. Sampat <pratikrajesh.sampat@amd.com>
Tue, 30 Jul 2024 14:26:50 +0000 (14:26 +0000)
commit50a3efab6d126b28fcdcc28f1a0cd5cd596ae357
treed43fce0fa0d41b5d70a60a3c00b9c76b7bbd7fbe
parent86b6684e7a215a0608bd130371bd7b3faae67aca
lscpu: Skip aarch64 decode path for rest of the architectures

lscpu behaves differently when run sudo vs non-sudo on AMD architectures.

On sudo runs, it adds a BIOS model name and BIOS CPU family which it
does not add for the latter. However since this parsing from the DMI is
primarily catered to aarch64, for AMD platform the BIOS model name is
printed out as follows "AMD XXX Processor *Unknown* CPU @ X.XGHz" due
to the part number is not populated on the platform.

The issue boils down to an unconditional call to arm_decode() which
attempts to read the DMI path and populate the processor information
such as processor version and part number which is set to Unknown on AMD
CPUs.

81d6de9 (lscpu: remove the old code) changed the DMI path from
/sys/firmware/dmi/entries/4-0/raw (non-existent) to
/sys/firmware/dmi/tables/dmi (existent) which has brought this latent
issue to light as DMI was starting to be parsed incorrectly.

Therefore, do not perform aarch64 parsing for other architectures.

Before
------
$ lscpu
Vendor ID:                AuthenticAMD
  Model name:             AMD EPYC XXXX X-Core Processor
    CPU family:           26

$ sudo lscpu
Vendor ID:                AuthenticAMD
  BIOS Vendor ID:         Advanced Micro Devices, Inc.
  Model name:             AMD EPYC XXXX X-Core Processor
    BIOS Model name:      AMD EPYC XXXX X-Core Processor Unknown CPU @ X.XGHz
    BIOS CPU family:      107
    CPU family:           26

After
-----
$ lscpu
Vendor ID:                AuthenticAMD
  Model name:             AMD EPYC XXXX X-Core Processor
    CPU family:           26

$ sudo lscpu
Vendor ID:                AuthenticAMD
  Model name:             AMD EPYC XXXX X-Core Processor
    CPU family:           26

Fixes: 81d6de9 ("lscpu: remove the old code")
Co-developed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Pratik R. Sampat <pratikrajesh.sampat@amd.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu.c
sys-utils/lscpu.h