public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28809] New: LEVEL3_CACHE_ASSOC incorrectly detected on Zen 2/3 CPUs
@ 2022-01-23 20:01 me at tbrindus dot ca
  0 siblings, 0 replies; only message in thread
From: me at tbrindus dot ca @ 2022-01-23 20:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28809

            Bug ID: 28809
           Summary: LEVEL3_CACHE_ASSOC incorrectly detected on Zen 2/3
                    CPUs
           Product: glibc
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: me at tbrindus dot ca
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Hi,

On Zen 2 (tested Ryzen 3900X) and Zen 3 (tested Ryzen 5950X) systems, glibc
reports incorrect values for LLC associativity:

```
$ getconf LEVEL3_CACHE_ASSOC
0
```

The correct value for these CPUs is 16.

In the `case _SC_LEVEL3_CACHE_ASSOC` branch of `sysdeps/x86/dl-cacheinfo.h`,
`(edx >> 12) & 0xf` evaluates to 9, which is not a valid associativity value as
per https://www.amd.com/system/files/TechDocs/25481.pdf -- so glibc returns 0.

The kernel, however, is able to determine the right associativity on these
systems:

```
$ cat /sys/devices/system/cpu/cpu0/cache/index3/ways_of_associativity
16
```

In `arch/x86/kernel/cpu/cacheinfo.c`, it looks like it goes through the topoext
extension to determine cache sizes, if present.

I'm not sure if this is a glibc bug or CPU bug, but it'd be good if glibc could
report the right value here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-23 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 20:01 [Bug libc/28809] New: LEVEL3_CACHE_ASSOC incorrectly detected on Zen 2/3 CPUs me at tbrindus dot ca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).