Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp817299rwb; Thu, 15 Dec 2022 02:54:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xcveBlv4EjgLdYutvr3A6oK+D+nZlpnBVQO41n1eO6vFy242opeGpLqg1zy4oV7iT3Sxk X-Received: by 2002:a05:6402:2b95:b0:460:5706:d1fa with SMTP id fj21-20020a0564022b9500b004605706d1famr22495052edb.18.1671101652612; Thu, 15 Dec 2022 02:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671101652; cv=none; d=google.com; s=arc-20160816; b=aBIw+Sknc5FPE+wONARPzRJa6Vx8EXiZac00QMB45PKvAISi65kKnWp0+ZtQ2frcKF pDrT8jaGoHnYF2+knTt1LCb4crNBFZY9mk7Df979UdzQNdniMyYsE2EmOULWHjzVW4qk uGaQmUaRd4q+bzlzUXkYud5hevycwefLWzP2Kl9eK8YgutQZz6mWSEG1rnWXheaZgITD gStCptDBXXVbCStn2+KIiBzaY/nW45Pw0JHI7M/gK0fgD2pes35WsE5NfIR2SzBweNk8 dIoJZyu0aN/3CIlsTE9MEKh+3yasiGNKbRuZhLR278b7dYLJ5KrLtO6U4F+iBGKl1bYy BKPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OoHLEYDUVrZrVOUU45vnTiSYfgNHD7oFP4tFDdXhv4Q=; b=XASbk4rEJWls+oonhX7IMQaWmwd+s2xMnKP/cE4MEwCeDPazdhKU0gQqw3soG0GH4m M8dtarZpzsWGoPoY4wNiLrlqWfzyerepGBqppKGmt7BX6EC6KVdGtYlL+xlO6Nk3mhVR J7fE3ikVhOMFfAyechI7xJp2KxbK19jkHG3jtKHzSIUFfQYTcQGer3enabpgO18GaiIE FMzsi33bemPL1wtfUikzj+C+ulQ8k9klVASXGU5d88IYr2fmNiyyy33/IC+WzpiC5g6U p44UcwF1GTuZO7KL7Tlfw/pKFn72y8pbPqBduJQ0hW4WFlZw7V47iVZya013Y6TspytZ UTvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ixJuzXSP; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n17-20020a5099d1000000b0046b5453e15esi13420976edb.498.2022.12.15.02.53.48; Thu, 15 Dec 2022 02:54:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=@kernel.org header.s=k20201202 header.b=ixJuzXSP; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbiLOKnk (ORCPT + 99 others); Thu, 15 Dec 2022 05:43:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbiLOKni (ORCPT ); Thu, 15 Dec 2022 05:43:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D4E91F624 for ; Thu, 15 Dec 2022 02:43:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E308061C64 for ; Thu, 15 Dec 2022 10:43:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 514E8C433F0 for ; Thu, 15 Dec 2022 10:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671101016; bh=OoHLEYDUVrZrVOUU45vnTiSYfgNHD7oFP4tFDdXhv4Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ixJuzXSPHUObBBx7BXO2E47q62M05NCP0jZlo6n3pOFzQyEWZiUKq9G6kJc+eg9Qg 3vaEiZzSHRUuSOktsC2cspLLRMOz1wf0zYHNeoqyZpK0S3VWVmYyQy+JFVnd7QfLi/ dbbqVa4w0wNIpeXTXFzqLEadhaFGVh/czffaDx4jjgS9UHwnw4E8hOWqnnpKtjeUau SXQavmep75LbmODLOtfpAWfvsR0P4peuXDXyciVSoJdI2PJGO0SkQ5eZ4UeXdchnCj dEa6gCDvkZYdjO5qWyM/t1fYUDulmzfQVgLYBsXN1G0lB5aJcpw8hXaG4zLRddxX92 bU2KISUnBf+5g== Received: by mail-lj1-f180.google.com with SMTP id z4so9497657ljq.6 for ; Thu, 15 Dec 2022 02:43:36 -0800 (PST) X-Gm-Message-State: ANoB5plzg/WQXIulb/CExKQUPgNW3oGnAWbkMupQq6dygmGoSnYjAjqe O9S5u08pMnrw0y3LxTLBuwaLMYgcfupMm4IrN3Q= X-Received: by 2002:a05:651c:1603:b0:26d:d603:8df2 with SMTP id f3-20020a05651c160300b0026dd6038df2mr28479730ljq.189.1671101014271; Thu, 15 Dec 2022 02:43:34 -0800 (PST) MIME-Version: 1.0 References: <20221207103936.2198407-1-ardb@kernel.org> <20221207103936.2198407-3-ardb@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Thu, 15 Dec 2022 11:43:22 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] ARM: permit non-nested kernel mode NEON in softirq context To: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, linux-crypto@vger.kernel.org, Arnd Bergmann Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,SUSPICIOUS_RECIPS 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-crypto@vger.kernel.org On Thu, 15 Dec 2022 at 11:27, Linus Walleij wrote: > > On Wed, Dec 7, 2022 at 11:39 AM Ard Biesheuvel wrote: > > > We currently only permit kernel mode NEON in process context, to avoid > > the need to preserve/restore the NEON register file when taking an > > exception while running in the kernel. > > > > Like we did on arm64, we can relax this restriction substantially, by > > permitting kernel mode NEON from softirq context, while ensuring that > > softirq processing is disabled when the NEON is being used in task > > context. This guarantees that only NEON context belonging to user space > > needs to be preserved and restored, which is already taken care of. > > > > This is especially relevant for network encryption, where incoming > > frames are typically handled in softirq context, and deferring software > > decryption to a kernel thread or falling back to C code are both > > undesirable from a performance PoV. > > > > Signed-off-by: Ard Biesheuvel > > So boosting WireGuard as primary SW network encryption user? Essentially, although the use case that inspired this work is related to IPsec not WireGuard, and the crypto algorithm in that case (GCM) is ~3x faster than WG's chacha20poly1305, which makes the performance overhead of asynchronous completion even more significant. (Note that GCM needs the AES and PMULL instructions which are usually only available when running the 32-bit kernel on a 64-bit core, whereas chacha20poly1305 uses ordinary NEON instructions.) But Martin responded with a Tested-by regarding chacha20poly1305 on IPsec (not WG) where there is also a noticeable speedup, so WG on ARM32 should definitely benefit from this as well. > This is really neat, BTW: > Reviewed-by: Linus Walleij > Thanks!