From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 381793858C53; Mon, 8 May 2023 16:42:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 381793858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683564135; bh=BQwCjzbpXqH7kE1FLSwOBxRtj5kjvfxuGGpBIz+IFZ0=; h=From:To:Subject:Date:From; b=COJ6SxD83gV1Nz/8g91fsQ/nM8qPhbRIkL91xM9P3U1IhJ7EDSlzL4lwuerN61z/d xdJbNBhnO5WTgoQQ2f28jF3yy3oEXBfc8E3UljxkfO6G4weOMd7mefjyQXb/iFrvG8 aYet6x3sU/HarH/SBCUwrkBxGnP1G1mtxmiaK4xM= From: "fw at deneb dot enyo.de" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/30428] New: New AMD cache size computation logic does not work for some CPUs, hypervisors Date: Mon, 08 May 2023 16:42:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.38 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: fw at deneb dot enyo.de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30428 Bug ID: 30428 Summary: New AMD cache size computation logic does not work for some CPUs, hypervisors Product: glibc Version: 2.38 Status: NEW Severity: critical Priority: P1 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: fw at deneb dot enyo.de Target Milestone: --- Flags: security- This commit: commit 103a469dc7755fd9e8ccf362f3dd4c55dc761908 Author: Sajan Karumanchi Date: Wed Jan 18 18:29:04 2023 +0100 x86: Cache computation for AMD architecture. All AMD architectures cache details will be computed based on __cpuid__ `0x8000_001D` and the reference to __cpuid__ `0x8000_0006` wi= ll be zeroed out for future architectures. Reviewed-by: Premachandra Mallappa changed cache size computation on the AMD architecture. However, the new way of doing things is not supported by all AMD CPUs. This CPU: processor : 0 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Turion(tm) II Neo N40L Dual-Core Processor stepping : 3 microcode : 0x10000c8 cpu MHz : 800.000 cache size : 1024 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca = cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_lega= cy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate vmmcall npt lbrv svm_lock nrip_save bugs : tlb_mmatch apic_c1e fxsave_leak sysret_ss_attrs null_seg amd_e400 spectre_v1 spectre_v2 bogomips : 2995.32 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate reports all zeros for its caches after this change (build from commit cea74a4a24c36202309e8254f1f938e2166488f3, which includes commit mentioned above): $ ./ld.so --list-diagnostics | grep -E 'level|threshold' x86.cpu_features.non_temporal_threshold=3D0x4040 x86.cpu_features.rep_movsb_threshold=3D0x800 x86.cpu_features.rep_movsb_stop_threshold=3D0x0 x86.cpu_features.rep_stosb_threshold=3D0x800 x86.cpu_features.level1_icache_size=3D0x0 x86.cpu_features.level1_icache_linesize=3D0x0 x86.cpu_features.level1_dcache_size=3D0x0 x86.cpu_features.level1_dcache_assoc=3D0x0 x86.cpu_features.level1_dcache_linesize=3D0x0 x86.cpu_features.level2_cache_size=3D0x0 x86.cpu_features.level2_cache_assoc=3D0x0 x86.cpu_features.level2_cache_linesize=3D0x0 x86.cpu_features.level3_cache_size=3D0x0 x86.cpu_features.level3_cache_assoc=3D0x0 x86.cpu_features.level3_cache_linesize=3D0x0 x86.cpu_features.level4_cache_size=3D0xffffffffffffffff A build from the 2.36 branch (commit b7008a92f505632f32b313d1033d6d15c99a0b= 31) yields this instead: $ ./ld.so --list-diagnostics | grep -E 'level|threshold' x86.cpu_features.non_temporal_threshold=3D0xc0000 x86.cpu_features.rep_movsb_threshold=3D0x800 x86.cpu_features.rep_movsb_stop_threshold=3D0x100000 x86.cpu_features.rep_stosb_threshold=3D0x800 x86.cpu_features.level1_icache_size=3D0x10000 x86.cpu_features.level1_icache_linesize=3D0x40 x86.cpu_features.level1_dcache_size=3D0x10000 x86.cpu_features.level1_dcache_assoc=3D0x2 x86.cpu_features.level1_dcache_linesize=3D0x40 x86.cpu_features.level2_cache_size=3D0x100000 x86.cpu_features.level2_cache_assoc=3D0x10 x86.cpu_features.level2_cache_linesize=3D0x40 x86.cpu_features.level3_cache_size=3D0x0 x86.cpu_features.level3_cache_assoc=3D0x0 x86.cpu_features.level3_cache_linesize=3D0x0 x86.cpu_features.level4_cache_size=3D0xffffffffffffffff So it's a regression. The CPU is probably old enough that we don't use temporal stores, so there = is probably not going to be a crash in glibc. But lack of accurate cache sizes probably still causes performance regressions elsewhere (although no one is going to use CPUs that old for their performance, admittedly). Some hypervisors also fail to pass through these CPUID values even if they identify the CPU as an AMD model: https://bugzilla.redhat.com/show_bug.cgi?id=3D2196271 Addressing hypervisor compatibility might be the important part here. --=20 You are receiving this mail because: You are on the CC list for the bug.=