[PATCH] AArch64: Remove prefer_sve_ifuncs
Yury Khrustalev
yury.khrustalev@arm.com
Mon Mar 16 14:53:28 GMT 2026
On Mon, Mar 16, 2026 at 02:38:52PM +0000, Wilco Dijkstra wrote:
>
> Remove the prefer_sve_ifuncs CPU feature since it was intended for older
> kernels. Current distros all use modern Linux kernels with improved support for
> SVE save/restore, making this check redundant.
>
> OK for commit?
Seems OK to me, however please see one comment below.
>
> ...
> diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> index 15aed15a667e89abd2790a22a319a8a6aaecba02..1e4f8a86b1017e5682aec29e975061a31160af46 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> @@ -65,46 +65,6 @@ get_midr_from_mcpu (const struct tunable_str_t *mcpu)
> return UINT64_MAX;
> }
>
> -#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)
> {
> @@ -171,13 +131,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;
What if cpu_features->sve is false?
> -
> -#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;
>
>
More information about the Libc-alpha
mailing list