Message ID | 20241016192640.406255-4-ardb+git@google.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AB7BD2A541 for <linux-arm-kernel@archiver.kernel.org>; Wed, 16 Oct 2024 19:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:Mime-Version:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=71jHtTZ6Tb0ubRmAvBFlz10X2hosJ2gMr/QFtpHOJss=; b=Xj8gGoD3kDacuHw0l6Xlw41zsF PqWQlAOXjc4sAXkYFwXtKWQSgsoyYPu3kcMLK7Y9ftHK0v47/u7kWa7bsqbQzHNY6f5zUvFjaHiTP rEnSMLnSCbZe4Lws5OU59gmdyeG+0tI8Jir7voBlN32LKsxsTBcJbAS29uO9HBvMJIvvbXuYsSEuv +QkQmjE3iMWnWNBtjglJXv/C7ZNtAXVydWk+uWTugrr/YTJrOtoFV+ryFj5iqx2cvv4U+TwRKKzTH AunR9Zwql0RllDWBgSticSMAwBJMxeIRJJlOPSASbUJXRWUduTB+8gpf4LawRtq4EzhsUHsJ1tH6u pgr8V4zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t19gv-0000000CntA-2i5f; Wed, 16 Oct 2024 19:28:17 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t19fU-0000000CnZw-2Abg for linux-arm-kernel@lists.infradead.org; Wed, 16 Oct 2024 19:26:49 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6e35a643200so5750167b3.0 for <linux-arm-kernel@lists.infradead.org>; Wed, 16 Oct 2024 12:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729106807; x=1729711607; darn=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=71jHtTZ6Tb0ubRmAvBFlz10X2hosJ2gMr/QFtpHOJss=; b=ScXDnDBj6v3pdI7ujchniRE454v76hbYwv4nZPvs8/6azKayYptuRtaZ/Xce0Y+/bC 2QMbcZwwuj//wcSkNVTYb1+TPMM8uKQgIjfdx1v4Pe85ZKZIDcbo68d+r6FTVcQ9mere +CDq6aL1R4OdOvyxipf5RdXbi7MftcLsnj8+DAwl73jxc/YJh5x924dlx3vJpIkyU2Tc HNk7QpW4z4O7ryOeN1KO+ZEDUMgjKS710tosIS0e6lbyaO8WRDvhW//gcVK/M84B/9vG i7NnIHup8iHVb40AE1VT4y1PFfoZPTi72E0uNQ7UDjhEVPSIScPpcOF3i0bjv21s5bNX Lhaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729106807; x=1729711607; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=71jHtTZ6Tb0ubRmAvBFlz10X2hosJ2gMr/QFtpHOJss=; b=djo4xHj5nUytpj4qDkT7TCqtMFyjTLsHYCvtEpjMZ3D5f3rvJeFrlL2ab2KsWX6JjJ Q2T5BAlQMGPypzU+JX/YSFSUr2i6f9gPnbUj95Lhm57ajrZ7kd32x3tZA8FhPjvbzLvB pOJmxc5HXHDI+GzVFj+HvaySjEuyTOJ233HesPmcSiEwpBCyghVQ3jLMUquoAXsyk6Ka tfamsAwCbejN5s15dSN5KdXwOkF6/IJ5d1UCeTy38Dw6ORsUhmFwFQCQCOwyecl/Kc5S 6g6acKU29CjPPfl5TNwB1ENGsziUWeMcaAkrUU1ZKgeh37ydI7E7gliCPnM28Hs+lraF IB+g== X-Gm-Message-State: AOJu0YwZ8asVcPw2gzE16vp1aqOjPTNqNIuNcUDBIkGa3Lo7zKgrLiXY k5TfabbRzcD2wsSqZW9EYm/jB82fbqRrIT6fM1YWyTEJIf+KLxG6BM/e++gCfYUzCxr1DS2BTBv 2yK5UuUq0noTbS9+vC/qPRLWm3eLplJnpzmVllpE+fyilpT9vsmqzc8b/cdqFMs5+xLMYZEW1lA IxxW1en0jGpZs5MYiToJH+S9z9IYny2OSLl5lfGz7b X-Google-Smtp-Source: AGHT+IEbjrUITaf482uKQsYG7Ig58W7dEGDKbDR0Bksm7FH7a/KxsfpLBNROUttO8dKYD6M57Wsyl/SY X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:7b:198d:ac11:8138]) (user=ardb job=sendgmr) by 2002:a81:fb04:0:b0:6e3:d670:f62a with SMTP id 00721157ae682-6e3d671219emr419867b3.3.1729106806212; Wed, 16 Oct 2024 12:26:46 -0700 (PDT) Date: Wed, 16 Oct 2024 21:26:41 +0200 Mime-Version: 1.0 X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1613; i=ardb@kernel.org; h=from:subject; bh=vlMaODxGDLJCYsHMLyzzK3JwRCTjZ6nDuceb9GBYtEI=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIV1AuHCy/2kPRgvXGkWH54905xZV7zZb6qD55/aHlWI3h Gdf/fuvo5SFQYyDQVZMkUVg9t93O09PlKp1niULM4eVCWQIAxenAExESpeRYVE1ZxSLk+tVUZY4 vTNTt/1+uHPlkb1zy//2lU6Z6LqeOZ+R4VPIE56PpQJey6LeHD+r7ez8VTHlItfvk07fXv5fnt5 kwwIA X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241016192640.406255-4-ardb+git@google.com> Subject: [PATCH v2 0/2] arm64: Speed up CRC-32 using PMULL instructions From: Ard Biesheuvel <ardb+git@google.com> To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, will@kernel.org, catalin.marinas@arm.com, Ard Biesheuvel <ardb@kernel.org>, Eric Biggers <ebiggers@kernel.org>, Kees Cook <kees@kernel.org> Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_122648_581682_28A938F7 X-CRM114-Status: GOOD ( 13.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
arm64: Speed up CRC-32 using PMULL instructions
|
expand
|
From: Ard Biesheuvel <ardb@kernel.org> The CRC-32 code is library code, and is not part of the crypto subsystem. This means that callers may not generally be aware of the kind of implementation that backs it, and so we've refrained from using FP/SIMD code in the past, as it disables preemption, and this may incur scheduling latencies that the caller did not anticipate. This was solved a while ago, and on arm64, kernel mode FP/SIMD no longer disables preemption. This means we can happily use PMULL instructions in the CRC-32 library code, which permits an optimization to be implemented that results in a speedup of 2 - 2.8x for inputs >1k in size (on Apple M2) Patch #1 implements some prepwork to handle the scalar CRC-32 alternatives patching in C code. Changes since v1: - rename crc32-pmull.S to crc32-4way.S and avoid pmull in the function names to avoid confusion about the nature of the implementation; - polish the asm a bit, and add some comments - don't return via the scalar code if len dropped to 0 after calling the 4-way code. Cc: Eric Biggers <ebiggers@kernel.org> Cc: Kees Cook <kees@kernel.org> Ard Biesheuvel (2): arm64/lib: Handle CRC-32 alternative in C code arm64/crc32: Implement 4-way interleave using PMULL arch/arm64/lib/Makefile | 2 +- arch/arm64/lib/crc32-4way.S | 242 ++++++++++++++++++++ arch/arm64/lib/crc32-glue.c | 82 +++++++ arch/arm64/lib/crc32.S | 21 +- 4 files changed, 331 insertions(+), 16 deletions(-) create mode 100644 arch/arm64/lib/crc32-4way.S create mode 100644 arch/arm64/lib/crc32-glue.c