]> git.ipfire.org Git - thirdparty/glibc.git/commit
AArch64: Check kernel version for SVE ifuncs
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 21 Mar 2024 16:48:33 +0000 (16:48 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 21 Mar 2024 16:50:51 +0000 (16:50 +0000)
commit2e94e2f5d2bf2de124c8ad7da85463355e54ccb2
tree984e784ebbfb84f3a82fd0c7f1604000289b577f
parent1ea051145612f199d8716ecdf78b084b00b5a727
AArch64: Check kernel version for SVE ifuncs

Old Linux kernels disable SVE after every system call.  Calling the
SVE-optimized memcpy afterwards will then cause a trap to reenable SVE.
As a result, applications with a high use of syscalls may run slower with
the SVE memcpy.  This is true for kernels between 4.15.0 and before 6.2.0,
except for 5.14.0 which was patched.  Avoid this by checking the kernel
version and selecting the SVE ifunc on modern kernels.

Parse the kernel version reported by uname() 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.

Tested-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
sysdeps/aarch64/cpu-features.h
sysdeps/aarch64/multiarch/init-arch.h
sysdeps/aarch64/multiarch/memcpy.c
sysdeps/aarch64/multiarch/memmove.c
sysdeps/unix/sysv/linux/aarch64/cpu-features.c