From: Christoph Hellwig Date: Fri, 27 Mar 2026 06:16:33 +0000 (+0100) Subject: xor: assert that xor_blocks is not call from interrupt context X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d8593b8f93541d9fef81130f2f33f25c47593094;p=thirdparty%2Fkernel%2Fstable.git xor: assert that xor_blocks is not call from interrupt context Patch series "cleanup the RAID5 XOR library", v4. The XOR library used for the RAID5 parity is a bit of a mess right now. The main file sits in crypto/ despite not being cryptography and not using the crypto API, with the generic implementations sitting in include/asm-generic and the arch implementations sitting in an asm/ header in theory. The latter doesn't work for many cases, so architectures often build the code directly into the core kernel, or create another module for the architecture code. Change this to a single module in lib/ that also contains the architecture optimizations, similar to the library work Eric Biggers has done for the CRC and crypto libraries later. After that it changes to better calling conventions that allow for smarter architecture implementations (although none is contained here yet), and uses static_call to avoid indirection function call overhead. This patch (of 27): Most of the optimized xor_blocks versions require FPU/vector registers, which generally are not supported in interrupt context. Both callers already are in user context, so enforce this at the highest level. Link: https://lkml.kernel.org/r/20260327061704.3707577-1-hch@lst.de Link: https://lkml.kernel.org/r/20260327061704.3707577-2-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Eric Biggers Tested-by: Eric Biggers Cc: Albert Ou Cc: Alexander Gordeev Cc: Alexandre Ghiti Cc: Andreas Larsson Cc: Anton Ivanov Cc: Ard Biesheuvel Cc: Arnd Bergmann Cc: "Borislav Petkov (AMD)" Cc: Catalin Marinas Cc: Chris Mason Cc: Christian Borntraeger Cc: Dan Williams Cc: David S. Miller Cc: David Sterba Cc: Heiko Carstens Cc: Herbert Xu Cc: "H. Peter Anvin" Cc: Huacai Chen Cc: Ingo Molnar Cc: Jason A. Donenfeld Cc: Johannes Berg Cc: Li Nan Cc: Madhavan Srinivasan Cc: Magnus Lindholm Cc: Matt Turner Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Palmer Dabbelt Cc: Richard Henderson Cc: Richard Weinberger Cc: Russell King Cc: Song Liu Cc: Sven Schnelle Cc: Ted Ts'o Cc: Vasily Gorbik Cc: WANG Xuerui Cc: Will Deacon Signed-off-by: Andrew Morton --- diff --git a/crypto/xor.c b/crypto/xor.c index f39621a57bb33..df530ddc9f06d 100644 --- a/crypto/xor.c +++ b/crypto/xor.c @@ -28,6 +28,8 @@ xor_blocks(unsigned int src_count, unsigned int bytes, void *dest, void **srcs) { unsigned long *p1, *p2, *p3, *p4; + WARN_ON_ONCE(!in_task() || irqs_disabled() || softirq_count()); + p1 = (unsigned long *) srcs[0]; if (src_count == 1) { active_template->do_2(bytes, dest, p1);