Re: [PATCH 09/25] xor: move generic implementations out of asm-generic/xor.h

Christoph Hellwig
2026-03-03T16:09:20Z

On Fri, Feb 27, 2026 at 11:15:21PM -0800, Eric Biggers wrote:
> 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.

True. OTOH it is tiny.

> 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.

And earlier version did this, but it's a bit ugly. What I might
consider is to require architectures that provide optimized version
to opt into any generic one they want to use. This would require
extra kconfig symbols, but be a lot cleaner overall.