Bug 27444 - sysconf reports unsupported option (-1) for _SC_LEVEL1_ICACHE_LINESIZE on X86 since v2.33
Summary: sysconf reports unsupported option (-1) for _SC_LEVEL1_ICACHE_LINESIZE on X86...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: 2.34
Assignee: H.J. Lu
URL: https://sourceware.org/pipermail/libc...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-20 01:03 UTC by andrei
Modified: 2021-03-15 13:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2021-03-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andrei 2021-02-20 01:03:38 UTC
Host: x86_64-poky-linux
Target: x86_64-poky-linux
Configure flags: --build=x86_64-linux --host=x86_64-poky-linux --target=x86_64-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/andrei/work/poky/build/tmp/work/core2-64-poky-linux/glibc/2.33-r0/recipe-sysroot --enable-kernel=3.2.0 --disable-profile --disable-debug --without-gd --enable-clocale=gnu --with-headers=/home/andrei/work/poky/build/tmp/work/core2-64-poky-linux/glibc/2.33-r0/recipe-sysroot/usr/include --without-selinux --enable-tunables=no --enable-bind-now --enable-stack-protector=strong --enable-stackguard-randomization --disable-crypt --with-default-link --disable-static --enable-nscd --enable-cet
Host: 5.10.16-arch1-1
Target: 5.10.16-yocto-standard
gcc: 10.2.0
binutils: 2.36

It was observed that with glibc 2.33, sysconf reports unsupported
option (-1) for _SC_LEVEL1_ICACHE_LINESIZE while on 2.32 it reports, as expected 64.

This can be easily reproduced using archlinux docker images with sysconf tool:

```
└─❯  docker run -ti --rm archlinux:base-20210214.0.15477 getconf -a |
grep "GNU_LIBC_VERSION\|LEVEL1_ICACHE_LINESIZE"
GNU_LIBC_VERSION                   glibc 2.33
LEVEL1_ICACHE_LINESIZE
└─❯  docker run -ti --rm archlinux:base-20210131.0.14634 getconf -a |
grep "GNU_LIBC_VERSION\|LEVEL1_ICACHE_LINESIZE"
GNU_LIBC_VERSION                   glibc 2.32
LEVEL1_ICACHE_LINESIZE             64
```

The offending patch in glibc is:

commit 2d651eb9265d1366d7b9e881bfddd46db9c1ecc4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Sep 18 07:55:14 2020 -0700
    x86: Move x86 processor cache info to cpu_features

Reverting the above patch fixes this issue. I've also tried to disable `tunables` but that didn't make a change.
Comment 1 Bernhard Rosenkränzer 2021-02-20 01:10:22 UTC
Reproducable here with both Yocto (same setup as Andrei's) and with OpenMandriva 4.2 (which uses glibc 2.33 with a slightly different config [--enable-kernel=5.0, and -march=znver1 in compiler flags]).
Comment 2 H.J. Lu 2021-03-06 19:12:07 UTC
A patch is posted at

https://sourceware.org/pipermail/libc-alpha/2021-March/123429.html
Comment 3 andrei 2021-03-09 20:05:29 UTC
(In reply to H.J. Lu from comment #2)
> A patch is posted at
> 
> https://sourceware.org/pipermail/libc-alpha/2021-March/123429.html

Gave it a spin and it works as expected. Thanks.
Comment 4 H.J. Lu 2021-03-15 13:22:44 UTC
Fixed for 2.34 by

commit f53ffc9b90cbd92fa5518686daf4091bdd1d4889
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Mar 6 10:19:32 2021 -0800

    x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]

and 2.33 branch by

commit 64f6c287ad3ccd807b7d4c694f4a91e2a662fed5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Mar 6 10:19:32 2021 -0800

    x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]