[PATCH] Revert "AArch64: Check kernel version for SVE ifuncs"
authorAurelien Jarno <aurelien@aurel32.net>
Sat, 26 Oct 2024 20:41:09 +0000 (22:41 +0200)
committerAurelien Jarno <aurel32@debian.org>
Thu, 6 Mar 2025 22:46:53 +0000 (23:46 +0100)
This reverts commit 24de733967029fd902c34073d2ab25b900887352.

Gbp-Pq: Topic arm64
Gbp-Pq: Name local-revert-aarch64-check-kernel-version-for-sve-ifuncs.diff

sysdeps/aarch64/multiarch/init-arch.h
sysdeps/aarch64/multiarch/memcpy.c
sysdeps/aarch64/multiarch/memmove.c
sysdeps/unix/sysv/linux/aarch64/cpu-features.c
sysdeps/unix/sysv/linux/aarch64/cpu-features.h

index 5b2cf5cb127bb053ca817c6c69d68afec784d5fc..5da1656954aa63b7479033fc665080a5dcaf0236 100644 (file)
@@ -36,7 +36,5 @@
     MTE_ENABLED ();                                                          \
   bool __attribute__((unused)) sve =                                         \
     GLRO(dl_aarch64_cpu_features).sve;                                       \
-  bool __attribute__((unused)) prefer_sve_ifuncs =                           \
-    GLRO(dl_aarch64_cpu_features).prefer_sve_ifuncs;                         \
   bool __attribute__((unused)) mops =                                        \
     GLRO(dl_aarch64_cpu_features).mops;
index 3de66c14d4509d03390198b4bd66ff0008fa1799..d1cf5bec16eb120c9c27272cb128a3d25af6e28f 100644 (file)
@@ -47,7 +47,7 @@ select_memcpy_ifunc (void)
     {
       if (IS_A64FX (midr))
        return __memcpy_a64fx;
-      return prefer_sve_ifuncs ? __memcpy_sve : __memcpy_generic;
+      return __memcpy_sve;
     }
 
   if (IS_THUNDERX (midr))
index fdcf4188209379b34162cb7cd89aede7a36585bb..90729e02752606956685fffd1712d022ff62c050 100644 (file)
@@ -47,7 +47,7 @@ select_memmove_ifunc (void)
     {
       if (IS_A64FX (midr))
        return __memmove_a64fx;
-      return prefer_sve_ifuncs ? __memmove_sve : __memmove_generic;
+      return __memmove_sve;
     }
 
   if (IS_THUNDERX (midr))
index 25431283527f844bfc059afb74cc1521de38ae65..6ee1cb4bc2dffd39f25ced40743d4f6527c8940f 100644 (file)
@@ -20,7 +20,6 @@
 #include <sys/auxv.h>
 #include <elf/dl-hwcaps.h>
 #include <sys/prctl.h>
-#include <sys/utsname.h>
 
 #define DCZID_DZP_MASK (1 << 4)
 #define DCZID_BS_MASK (0xf)
@@ -60,46 +59,6 @@ get_midr_from_mcpu (const char *mcpu)
 }
 #endif
 
-#if __LINUX_KERNEL_VERSION < 0x060200
-
-/* Return true if we prefer using SVE in string ifuncs.  Old kernels disable
-   SVE after every system call which results in unnecessary traps if memcpy
-   uses SVE.  This is true for kernels between 4.15.0 and before 6.2.0, except
-   for 5.14.0 which was patched.  For these versions return false to avoid using
-   SVE ifuncs.
-   Parse the kernel version into a 24-bit kernel.major.minor value without
-   calling any library functions.  If uname() is not supported or if the version
-   format is not recognized, assume the kernel is modern and return true.  */
-
-static inline bool
-prefer_sve_ifuncs (void)
-{
-  struct utsname buf;
-  const char *p = &buf.release[0];
-  int kernel = 0;
-  int val;
-
-  if (__uname (&buf) < 0)
-    return true;
-
-  for (int shift = 16; shift >= 0; shift -= 8)
-    {
-      for (val = 0; *p >= '0' && *p <= '9'; p++)
-       val = val * 10 + *p - '0';
-      kernel |= (val & 255) << shift;
-      if (*p++ != '.')
-       break;
-    }
-
-  if (kernel >= 0x060200 || kernel == 0x050e00)
-    return true;
-  if (kernel >= 0x040f00)
-    return false;
-  return true;
-}
-
-#endif
-
 static inline void
 init_cpu_features (struct cpu_features *cpu_features)
 {
@@ -166,13 +125,6 @@ init_cpu_features (struct cpu_features *cpu_features)
   /* Check if SVE is supported.  */
   cpu_features->sve = GLRO (dl_hwcap) & HWCAP_SVE;
 
-  cpu_features->prefer_sve_ifuncs = cpu_features->sve;
-
-#if __LINUX_KERNEL_VERSION < 0x060200
-  if (cpu_features->sve)
-    cpu_features->prefer_sve_ifuncs = prefer_sve_ifuncs ();
-#endif
-
   /* Check if MOPS is supported.  */
   cpu_features->mops = GLRO (dl_hwcap2) & HWCAP2_MOPS;
 }
index d51597b9237e44d1fbaebd86cbe1e11febb97cd8..b4bd43a228140607066cef1a8a752f915d98d710 100644 (file)
@@ -71,7 +71,6 @@ struct cpu_features
   /* Currently, the GLIBC memory tagging tunable only defines 8 bits.  */
   uint8_t mte_state;
   bool sve;
-  bool prefer_sve_ifuncs;
   bool mops;
 };