lscpu cache information is incorrect with focal on arm 64-bit platform (ThunderX2)

Bug #1873489 reported by Taihsiang Ho
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Platform: Cavium Sabre Marvell ThunderX2

The L1/L2/L3 cache output by "lscpu" is incorrect, and differes from the output with bionic.

[Steps to Reproduce]
1. Install ubuntu server (focal) on Sabre
2. lspci

[Expected Result]
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 32768K

[Actual Result]
L1d cache: 1.8 MiB
L1i cache: 1.8 MiB
L2 cache: 14 MiB
L3 cache: 64 MiB

[More Information]
1. eoan could reproduce this issue.
2. bionic-hwe could not reproduce this issue (5.3.0-46-generic #38~18.04.1-Ubuntu)
3. with focal, check the cpu cache directly from the virtual devices and the cache information looks good:
    $ cat /sys/devices/system/cpu/cpu0/cache/index0/level /sys/devices/system/cpu/cpu0/cache/index0/size
    1
    32K
4. More information about the system which could reproduce the issue:

    ubuntu@apollo:~$ cat /sys/devices/system/cpu/cpu0/cache/index0/level /sys/devices/system/cpu/cpu0/cache/index0/size
    1
    32K
    ubuntu@apollo:~$ uname -a
    Linux apollo 5.4.0-24-generic #28-Ubuntu SMP Thu Apr 9 22:17:51 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
    ubuntu@apollo:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu Focal Fossa (development branch)
    Release: 20.04
    Codename: focal
    ubuntu@apollo:~$ dpkg -l util-linux
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name Version Architecture Description
    +++-==============-===============-============-=================================
    ii util-linux 2.34-0.1ubuntu9 arm64 miscellaneous system utilities
    ubuntu@apollo:~$

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: util-linux 2.34-0.1ubuntu9
ProcVersionSignature: User Name 5.4.0-24.28-generic 5.4.30
Uname: Linux 5.4.0-24-generic aarch64
ApportVersion: 2.20.11-0ubuntu26
Architecture: arm64
CasperMD5CheckResult: skip
Date: Fri Apr 17 16:00:13 2020
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Taihsiang Ho (tai271828) wrote :
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Hi Taihsiang,

Thanks for reporting this bug.

This is an upstream deliberate change in output format of caches in lscpu.
They introduced the '--caches' option to provide individual/total sizes.

It affects other architectures as well, not just arm64; e.g., amd64.

For example, on my laptop:

Bionic:

$ lscpu | grep cache
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K

Focal:

$ lscpu | grep cache
L1d cache: 64 KiB
L1i cache: 64 KiB
L2 cache: 512 KiB
L3 cache: 3 MiB

On Eoan and later you can use `lscpu --caches` to get all/individual cache information.

Focal:

$ lscpu --caches
NAME ONE-SIZE ALL-SIZE WAYS TYPE LEVEL
L1d 32K 64K 8 Data 1
L1i 32K 64K 8 Instruction 1
L2 256K 512K 4 Unified 2
L3 3M 3M 12 Unified 3

$ lscpu --caches=one-size
ONE-SIZE
     32K
     32K
    256K
      3M

For documentation purposes, this is the PR requesting/discussing it [1], and this is the patch changing it [2].

Since this has been an upstream decision (see PR comments and patch), I guess it's unlikely they'd change it back (even though it broke the previous output convention, as that has been mentioned/acknowledged in the PR.)

This patch has been introduced on 2.34, so Eoan and later have this format change.

Hope this helps,
Mauricio

[1] https://github.com/karelzak/util-linux/issues/663
[2] https://github.com/karelzak/util-linux/commit/e5f721132ec8b8c933a396d8dcb3efcb67854f13

Changed in util-linux (Ubuntu):
status: New → Invalid
Revision history for this message
Taihsiang Ho (tai271828) wrote :

Hi Mauricio, thank you for providing the information that I was not aware of. It's very clear and helpful for me.

Because the ThunderX2 is unavailable for me currently, I verified the output format with Focal on an arm d06 cpu, which is able to reproduce the "issue" (my own host name "scobee"). It is exactly what you have said.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.