From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 615BAC4332F for ; Thu, 15 Dec 2022 10:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229448AbiLOKvw (ORCPT ); Thu, 15 Dec 2022 05:51:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbiLOKvs (ORCPT ); Thu, 15 Dec 2022 05:51:48 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33565F66 for ; Thu, 15 Dec 2022 02:51:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k8z9NPwjR/1WjDLafqFssLJg9DyvbaDVrEj71me8s10=; b=FqN/U+FpVhHgwuSC0KHPwZ7IOl AP1BieXhX0Fq2O01OJNw6WTgryTAF1ZXW+l2yug8M6gafkp1whJgQcUW6XdOPWtTnDmOn4MsCAy3G x6Xkhl+gUH1E37i5LhfMKOBY+iae1t+dGijFsP47jRrDxTYu+aMm7hrWdYwr//01fPLBAa157/2W1 OvCJ7StosCbcLfDes7Y/TZSyrVNgY+RECLJmTyOkk4w8z753UWZgxHEjC//1VJP20CHsEFxibN/9G pgmcE3YxDyVtfMRXGTg0y7iGqUDTT8cmk3LDzJS/g06///Rmpe5iexuOzI44kRl+UuvI+PHzGd4Wm YRTAXDnA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35714) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p5lq0-0002kH-CX; Thu, 15 Dec 2022 10:51:40 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p5lpy-0008II-Qi; Thu, 15 Dec 2022 10:51:38 +0000 Date: Thu, 15 Dec 2022 10:51:38 +0000 From: "Russell King (Oracle)" To: Ard Biesheuvel Cc: Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, Arnd Bergmann Subject: Re: [PATCH v2 2/2] ARM: permit non-nested kernel mode NEON in softirq context Message-ID: References: <20221207103936.2198407-1-ardb@kernel.org> <20221207103936.2198407-3-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Dec 15, 2022 at 11:43:22AM +0100, Ard Biesheuvel wrote: > 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. It'll be interesting to see whether there is any noticable difference with my WG VPN. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 9EFE8C4332F for ; Thu, 15 Dec 2022 10:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TSPiftxpJUuGKS+IrjuBZkjeNcvwoyWnO+Eec4Rdkbk=; b=EXaBJyMnfvGAwo ojSDl8Hn8qwa2Hc+gfjbDcK3vnVe43i1FaLSBiTW68rgyn4liXa1W+9YTbOpvhAvcIvI+/LO99KIV 1ibfL2Knl4z3WIgCFa9GAZAjrnTjyRqYxZdDYs9qvzUx4GAYR3Es+jKtP1wQvaBNakyuy8ZDWcXTE M4EA0F2dI7RiKF8C4z8rtRiw18LQ8Sxyy7iw3p374ZZG6gQmAXQF30gkfXU5ta22Km9Cnd9bqLaFs i2RvvAIdY0idOJmfZRGwWjslGFRAbQ9HbxfWid7w2Bpdc0v3xGmiKjQzLm2xH4I4cpQ6V3DzPVxBi c1238xLGfEe++EjNV7TA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5lqE-008rhh-8U; Thu, 15 Dec 2022 10:51:54 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5lqA-008ren-5K for linux-arm-kernel@lists.infradead.org; Thu, 15 Dec 2022 10:51:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k8z9NPwjR/1WjDLafqFssLJg9DyvbaDVrEj71me8s10=; b=FqN/U+FpVhHgwuSC0KHPwZ7IOl AP1BieXhX0Fq2O01OJNw6WTgryTAF1ZXW+l2yug8M6gafkp1whJgQcUW6XdOPWtTnDmOn4MsCAy3G x6Xkhl+gUH1E37i5LhfMKOBY+iae1t+dGijFsP47jRrDxTYu+aMm7hrWdYwr//01fPLBAa157/2W1 OvCJ7StosCbcLfDes7Y/TZSyrVNgY+RECLJmTyOkk4w8z753UWZgxHEjC//1VJP20CHsEFxibN/9G pgmcE3YxDyVtfMRXGTg0y7iGqUDTT8cmk3LDzJS/g06///Rmpe5iexuOzI44kRl+UuvI+PHzGd4Wm YRTAXDnA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35714) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p5lq0-0002kH-CX; Thu, 15 Dec 2022 10:51:40 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p5lpy-0008II-Qi; Thu, 15 Dec 2022 10:51:38 +0000 Date: Thu, 15 Dec 2022 10:51:38 +0000 From: "Russell King (Oracle)" To: Ard Biesheuvel Cc: Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, Arnd Bergmann Subject: Re: [PATCH v2 2/2] ARM: permit non-nested kernel mode NEON in softirq context Message-ID: References: <20221207103936.2198407-1-ardb@kernel.org> <20221207103936.2198407-3-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_025150_502323_5A5173F3 X-CRM114-Status: GOOD ( 25.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Dec 15, 2022 at 11:43:22AM +0100, Ard Biesheuvel wrote: > 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. It'll be interesting to see whether there is any noticable difference with my WG VPN. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel