Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3523616rwo; Fri, 4 Aug 2023 06:18:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZLmuXvPOvJSOlByOjimtGy7QxmK5s5uNeEI2fs5P8BdVhryXi9atoZ1IjOlAyjS6botUx X-Received: by 2002:a17:902:eccc:b0:1b8:1335:b775 with SMTP id a12-20020a170902eccc00b001b81335b775mr2116995plh.0.1691155081724; Fri, 04 Aug 2023 06:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691155081; cv=none; d=google.com; s=arc-20160816; b=Fkr68+Z7wQHPqqvd4PFdr7Sg/5t9M8uvdlvo6SMOoGc6Y+2HrKxKov48TCP8ZeR/eS wYP7IMhRmUrwP+S1tlyLgH+HkBBv3xqes0/9qRC4kn+B48HH9aKzZRWWLIXFVOSZ8B/R bF6HrId5d/eLWLjNka8W4WmRfIn11q6ykXT414urTv+0dKMpheoVZ2TOpSZ7XoNQ9vCa 3+7W1yJo5IeEbKVvQxHfstjKMBJpikQNkBJTRdOccyR4A43DE72q2I70A6yoJNWVXeK/ d0ixgZjee22a224L8qqDbbKs6RTyf2eOJY0ASIInAaq54TR40R+qr3Teftff1C7vNWkR ua1Q== 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=v5TGLcaDsgsX6Eia8rJnDoTzF22kdvXTvU1zE+Lv4Pg=; fh=Vlps4JFAAtvImqC5EDVGqekmEhcBf0z6+Y2DenJNL2w=; b=z3vLCLW8psbmV9jgJfFgC1OGKzuKfR7FNLosLxoKAC9/sGUQl+BBrWatmEpSf0PVwx k9cioDX5+Y2lzTrV5JrkshS9qscfC4eD1DtsmWR1s9UK749b0do0e/zwvhWsFvNcQ1xv pKpHRDzAruT9xlfrP92raJMsfz2CblXYD8gsV21Qj3pw+U389/puqrZh30eKz12iyPbK WtqBdr8+whmObqWw+/KjXQt2oUdLDMxTb+OvWScJdXRFAFU8SrLt8BshDGvdbZda+quP aRpo38ZngVAjdzh09sWBEtIBNL4X8GDlDYj4D0ehcJYpH8/YSt3M/g7Z1Rc9J+MyEYZm 5yTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=b21yVI5C; 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 h22-20020a170902ac9600b001b831d26f32si1711677plr.590.2023.08.04.06.17.49; Fri, 04 Aug 2023 06:18:01 -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=b21yVI5C; 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 S229832AbjHDMq1 (ORCPT + 99 others); Fri, 4 Aug 2023 08:46:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjHDMqY (ORCPT ); Fri, 4 Aug 2023 08:46:24 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1276EA; Fri, 4 Aug 2023 05:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1691153175; bh=9xhxTfJsmP/j0QZixW+WVMVjURciT9Pau9sHFu6Fvd8=; h=From:To:Cc:Subject:Date:From; b=b21yVI5CZNtOHjmWB1AUq9p/kDLAABoY5Reuq3s+UwOtrDGrFsw89mBXf52l/mlAp triEWHjAz8gIgP8BiJtSVwhoPm4I32B1AlW16midUARZdZ48MloENkTA48r2gK1/Gd K+MA52aK0xA5a6pxaW0klYo2qUmgrSTwGuMVfwbk= 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 E16BC600A6; Fri, 4 Aug 2023 20:46:12 +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 v3 0/3] raid5, raid6: Accelerate RAID math with LoongArch SIMD Date: Fri, 4 Aug 2023 20:46:08 +0800 Message-Id: <20230804124611.2051048-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,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; it doesn't depend on the raid6test fixes. The base-commit and prerequisite-patch-id info is available for minimally recreating a working configuration for both the kernel and raid6test tool. [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/ Changes in v3 (no functional change): - coding style tweaks to the recovery code (Patch 2 is not touched because it is much more resembling the original int.uc code before unrolling.) - more detail in the commit message of Patch 3 Changes in v2 (no functional change): - minor commit message tweaks - changed comment style from // to /* */ throughout 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 | 93 +++++ arch/loongarch/lib/xor_simd.h | 46 +++ arch/loongarch/lib/xor_simd_glue.c | 71 ++++ arch/loongarch/lib/xor_template.c | 110 ++++++ 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 | 422 +++++++++++++++++++++ lib/raid6/recov_loongarch_simd.c | 515 ++++++++++++++++++++++++++ lib/raid6/test/Makefile | 12 + 14 files changed, 1441 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