diff --git a/SOURCES/glibc-rh1880670-2.patch b/SOURCES/glibc-rh1880670-2.patch new file mode 100644 index 0000000..c976be6 --- /dev/null +++ b/SOURCES/glibc-rh1880670-2.patch @@ -0,0 +1,64 @@ +commit 8813b2682e4094e43b0cf1634e99619f1b8b2c62 +Author: Sajan Karumanchi +Date: Wed Oct 28 13:05:33 2020 +0530 + + x86: Optimizing memcpy for AMD Zen architecture. + + Modifying the shareable cache '__x86_shared_cache_size', which is a + factor in computing the non-temporal threshold parameter + '__x86_shared_non_temporal_threshold' to optimize memcpy for AMD Zen + architectures. + In the existing implementation, the shareable cache is computed as 'L3 + per thread, L2 per core'. Recomputing this shareable cache as 'L3 per + CCX(Core-Complex)' has brought in performance gains. + As per the large bench variant results, this patch also addresses the + regression problem on AMD Zen architectures. + + Backport of commit 59803e81f96b479c17f583b31eac44b57591a1bf upstream, + with the fix from cb3a749a22a55645dc6a52659eea765300623f98 ("x86: + Restore processing of cache size tunables in init_cacheinfo") applied. + + Reviewed-by: Premachandra Mallappa + Co-Authored-by: Florian Weimer + +Backport is off the release/2.32/master branch upstream, to minimize +conflicts. Adjusted for missing "basic" member in struct cpu_features. + +diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c +index 42b468d0c4885bad..57c36d030a76c8b2 100644 +--- a/sysdeps/x86/cacheinfo.c ++++ b/sysdeps/x86/cacheinfo.c +@@ -722,7 +722,7 @@ intel_bug_no_cache_info: + threads = 1 << ((ecx >> 12) & 0x0f); + } + +- if (threads == 0) ++ if (threads == 0 || cpu_features->family >= 0x17) + { + /* If APIC ID width is not available, use logical + processor count. */ +@@ -737,8 +737,22 @@ intel_bug_no_cache_info: + if (threads > 0) + shared /= threads; + +- /* Account for exclusive L2 and L3 caches. */ +- shared += core; ++ /* Get shared cache per ccx for Zen architectures. */ ++ if (cpu_features->family >= 0x17) ++ { ++ unsigned int eax; ++ ++ /* Get number of threads share the L3 cache in CCX. */ ++ __cpuid_count (0x8000001D, 0x3, eax, ebx, ecx, edx); ++ ++ unsigned int threads_per_ccx = ((eax >> 14) & 0xfff) + 1; ++ shared *= threads_per_ccx; ++ } ++ else ++ { ++ /* Account for exclusive L2 and L3 caches. */ ++ shared += core; ++ } + } + + #ifndef DISABLE_PREFETCHW diff --git a/SPECS/glibc.spec b/SPECS/glibc.spec index 9a828b9..7f8c632 100644 --- a/SPECS/glibc.spec +++ b/SPECS/glibc.spec @@ -1,6 +1,6 @@ %define glibcsrcdir glibc-2.28 %define glibcversion 2.28 -%define glibcrelease 136%{?dist} +%define glibcrelease 138%{?dist} # Pre-release tarballs are pulled in from git using a command that is # effectively: # @@ -72,6 +72,9 @@ %define buildpower9 0 %endif +# RHEL 8 does not have a working %%dnl macro. +%define comment() %{nil} + ############################################################################## # Any architecture/kernel combination that supports running 32-bit and 64-bit # code in userspace is considered a biarch arch. @@ -519,6 +522,7 @@ Patch385: glibc-rh1868106-4.patch Patch386: glibc-rh1868106-5.patch Patch387: glibc-rh1868106-6.patch Patch388: glibc-rh1856398.patch +Patch389: glibc-rh1880670-2.patch ############################################################################## # Continued list of core "glibc" package information: @@ -1030,8 +1034,11 @@ This package provides debug information for package %{name}. Debug information is useful when developing applications that use this package or when debugging this package. -%endif # %{debuginfocommonarches} -%endif # 0%{?_enable_debug_packages} +%comment Matches: %ifarch %{debuginfocommonarches} +%endif + +%comment Matches: %if 0%{?_enable_debug_packages} +%endif %if %{with benchtests} %package benchtests @@ -1997,13 +2004,15 @@ egrep "$auxarches_debugsources" debuginfocommon.sources >> debuginfo.filelist egrep -v "$auxarches_debugsources" \ debuginfocommon.sources >> debuginfocommon.filelist -%endif # %{biarcharches} +%comment Matches: %ifarch %{biarcharches} +%endif # Add the list of *.a archives in the debug directory to # the common debuginfo package. list_debug_archives >> debuginfocommon.filelist -%endif # %{debuginfocommonarches} +%comment Matches: %ifarch %{debuginfocommonarches} +%endif # Remove some common directories from the common package debuginfo so that we # don't end up owning them. @@ -2023,7 +2032,8 @@ exclude_common_dirs debuginfocommon.filelist %endif exclude_common_dirs debuginfo.filelist -%endif # 0%{?_enable_debug_packages} +%comment Matches: %if 0%{?_enable_debug_packages} +%endif ############################################################################## # Delete files that we do not intended to ship with the auxarch. @@ -2039,7 +2049,8 @@ sed -e '/%%dir/d;/%%config/d;/%%verify/d;s/%%lang([^)]*) //;s#^/*##' \ debuginfocommon.filelist \ %endif | (cd %{glibc_sysroot}; xargs --no-run-if-empty rm -f 2> /dev/null || :) -%endif # %{auxarches} +%comment Matches: %ifarch %{auxarches} +%endif ############################################################################## # Run the glibc testsuite @@ -2130,7 +2141,8 @@ elf/ld.so --library-path .:elf:nptl:dlfcn \ %endif popd -%endif # %{run_glibc_tests} +%comment Matches: %if %{run_glibc_tests} +%endif %pre -p @@ -2422,6 +2434,12 @@ fi %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %changelog +* Fri Nov 6 2020 Florian Weimer - 2.28-138 +- Avoid comments after %%endif in the RPM spec file (#1894340) + +* Fri Oct 30 2020 Florian Weimer - 2.28-137 +- x86: Further memcpy optimizations for AMD Zen (#1880670) + * Tue Oct 27 2020 DJ Delorie - 2.28-136 - Allow __getauxval in testsuite check (#1856398)