[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241021175640.GA1370449@google.com>
Date: Mon, 21 Oct 2024 17:56:40 +0000
From: Eric Biggers <ebiggers@...nel.org>
To: Heiko Carstens <hca@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-crypto@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
linux-mips@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
loongarch@...ts.linux.dev, sparclinux@...r.kernel.org,
x86@...nel.org, Hendrik Brueckner <brueckner@...ux.ibm.com>
Subject: Re: [PATCH 07/15] s390/crc32: expose CRC32 functions through lib
On Mon, Oct 21, 2024 at 12:40:07PM +0200, Heiko Carstens wrote:
> What makes sure that all of the code is available automatically if the
> CPU supports the instructions like before? I can see that all CRC32
> related config options support also module build options.
>
> Before this patch, this module and hence the fast crc32 variants were
> loaded automatically when required CPU features were present.
> Right now I don't how this is happening with this series.
There's just a direct symbol dependency now. For example
ext4.ko -> crc32-s390.ko [crc32c_le_arch] -> crc32.ko [crc32c_le_base].
So, crc32-$arch.ko always gets loaded when there is a user of one of the CRC32
library functions, provided that it was enabled in the kconfig.
crc32-$arch then calls either the accelerated code or the base code depending on
the CPU features. On most architectures including s390, I made this use a
static branch, so there is almost no overhead (much less overhead than the
indirect call that was needed before).
This is the same way that some of the crypto library code already works.
> > +static int __init crc32_s390_init(void)
> > +{
> > + if (cpu_have_feature(S390_CPU_FEATURE_VXRS))
> > + static_branch_enable(&have_vxrs);
> > + return 0;
> > +}
> > +arch_initcall(crc32_s390_init);
>
> I guess this should be changed to:
>
> module_cpu_feature_match(S390_CPU_FEATURE_VXRS, ...);
>
> Which would make at least the library functions available if cpu
> features are present. But this looks only like a partial solution of
> the above described problem.
>
> But maybe I'm missing something.
This is not needed, as per the above.
- Eric
Powered by blists - more mailing lists