sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev,
	linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	sparclinux@vger.kernel.org, linux-s390@vger.kernel.org,
	x86@kernel.org
Subject: Re: [PATCH] lib/crc: make the CPU feature static keys __ro_after_init
Date: Thu, 17 Apr 2025 09:32:21 -0700	[thread overview]
Message-ID: <20250417163221.GA800@quark.localdomain> (raw)
In-Reply-To: <20250417125318.12521F12-hca@linux.ibm.com>

On Thu, Apr 17, 2025 at 02:53:18PM +0200, Heiko Carstens wrote:
> On Sun, Apr 13, 2025 at 08:43:50AM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > All of the CRC library's CPU feature static_keys are initialized by
> > initcalls and never change afterwards, so there's no need for them to be
> > in the regular .data section.  Put them in .data..ro_after_init instead.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > ---
> > 
> > I'm planning to take this via the crc tree.
> > 
> >  arch/arm/lib/crc-t10dif-glue.c       | 4 ++--
> >  arch/arm/lib/crc32-glue.c            | 4 ++--
> >  arch/arm64/lib/crc-t10dif-glue.c     | 4 ++--
> >  arch/loongarch/lib/crc32-loongarch.c | 2 +-
> >  arch/mips/lib/crc32-mips.c           | 2 +-
> >  arch/powerpc/lib/crc-t10dif-glue.c   | 2 +-
> >  arch/powerpc/lib/crc32-glue.c        | 2 +-
> >  arch/s390/lib/crc32-glue.c           | 2 +-
> 
> 
> Acked-by: Heiko Carstens <hca@linux.ibm.com> # s390
> 
> I just realized that we can get rid of the static key in the s390
> piece and end up with slightly better code. Could you add the patch
> below to your tree, please? If this would go via the s390 tree this
> would result in a merge conflict, which is unnecessary.
> 
> From 6c4c0ca6fe87e43acf6192f1afc0a6346db994f4 Mon Sep 17 00:00:00 2001
> From: Heiko Carstens <hca@linux.ibm.com>
> Date: Thu, 17 Apr 2025 14:30:56 +0200
> Subject: [PATCH] s390/crc32: Remove have_vxrs static key
> 
> Replace the have_vxrs static key with a cpu_has_vx() call.  cpu_has_vx()
> resolves into a compile time constant (true) if the kernel is compiled for
> z13 or newer. Otherwise it generates an unconditional one instruction
> branch, which is patched based on CPU alternatives.
> 
> In any case the generated code is at least as good as before and avoids
> static key handling.
> 
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/lib/crc32-glue.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)

Thanks!  Applied to
https://web.git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

- Eric

      reply	other threads:[~2025-04-17 16:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-13 15:43 [PATCH] lib/crc: make the CPU feature static keys __ro_after_init Eric Biggers
2025-04-14  7:03 ` Ard Biesheuvel
2025-04-14 14:03 ` Martin K. Petersen
2025-04-17 12:53 ` Heiko Carstens
2025-04-17 16:32   ` Eric Biggers [this message]

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

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

  git send-email \
    --in-reply-to=20250417163221.GA800@quark.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=sparclinux@vger.kernel.org \
    --cc=x86@kernel.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 NNTP newsgroup(s).