From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74164347520 for ; Fri, 3 Apr 2026 06:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775198498; cv=none; b=a/AZyFuRXz1U+baVJn1GHG1pOl19njmVreDrNEx1WjaqETICap4dtjwTWFKy/5r4HF+bPE4M7/CCUWmkp7hePw1hWO4eHFPbV7Q2XHQ1xxfWZgFm/Np3hisCmVobSDCyzDENct5vC8PcCf53oGJXG3x/1Bc2b3grcn7eHdw7t14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775198498; c=relaxed/simple; bh=wTzy7kDgzNocgRWoyekjImU2Tpjcip5Jl2TRsXY1RtE=; h=Date:To:From:Subject:Message-Id; b=QWT/Ye2p0bGS5N3wf8swe5YCq/LmU6TctR3N1gsu8iAOqQzKjk0Y4OgG/5YUlwwZypJWgg/6sWbrnKCZGhzrGW/wdt3gwrE3kTYMkPNwvgwR6brv+79uTxBOWSMxb5EapeRwvRHSdAk1NrE7Wt1kz2PrmnSeBX+uiWl7uhOBOmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=DraObNxr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="DraObNxr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02302C4CEF7; Fri, 3 Apr 2026 06:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1775198498; bh=wTzy7kDgzNocgRWoyekjImU2Tpjcip5Jl2TRsXY1RtE=; h=Date:To:From:Subject:From; b=DraObNxrsc821lxlw6jAjg2g7sh38P2kuVyybxOMQvbCz0wgEUjQezGfxB/T3SQAJ klvjW9Szuze+LV2Ow8UueWYOwywFdclqfKMLZ8p1pgzFapKckf1XtOkCkUNFSZhgfS 65OqBuwClfUZowNhpfP60z56JoHCN2b6Btd7OK0c= Date: Thu, 02 Apr 2026 23:41:37 -0700 To: mm-commits@vger.kernel.org,will@kernel.org,tytso@mit.edu,svens@linux.ibm.com,song@kernel.org,richard@nod.at,richard.henderson@linaro.org,palmer@dabbelt.com,npiggin@gmail.com,mpe@ellerman.id.au,mingo@redhat.com,mattst88@gmail.com,maddy@linux.ibm.com,linux@armlinux.org.uk,linmag7@gmail.com,linan122@huawei.com,kernel@xen0n.name,johannes@sipsolutions.net,jason@zx2c4.com,hpa@zytor.com,herbert@gondor.apana.org.au,hca@linux.ibm.com,gor@linux.ibm.com,ebiggers@kernel.org,dsterba@suse.com,davem@davemloft.net,dan.j.williams@intel.com,clm@fb.com,chenhuacai@kernel.org,catalin.marinas@arm.com,bp@alien8.de,borntraeger@linux.ibm.com,arnd@arndb.de,ardb@kernel.org,aou@eecs.berkeley.edu,anton.ivanov@cambridgegreys.com,andreas@gaisler.com,alex@ghiti.fr,agordeev@linux.ibm.com,hch@lst.de,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-nonmm-stable] xor-cleanup-registration-and-probing.patch removed from -mm tree Message-Id: <20260403064138.02302C4CEF7@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: xor: cleanup registration and probing has been removed from the -mm tree. Its filename was xor-cleanup-registration-and-probing.patch This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Christoph Hellwig Subject: xor: cleanup registration and probing Date: Fri, 27 Mar 2026 07:16:39 +0100 Originally, the XOR code benchmarked all algorithms at load time, but it has since then been hacked multiple times to allow forcing an algorithm, and then commit 524ccdbdfb52 ("crypto: xor - defer load time benchmark to a later time") changed the logic to a two-step process or registration and benchmarking, but only when built-in. Rework this, so that the XOR_TRY_TEMPLATES macro magic now always just deals with adding the templates to the list, and benchmarking is always done in a second pass; for modular builds from module_init, and for the built-in case using a separate init call level. Link: https://lkml.kernel.org/r/20260327061704.3707577-8-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 --- lib/raid/xor/xor-core.c | 98 ++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 50 deletions(-) --- a/lib/raid/xor/xor-core.c~xor-cleanup-registration-and-probing +++ a/lib/raid/xor/xor-core.c @@ -52,29 +52,14 @@ EXPORT_SYMBOL(xor_blocks); /* Set of all registered templates. */ static struct xor_block_template *__initdata template_list; +static bool __initdata xor_forced = false; -#ifndef MODULE static void __init do_xor_register(struct xor_block_template *tmpl) { tmpl->next = template_list; template_list = tmpl; } -static int __init register_xor_blocks(void) -{ - active_template = XOR_SELECT_TEMPLATE(NULL); - - if (!active_template) { -#define xor_speed do_xor_register - // register all the templates and pick the first as the default - XOR_TRY_TEMPLATES; -#undef xor_speed - active_template = template_list; - } - return 0; -} -#endif - #define BENCH_SIZE 4096 #define REPS 800U @@ -85,9 +70,6 @@ do_xor_speed(struct xor_block_template * unsigned long reps; ktime_t min, start, t0; - tmpl->next = template_list; - template_list = tmpl; - preempt_disable(); reps = 0; @@ -111,63 +93,79 @@ do_xor_speed(struct xor_block_template * pr_info(" %-16s: %5d MB/sec\n", tmpl->name, speed); } -static int __init -calibrate_xor_blocks(void) +static int __init calibrate_xor_blocks(void) { void *b1, *b2; struct xor_block_template *f, *fastest; - fastest = XOR_SELECT_TEMPLATE(NULL); - - if (fastest) { - printk(KERN_INFO "xor: automatically using best " - "checksumming function %-10s\n", - fastest->name); - goto out; - } + if (xor_forced) + return 0; b1 = (void *) __get_free_pages(GFP_KERNEL, 2); if (!b1) { - printk(KERN_WARNING "xor: Yikes! No memory available.\n"); + pr_warn("xor: Yikes! No memory available.\n"); return -ENOMEM; } b2 = b1 + 2*PAGE_SIZE + BENCH_SIZE; - /* - * If this arch/cpu has a short-circuited selection, don't loop through - * all the possible functions, just test the best one - */ - -#define xor_speed(templ) do_xor_speed((templ), b1, b2) - - printk(KERN_INFO "xor: measuring software checksum speed\n"); - template_list = NULL; - XOR_TRY_TEMPLATES; + pr_info("xor: measuring software checksum speed\n"); fastest = template_list; - for (f = fastest; f; f = f->next) + for (f = template_list; f; f = f->next) { + do_xor_speed(f, b1, b2); if (f->speed > fastest->speed) fastest = f; - + } + active_template = fastest; pr_info("xor: using function: %s (%d MB/sec)\n", fastest->name, fastest->speed); + free_pages((unsigned long)b1, 2); + return 0; +} + +static int __init xor_init(void) +{ + /* + * If this arch/cpu has a short-circuited selection, don't loop through + * all the possible functions, just use the best one. + */ + active_template = XOR_SELECT_TEMPLATE(NULL); + if (active_template) { + pr_info("xor: automatically using best checksumming function %-10s\n", + active_template->name); + xor_forced = true; + return 0; + } + +#define xor_speed do_xor_register + XOR_TRY_TEMPLATES; #undef xor_speed - free_pages((unsigned long)b1, 2); -out: - active_template = fastest; +#ifdef MODULE + return calibrate_xor_blocks(); +#else + /* + * Pick the first template as the temporary default until calibration + * happens. + */ + active_template = template_list; return 0; +#endif } -static __exit void xor_exit(void) { } +static __exit void xor_exit(void) +{ +} MODULE_DESCRIPTION("RAID-5 checksumming functions"); MODULE_LICENSE("GPL"); +/* + * When built-in we must register the default template before md, but we don't + * want calibration to run that early as that would delay the boot process. + */ #ifndef MODULE -/* when built-in xor.o must initialize before drivers/md/md.o */ -core_initcall(register_xor_blocks); +__initcall(calibrate_xor_blocks); #endif - -module_init(calibrate_xor_blocks); +core_initcall(xor_init); module_exit(xor_exit); _ Patches currently in -mm which might be from hch@lst.de are