Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5410212rwb; Tue, 1 Aug 2023 01:58:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/GIU5eLm7gF57krUDNURIamo1cuvvkBIenbw4qUitgW4fGnFhvzx5s1JEftvjIpfVdNaV X-Received: by 2002:a05:6a20:3d8f:b0:106:5dff:5dc6 with SMTP id s15-20020a056a203d8f00b001065dff5dc6mr15773745pzi.16.1690880288400; Tue, 01 Aug 2023 01:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690880288; cv=none; d=google.com; s=arc-20160816; b=e8R119cOYj3E5jcbxnTxHjVjaAh38kywaupJeWnVRNe87+Sh5PEFeykNYoTRMpEflk s1w43k3rvgRMUtGpfA4gIaewBv9FLsNDPYAOBG9xJrVi5CcOZEiBo6ZqFhz/Oh/5nQ0h hcya+om54C0nwaFtcXU2wVQG96VxPx2GzX7YBHv/Ftc73DfFo69ZKrHquHB796V//ZCS 2qhfyDZ3cj9Svq1lkrTcUpf0PkcWcAn7eqwbuircpbzN7qXgjEBYWrvktagbkRARf12A Jug+JDVf6K5+ExWsxc8pOx2zPRi8qGvIp3SUK7y/v1/00+55PWh8etssYbKfQ8pE3RDa 7LGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mZtUMxlNPdVOW6IWtmLdrwOylU/4yGzoChuwPpoR0tQ=; fh=Vlps4JFAAtvImqC5EDVGqekmEhcBf0z6+Y2DenJNL2w=; b=LErtG+MY02BP5ICWgM0Chk1NeIOvXaGqLj9UnAutFVVeYPdZtoGBv0GvhINr+XICOB nAhZKYQENWwmDpZrY/WYOMQmi0ZtG+opR9FiiDkPHMofm5mIIFSvQBvrLKwQnX5UJLpo Tw74800W2Ap7PkHjAZ8aeV0JCb2tv5DyyINAdVd7KCIF0NWZK16dOFLKwDLsKGOamKdP Q1KBnCKNpeI86/Ek2sfaMDcl0WR+DU/bApqwlhXRqDeU8Ey4YdRNRpenCCLGYGBD0KMQ UiI4EAtMwGdVIDdHwQG2YWu932yORfdYyoMDfgt4AQUithkDz7lh+e1fDGAUMhVX7zuq xDUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=ZHhoH84x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eg20-20020a056a00801400b0066d93ab678asi6181490pfb.16.2023.08.01.01.57.56; Tue, 01 Aug 2023 01:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=ZHhoH84x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231391AbjHAIN5 (ORCPT + 99 others); Tue, 1 Aug 2023 04:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbjHAINv (ORCPT ); Tue, 1 Aug 2023 04:13:51 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 950FE131; Tue, 1 Aug 2023 01:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1690877618; bh=mraxCdf54QCswqY/hVvj/lsk8PCBowrkVyh11XY1zrg=; h=From:To:Cc:Subject:Date:From; b=ZHhoH84x9LucBwVbW7ARUz47wTF+ZIwCImsaHs0hSezFLkuVGY3DX2jDEVIxb3t33 nwWxE7iEqCUDh5FAeyxALOEyx8lssi++gVG8OshaZYXw00DGpUjzbbIlUnT1coQ4hR gRAd7W56iqhkbhEFYxbGWnhLxNELtrJ4uLCZ8Rz0= Received: from ld50.lan (unknown [101.88.28.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 66677600D4; Tue, 1 Aug 2023 16:13:38 +0800 (CST) From: WANG Xuerui To: Song Liu Cc: Huacai Chen , linux-raid@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, WANG Xuerui Subject: [PATCH 0/3] raid5, raid6: Accelerate RAID math with LoongArch SIMD Date: Tue, 1 Aug 2023 16:13:32 +0800 Message-Id: <20230801081335.523097-1-kernel@xen0n.name> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: WANG Xuerui Hi, Seeing the LoongArch port recently (finally!) gained the ability to use the vector units, I've subsequently ported the RAID5/6 math to LSX and LASX (which are LoongArch's 128-bit and 256-bit SIMD extensions), with nice speedups observed. They are reasonably straight-forward conversions of existing code, and I hope the comments I put in there are helpful enough for anyone not familiar with LoongArch assembly to get a rough picture of how things work here. Performance numbers are included in each commit's commit message. This series needs [1] ("LoongArch: Allow usage of LSX/LASX in the kernel") as a prerequisite, or the vector context would likely get corrupted by the vector-unaware kernel_fpu_{begin,end} calls. I tested the changes on top of next-20230731 with the raid6test build fixes [2] applied, but the series should apply cleanly to v6.5-rc4 (or maybe any other tag) too. [1]: https://lore.kernel.org/loongarch/20230722072201.2677516-1-chenhuacai@loongson.cn/ [2]: https://lore.kernel.org/linux-raid/20230731104911.411964-1-kernel@xen0n.name/ WANG Xuerui (3): LoongArch: Add SIMD-optimized XOR routines raid6: Add LoongArch SIMD syndrome calculation raid6: Add LoongArch SIMD recovery implementation arch/loongarch/include/asm/xor.h | 68 ++++ arch/loongarch/include/asm/xor_simd.h | 42 +++ arch/loongarch/lib/Makefile | 3 + arch/loongarch/lib/xor_simd.c | 92 +++++ arch/loongarch/lib/xor_simd.h | 46 +++ arch/loongarch/lib/xor_simd_glue.c | 71 ++++ arch/loongarch/lib/xor_template.c | 109 ++++++ include/linux/raid/pq.h | 4 + lib/raid6/Makefile | 1 + lib/raid6/algos.c | 16 + lib/raid6/loongarch.h | 38 ++ lib/raid6/loongarch_simd.c | 417 +++++++++++++++++++++ lib/raid6/recov_loongarch_simd.c | 501 ++++++++++++++++++++++++++ lib/raid6/test/Makefile | 12 + 14 files changed, 1420 insertions(+) create mode 100644 arch/loongarch/include/asm/xor.h create mode 100644 arch/loongarch/include/asm/xor_simd.h create mode 100644 arch/loongarch/lib/xor_simd.c create mode 100644 arch/loongarch/lib/xor_simd.h create mode 100644 arch/loongarch/lib/xor_simd_glue.c create mode 100644 arch/loongarch/lib/xor_template.c create mode 100644 lib/raid6/loongarch.h create mode 100644 lib/raid6/loongarch_simd.c create mode 100644 lib/raid6/recov_loongarch_simd.c base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4 prerequisite-patch-id: 85d08a9828893250ae78dbca9d6e6f8dac755f61 prerequisite-patch-id: fe0bba41e0bbc676454365ed16fb13fc0aac6ee0 prerequisite-patch-id: 84ef8212b74e696ce019255bbfd9679d7516f7f7 prerequisite-patch-id: b1f8fc4e4acdaff7f821a9fcbd063475178e037b prerequisite-patch-id: 82aacbf27f249fdefe40dd6bcc712e5795256926 prerequisite-patch-id: ae4e026e18f92ffcc93f6b135a3bd48fbdded39a -- 2.40.0