diff --git a/backport-x86-Disable-AVX-Fast-Unaligned-Load-on-Hygon-1-2-3.patch b/backport-x86-Disable-AVX-Fast-Unaligned-Load-on-Hygon-1-2-3.patch new file mode 100644 index 0000000000000000000000000000000000000000..52c865ed7fb18babeb8c93f215b6b3a54e143f25 --- /dev/null +++ b/backport-x86-Disable-AVX-Fast-Unaligned-Load-on-Hygon-1-2-3.patch @@ -0,0 +1,40 @@ +From 00d406e77bb0e49d79dc1b13d7077436ee5cdf14 Mon Sep 17 00:00:00 2001 +From: litenglong +Date: Fri, 17 Oct 2025 09:45:41 +0800 +Subject: [PATCH] x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 + +- Performance testing revealed significant memcpy performance degradation + when bit_arch_AVX_Fast_Unaligned_Load is enabled on Hygon 3. +- Hygon confirmed AVX performance issues in certain memory functions. +- Glibc benchmarks show SSE outperforms AVX for + memcpy/memmove/memset/strcmp/strcpy/strlen and so on. +- Hardware differences primarily in floating-point operations don't justify + AVX usage for memory operations. + +Reviewed-by: gaoxiang +Signed-off-by: litenglong +Reviewed-by: H.J. Lu +--- + sysdeps/x86/cpu-features.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c +index b67ef541dd..c696a4d1f7 100644 +--- a/sysdeps/x86/cpu-features.c ++++ b/sysdeps/x86/cpu-features.c +@@ -1123,6 +1123,12 @@ disable_tsx: + hardware. */ + cpu_features->preferred[index_arch_Avoid_Non_Temporal_Memset] + &= ~bit_arch_Avoid_Non_Temporal_Memset; ++ if (model < 0x4) ++ { ++ /* Unaligned AVX loads are slower. */ ++ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load] ++ &= ~bit_arch_AVX_Fast_Unaligned_Load; ++ } + } + else + { +-- +2.25.1 + diff --git a/glibc.spec b/glibc.spec index 8dacf6bddc683dc32f45bb8e76710ee39f8d3130..1a3d265c4e2a439850c00c9b1cc19094f151a444 100644 --- a/glibc.spec +++ b/glibc.spec @@ -67,7 +67,7 @@ ############################################################################## Name: glibc Version: 2.38 -Release: 72 +Release: 73 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -411,8 +411,8 @@ Patch9039: revert-aarch64-Use-memcpy_simd-as-the-default-memcpy.patch Patch9040: backport-Fix-UB-on__dl_map_object_from_fd.patch Patch9041: backport-Fix-handling-of-symbol-versions-which-hash-to-zero.patch Patch9042: AArch64-modify_the_SVE_memcpy_implementation_for_32-byte_aligned_access.patch - Patch9043: 0024-Sw64-Change-libdir-from-lib-to-lib64.patch +Patch9044: backport-x86-Disable-AVX-Fast-Unaligned-Load-on-Hygon-1-2-3.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1598,6 +1598,9 @@ fi %endif %changelog +* Mon Oct 27 2025 litenglong - 2.38-73 +- x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 + * Wed Oct 22 2025 Peng Fan - 2.38-72 - LoongArch: Sync from glibc upstream