Re: [PATCH 09/25] xor: move generic implementations out of asm-generic/xor.h
Eric Biggers <[email protected]>
| Newsgroups | org.kernel.vger.sparclinux,dev.linux.lists.loongarch,org.infradead.lists.linux-riscv,org.infradead.lists.linux-um,org.kernel.vger.linux-alpha,org.kernel.vger.linux-arch,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel,org.kernel.vger.linux-raid,org.kernel.vger.linux-s390,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <20260228071521.GK65277@quark> |
On Thu, Feb 26, 2026 at 07:10:21AM -0800, Christoph Hellwig wrote: > Move the generic implementations from asm-generic/xor.h to > per-implementaion .c files in lib/raid. > > Note that this would cause the second xor_block_8regs instance created by > arch/arm/lib/xor-neon.c to be generated instead of discarded as dead > code, so add a NO_TEMPLATE symbol to disable it for this case. > > Signed-off-by: Christoph Hellwig <[email protected]> This makes the generic code always be included in xor.ko, even when the architecture doesn't need it. For example, x86_64 doesn't need it, since it always selects either the AVX or SSE code. Have you considered putting the generic code in xor-core.c (or in headers included by it) before xor_arch.h is included, and putting __maybe_unused on the xor_block_template structs? Then they'll still be available for arch_xor_init() to use, but any of them that aren't used in a particular build will be optimized out as dead code by the compiler. lib/crc/ and lib/crypto/ take a similar approach for most algorithms. - Eric