[PATCH v2] AArch64: Check kernel version for SVE ifuncs
Florian Weimer
fweimer@redhat.com
Thu Mar 21 11:44:04 GMT 2024
* Szabolcs Nagy:
> The 03/20/2024 16:39, Florian Weimer wrote:
>> * Szabolcs Nagy:
>>
>> > The 03/18/2024 14:14, Wilco Dijkstra wrote:
>> >>
>> >> v2: Add __LINUX_KERNEL_VERSION #ifdefs, improve parser, use 8:8:8 format.
>> >>
>> >> 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.
>> >>
>> >> Passes regress, OK for commit?
>> >
>> > OK to commit. (clearly a hack but what can we do..)
>> >
>> > Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
>>
>> I have not had a chance to test this yet with the el9 kernel.
>>
>> I will try to do this tomorrow.
>>
>> Do we need to include other distribution LTS kernels in the version
>> check?
>
> i checked some (suse,ubuntu,debian) and they didn't have the
> SVE backport (maybe we should request those backports, but
> today the version check looks ok)
I think we should make this change in one commit if at all possible,
otherwise we risk creating too much divergence. But if you consider
further kernel backports unlikely, the v2 patch is okay.
Anyway, I verified this against 4.18 and 5.14 kernels, and got the
expected results (__memcpy_generic and __memcpy_sve).
Tested-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list