[Git-commits] [grml/grml-autoconfig] 74eef7: config_cpu: use lscpu for identifying CPU information

Michael Prokop noreply at github.com
Fri Sep 8 08:35:51 CEST 2023


  Branch: refs/heads/master
  Home:   https://github.com/grml/grml-autoconfig
  Commit: 74eef776a281bca6f6d6f089b065cb01dc600196
      https://github.com/grml/grml-autoconfig/commit/74eef776a281bca6f6d6f089b065cb01dc600196
  Author: Michael Prokop <mika at grml.org>
  Date:   2023-09-08 (Fri, 08 Sep 2023)

  Changed paths:
    M autoconfig.functions

  Log Message:
  -----------
  config_cpu: use lscpu for identifying CPU information

On arm64 we don't have the CPU information in /proc/cpuinfo as expected
by our config_cpu, so its output is broken:

| # awk -F: '/^processor/{printf "        Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo
|         Processor 0 is
|         Processor 1 is
| [...]
|         Processor 13 is
|         Processor 14 is
|         Processor 15 is

FTR:

| # head /proc/cpuinfo
| processor       : 0
| BogoMIPS        : 50.00
| Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
| CPU implementer : 0x41
| CPU architecture: 8
| CPU variant     : 0x3
| CPU part        : 0xd0c
| CPU revision    : 1
|
| processor       : 1

While with lspcu we get the information we're interested in:

| # lscpu | grep 'Model name:'
| Model name:                      Neoverse-N1
| BIOS Model name:                 virt-5.2  CPU @ 2.0GHz

So instead of having some hackish /proc/cpuinfo parsing, let's rely on
util-linux's lscpu(1).

While at it, let's output only the number of present CPUs instead of
listing every single one of them, given that there exist systems with
>100 CPUs nowadays. :)

Thanks: Christopher Bock and AndrĂ¡s Korn for feedback




More information about the Git-commits mailing list