get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2216702/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2216702,
    "url": "http://patchwork.ozlabs.org/api/patches/2216702/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260327061704.3707577-8-hch@lst.de/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20260327061704.3707577-8-hch@lst.de>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260327061704.3707577-8-hch@lst.de/",
    "date": "2026-03-27T06:16:39",
    "name": "[07/28] xor: cleanup registration and probing",
    "commit_ref": null,
    "pull_url": null,
    "state": "handled-elsewhere",
    "archived": false,
    "hash": "748f957c5cfcce9daec437fc6a7e309809f417f8",
    "submitter": {
        "id": 82,
        "url": "http://patchwork.ozlabs.org/api/people/82/?format=api",
        "name": "Christoph Hellwig",
        "email": "hch@lst.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260327061704.3707577-8-hch@lst.de/mbox/",
    "series": [
        {
            "id": 497693,
            "url": "http://patchwork.ozlabs.org/api/series/497693/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=497693",
            "date": "2026-03-27T06:16:33",
            "name": "[01/28] xor: assert that xor_blocks is not call from interrupt context",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497693/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216702/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216702/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-18877-incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256\n header.s=bombadil.20210309 header.b=lWPv5jPK;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-18877-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n arc=none smtp.remote-ip=\"2607:7c80:54:3::133\"",
            "lists.ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=lst.de",
            "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256\n header.s=bombadil.20210309 header.b=lWPv5jPK;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=bombadil.srs.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=batv+7b1de7ca9b09bfe890a7+8251+infradead.org+hch@bombadil.srs.infradead.org;\n receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhr8Z0LWHz1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 17:19:42 +1100 (AEDT)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fhr8Y6SxRz302l;\n\tFri, 27 Mar 2026 17:19:41 +1100 (AEDT)",
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4fhr8Y1nqMz302K\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 27 Mar 2026 17:19:41 +1100 (AEDT)",
            "from\n 2a02-8389-2341-5b80-d601-7564-c2e0-491c.cable.dynamic.v6.surfer.at\n ([2a02:8389:2341:5b80:d601:7564:c2e0:491c] helo=localhost)\n\tby bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w60XT-00000006lGc-035D;\n\tFri, 27 Mar 2026 06:19:23 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1774592381;\n\tcv=none;\n b=ESAsW9dCLPbtvXyLGS+9VhKo+AuxVywku7hwiCElC4JMRSp0KCu/qdcMgs/jZKkILtsfSDn6ctL9DYsTbcFB+sb/RyLN0xBr1H9ZnxjoJfVegrM5qI+s1Jl4KnqUytdPA7AqVitzlesH9cEB4rJlrGlz/r36PUZsGWvdwmjY1NKfzdBN66ENu+/qvBCE1MUMWCnZdbX8rfhvA6acBzQEy69URx6MvWe1CI65zgQLI6JrPZMXRIOBC2I8WUfTLPmuQNblDoIuBrNMWKJ8Pwdlgewd7cgZ6MTYhjI0ERY19sagoXYmzSG+X/UM3rzWbkMj1XLnT+AUf9OX8hAAr7XHnA==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1774592381; c=relaxed/relaxed;\n\tbh=jmVHDIGjSVXJ6mznFR3BDf1KydPvvWCTsKbXoXp3DKw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=GsTWEzog3qk+02RX56+CuR1njW+jcbsBwv+x1eVjl+KXMnMOYmjY11Aa8F7Xd6bERRn40maT+mQ5S/1cbb1C3ztkjCHoK8jYpAOrTMjJhoEQoHW92XxwPeOQ3DM8jo1h+Z1mhqU0hkSWSvRLhF3s/UdjeXVfJGjNjPEpWVztm43EuFZQ0/X9GFx8lhdfMMwUq2GJoWQXS6GxL7f7tSztG8WkhLXX0VYle5uyP2r6qZhE1WdU43o2T+U0bFhcy4Sop6wDFKFZo4qHx/Uv7YTqOdo5DICJOLB8pyU0ZXW1KoeJmpKyp2yTv5pGYkN23GV+riWkAsB7zZyZ1wNUuOcGXQ==",
        "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=lst.de; dkim=pass (2048-bit key;\n secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256\n header.s=bombadil.20210309 header.b=lWPv5jPK; dkim-atps=neutral;\n spf=none (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=batv+7b1de7ca9b09bfe890a7+8251+infradead.org+hch@bombadil.srs.infradead.org;\n receiver=lists.ozlabs.org) smtp.mailfrom=bombadil.srs.infradead.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding:\n\tMIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender\n\t:Reply-To:Content-Type:Content-ID:Content-Description;\n\tbh=jmVHDIGjSVXJ6mznFR3BDf1KydPvvWCTsKbXoXp3DKw=; b=lWPv5jPKihCA32F3UKBdByaXl7\n\tpbWDfpOrSAFEaf6kX9XfT1jodgX/9/26M3ApTmAKW78YkR3KP+0dU4slimo/yo4qWYJitB/AvWWB2\n\tqmVOHeAZ7TG4tkCvsrCwdPKmsLZARoBpS9urIVhxPivX4TNC6oCQv2vMGnZRJ92L7T6PeVxJ4ZxwF\n\tcvD2YIgZOU+ThEDk0m5MowdWm3bhT0m9Vm+cQH4QyWvNP5BYy04rOmoVW6kSLjXnLGQIJ8LQbj08U\n\tyUKJwmgFiElfAlrp4nIVhEf92T89ZeolQS7dhLj4adW9VocIiTZ4lB19cajRfX9lGKpCXd2GtgcM3\n\tUL9/pb5A==;",
        "From": "Christoph Hellwig <hch@lst.de>",
        "To": "Andrew Morton <akpm@linux-foundation.org>",
        "Cc": "Richard Henderson <richard.henderson@linaro.org>,\n\tMatt Turner <mattst88@gmail.com>,\n\tMagnus Lindholm <linmag7@gmail.com>,\n\tRussell King <linux@armlinux.org.uk>,\n\tCatalin Marinas <catalin.marinas@arm.com>,\n\tWill Deacon <will@kernel.org>,\n\tArd Biesheuvel <ardb@kernel.org>,\n\tHuacai Chen <chenhuacai@kernel.org>,\n\tWANG Xuerui <kernel@xen0n.name>,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>,\n\tMichael Ellerman <mpe@ellerman.id.au>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\t\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\tPaul Walmsley <pjw@kernel.org>,\n\tPalmer Dabbelt <palmer@dabbelt.com>,\n\tAlbert Ou <aou@eecs.berkeley.edu>,\n\tAlexandre Ghiti <alex@ghiti.fr>,\n\tHeiko Carstens <hca@linux.ibm.com>,\n\tVasily Gorbik <gor@linux.ibm.com>,\n\tAlexander Gordeev <agordeev@linux.ibm.com>,\n\tChristian Borntraeger <borntraeger@linux.ibm.com>,\n\tSven Schnelle <svens@linux.ibm.com>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tAndreas Larsson <andreas@gaisler.com>,\n\tRichard Weinberger <richard@nod.at>,\n\tAnton Ivanov <anton.ivanov@cambridgegreys.com>,\n\tJohannes Berg <johannes@sipsolutions.net>,\n\tThomas Gleixner <tglx@kernel.org>,\n\tIngo Molnar <mingo@redhat.com>,\n\tBorislav Petkov <bp@alien8.de>,\n\tDave Hansen <dave.hansen@linux.intel.com>,\n\tx86@kernel.org,\n\t\"H. Peter Anvin\" <hpa@zytor.com>,\n\tHerbert Xu <herbert@gondor.apana.org.au>,\n\tDan Williams <dan.j.williams@intel.com>,\n\tChris Mason <clm@fb.com>,\n\tDavid Sterba <dsterba@suse.com>,\n\tArnd Bergmann <arnd@arndb.de>,\n\tSong Liu <song@kernel.org>,\n\tYu Kuai <yukuai@fnnas.com>,\n\tLi Nan <linan122@huawei.com>,\n\t\"Theodore Ts'o\" <tytso@mit.edu>,\n\t\"Jason A. Donenfeld\" <Jason@zx2c4.com>,\n\tlinux-alpha@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\tloongarch@lists.linux.dev,\n\tlinuxppc-dev@lists.ozlabs.org,\n\tlinux-riscv@lists.infradead.org,\n\tlinux-s390@vger.kernel.org,\n\tsparclinux@vger.kernel.org,\n\tlinux-um@lists.infradead.org,\n\tlinux-crypto@vger.kernel.org,\n\tlinux-btrfs@vger.kernel.org,\n\tlinux-arch@vger.kernel.org,\n\tlinux-raid@vger.kernel.org",
        "Subject": "[PATCH 07/28] xor: cleanup registration and probing",
        "Date": "Fri, 27 Mar 2026 07:16:39 +0100",
        "Message-ID": "<20260327061704.3707577-8-hch@lst.de>",
        "X-Mailer": "git-send-email 2.47.3",
        "In-Reply-To": "<20260327061704.3707577-1-hch@lst.de>",
        "References": "<20260327061704.3707577-1-hch@lst.de>",
        "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org",
        "List-Id": "<linuxppc-dev.lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>",
        "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>",
        "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>",
        "Precedence": "list",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-SRS-Rewrite": "SMTP reverse-path rewritten from <hch@infradead.org> by\n bombadil.infradead.org. See http://www.infradead.org/rpr.html",
        "X-Spam-Status": "No, score=0.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tHEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE\n\tautolearn=disabled version=4.0.1 OzLabs 8",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"
    },
    "content": "Originally, the XOR code benchmarked all algorithms at load time, but\nit has since then been hacked multiple times to allow forcing an\nalgorithm, and then commit 524ccdbdfb52 (\"crypto: xor - defer load time\nbenchmark to a later time\") changed the logic to a two-step process\nor registration and benchmarking, but only when built-in.\n\nRework this, so that the XOR_TRY_TEMPLATES macro magic now always just\ndeals with adding the templates to the list, and benchmarking is always\ndone in a second pass; for modular builds from module_init, and for the\nbuilt-in case using a separate init call level.\n\nSigned-off-by: Christoph Hellwig <hch@lst.de>\n---\n lib/raid/xor/xor-core.c | 98 ++++++++++++++++++++---------------------\n 1 file changed, 48 insertions(+), 50 deletions(-)",
    "diff": "diff --git a/lib/raid/xor/xor-core.c b/lib/raid/xor/xor-core.c\nindex c54f48405c40..e6e593e404fb 100644\n--- a/lib/raid/xor/xor-core.c\n+++ b/lib/raid/xor/xor-core.c\n@@ -52,29 +52,14 @@ EXPORT_SYMBOL(xor_blocks);\n \n /* Set of all registered templates.  */\n static struct xor_block_template *__initdata template_list;\n+static bool __initdata xor_forced = false;\n \n-#ifndef MODULE\n static void __init do_xor_register(struct xor_block_template *tmpl)\n {\n \ttmpl->next = template_list;\n \ttemplate_list = tmpl;\n }\n \n-static int __init register_xor_blocks(void)\n-{\n-\tactive_template = XOR_SELECT_TEMPLATE(NULL);\n-\n-\tif (!active_template) {\n-#define xor_speed\tdo_xor_register\n-\t\t// register all the templates and pick the first as the default\n-\t\tXOR_TRY_TEMPLATES;\n-#undef xor_speed\n-\t\tactive_template = template_list;\n-\t}\n-\treturn 0;\n-}\n-#endif\n-\n #define BENCH_SIZE\t4096\n #define REPS\t\t800U\n \n@@ -85,9 +70,6 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)\n \tunsigned long reps;\n \tktime_t min, start, t0;\n \n-\ttmpl->next = template_list;\n-\ttemplate_list = tmpl;\n-\n \tpreempt_disable();\n \n \treps = 0;\n@@ -111,63 +93,79 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)\n \tpr_info(\"   %-16s: %5d MB/sec\\n\", tmpl->name, speed);\n }\n \n-static int __init\n-calibrate_xor_blocks(void)\n+static int __init calibrate_xor_blocks(void)\n {\n \tvoid *b1, *b2;\n \tstruct xor_block_template *f, *fastest;\n \n-\tfastest = XOR_SELECT_TEMPLATE(NULL);\n-\n-\tif (fastest) {\n-\t\tprintk(KERN_INFO \"xor: automatically using best \"\n-\t\t\t\t \"checksumming function   %-10s\\n\",\n-\t\t       fastest->name);\n-\t\tgoto out;\n-\t}\n+\tif (xor_forced)\n+\t\treturn 0;\n \n \tb1 = (void *) __get_free_pages(GFP_KERNEL, 2);\n \tif (!b1) {\n-\t\tprintk(KERN_WARNING \"xor: Yikes!  No memory available.\\n\");\n+\t\tpr_warn(\"xor: Yikes!  No memory available.\\n\");\n \t\treturn -ENOMEM;\n \t}\n \tb2 = b1 + 2*PAGE_SIZE + BENCH_SIZE;\n \n-\t/*\n-\t * If this arch/cpu has a short-circuited selection, don't loop through\n-\t * all the possible functions, just test the best one\n-\t */\n-\n-#define xor_speed(templ)\tdo_xor_speed((templ), b1, b2)\n-\n-\tprintk(KERN_INFO \"xor: measuring software checksum speed\\n\");\n-\ttemplate_list = NULL;\n-\tXOR_TRY_TEMPLATES;\n+\tpr_info(\"xor: measuring software checksum speed\\n\");\n \tfastest = template_list;\n-\tfor (f = fastest; f; f = f->next)\n+\tfor (f = template_list; f; f = f->next) {\n+\t\tdo_xor_speed(f, b1, b2);\n \t\tif (f->speed > fastest->speed)\n \t\t\tfastest = f;\n-\n+\t}\n+\tactive_template = fastest;\n \tpr_info(\"xor: using function: %s (%d MB/sec)\\n\",\n \t       fastest->name, fastest->speed);\n \n+\tfree_pages((unsigned long)b1, 2);\n+\treturn 0;\n+}\n+\n+static int __init xor_init(void)\n+{\n+\t/*\n+\t * If this arch/cpu has a short-circuited selection, don't loop through\n+\t * all the possible functions, just use the best one.\n+\t */\n+\tactive_template = XOR_SELECT_TEMPLATE(NULL);\n+\tif (active_template) {\n+\t\tpr_info(\"xor: automatically using best checksumming function   %-10s\\n\",\n+\t\t\tactive_template->name);\n+\t\txor_forced = true;\n+\t\treturn 0;\n+\t}\n+\n+#define xor_speed\tdo_xor_register\n+\tXOR_TRY_TEMPLATES;\n #undef xor_speed\n \n-\tfree_pages((unsigned long)b1, 2);\n-out:\n-\tactive_template = fastest;\n+#ifdef MODULE\n+\treturn calibrate_xor_blocks();\n+#else\n+\t/*\n+\t * Pick the first template as the temporary default until calibration\n+\t * happens.\n+\t */\n+\tactive_template = template_list;\n \treturn 0;\n+#endif\n }\n \n-static __exit void xor_exit(void) { }\n+static __exit void xor_exit(void)\n+{\n+}\n \n MODULE_DESCRIPTION(\"RAID-5 checksumming functions\");\n MODULE_LICENSE(\"GPL\");\n \n+/*\n+ * When built-in we must register the default template before md, but we don't\n+ * want calibration to run that early as that would delay the boot process.\n+ */\n #ifndef MODULE\n-/* when built-in xor.o must initialize before drivers/md/md.o */\n-core_initcall(register_xor_blocks);\n+__initcall(calibrate_xor_blocks);\n #endif\n-\n-module_init(calibrate_xor_blocks);\n+core_initcall(xor_init);\n module_exit(xor_exit);\n",
    "prefixes": [
        "07/28"
    ]
}