unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	 'GNU C Library' <libc-alpha@sourceware.org>,
	 Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: Re: [PATCH v2] AArch64: Check kernel version for SVE ifuncs
Date: Thu, 21 Mar 2024 12:44:04 +0100	[thread overview]
Message-ID: <87o7b7zu63.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <ZfsLKSayKkVRboeh@arm.com> (Szabolcs Nagy's message of "Wed, 20 Mar 2024 16:13:29 +0000")

* 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


  reply	other threads:[~2024-03-21 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 14:14 [PATCH v2] AArch64: Check kernel version for SVE ifuncs Wilco Dijkstra
2024-03-20 15:05 ` Szabolcs Nagy
2024-03-20 15:39   ` Florian Weimer
2024-03-20 16:13     ` Szabolcs Nagy
2024-03-21 11:44       ` Florian Weimer [this message]
2024-03-21 15:43         ` Adhemerval Zanella Netto
2024-03-21 16:11           ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7b7zu63.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).