Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2415636lqz; Tue, 2 Apr 2024 17:44:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+eDZkJCZpUGgFFNm2+gwkGmvxJxZq//TpNzgBGQlQ+ItJWB0H9C3uqodp9iNKzeoj+5t1GW88RHM3kTw2Jyy92oUlG1Ht8Rz20aqSZg== X-Google-Smtp-Source: AGHT+IHVvA/UZ8VqchwIkrPdJ7qZNpHfxQBoo8Xh8WmKvc6Q+1xZ7QnccmZ1OtPdEA5eFiEJ45fF X-Received: by 2002:a05:620a:13d8:b0:789:e263:2e3c with SMTP id g24-20020a05620a13d800b00789e2632e3cmr1190754qkl.28.1712105050925; Tue, 02 Apr 2024 17:44:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712105050; cv=pass; d=google.com; s=arc-20160816; b=HE9uu0+egtpmB6S04PE29ofTpl4jmXn3cFzZHJDQZgqfFsk+AcDMDHuoWTB2xf4dNA LzpeI17OPOtVWEvUBsQSFum8FzRdLowVACGHirnDcg9zEYEO40fCoNngRZ2TYY7TMiS9 S9ff1p0L+nRPm38yVLb0IlkRye+QBeh7Qd3H53d1dDAI8SwRc+S80GzPfXmbesocpVCd 1nOYdZ8mFpAlMf0t9V5FNY7ATlYJ29ugc7vQzmtBIXo8/HGIhyeZANM75++AaDP9ACzF CRT/Bp8BBq/ph3afpk6btmZTAIfLqiMo5Bm4Y6f6YU5YWk/+lIa6/5zcmi6+ZBQ8ppQL gzgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XBseFGsm2ui18IIL8ySnHFAT7fsidI/EJgeytpKOE1A=; fh=gt2QsdVbW4Jc4aJd3HbkynInUy9EIu51p64EnAL9Prs=; b=jR3sjuyLWTK5PruNcRo4b2Y9UnEFem+p/UAtiwT4Otq3jrOpLYqJDp+6DHlptgVgoa 94qiPxPeJ5Y2pcChFXoUdGphgaFjyO1n1Fo5IcSn1F6flFI7w6v9ZQNSgtrzrwWJRP91 1l6EKjDj2utQbpcvEt9zUbQjLvCfX0kzEvOPK9OSylNG/b1nXRLir47ZsJg1u5uULCz8 Kmqff3TGk+8IXQjoG2GF/3VFU3dbEBz8bcZHsZNgm91P8hx5eWlys8v1k1fXVQ0nl7S9 TWT/N03RW1HJthoGxQdfesORIc42skFXrwrEl9ov208x6HgcwDx4ni3VrXbHUF6gUE0u xZgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DEkL8ide; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-3269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a4-20020a05620a102400b0078a34bee9ffsi13133899qkk.397.2024.04.02.17.44.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 17:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DEkL8ide; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-3269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A66341C21F62 for ; Wed, 3 Apr 2024 00:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92E964C8E; Wed, 3 Apr 2024 00:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DEkL8ide" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A49217C8; Wed, 3 Apr 2024 00:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712105046; cv=none; b=XU/2jYlns+88Kn1L9Pe7TTr/3V8ai4ElcRkHg0QRWXZygah5VrChTgPBjvQIeKiMMb5Y/ilvnyntF9kNAjp7DJLVKGe7DiYCq4HjcXIa7d1waO0O7BX7ONDQRn2c12efQvwXEOn3dBdJZc5qEHuKD/j5bAurn+QtNco1BSGoLXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712105046; c=relaxed/simple; bh=V61TCSZ0jUsTPk8qUFp6mxf+YZJrztTwe0Nf/jw49Do=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G9UbuO/Ej/sjxvkrMahGG3Jccz7NLybMlUGvmT5ZWDT9qardScfCE2np8uwlmAF1DclZjaprMmzoTjpIRJKXqRn2Cfthi9KPv4/NRZ1LE6hHDlzqpms3+/y9Z8TXZrnsRwuNaI0hw99nFAPmeFOC73XQctGoYFhRaFFyeGhhEqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DEkL8ide; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D74EC433F1; Wed, 3 Apr 2024 00:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712105045; bh=V61TCSZ0jUsTPk8qUFp6mxf+YZJrztTwe0Nf/jw49Do=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DEkL8ideA+nykk4WpPhrpK+jwhG0lxLaujjNf0+Wm98BlPGJaQsH6m+BIg0Wxncb5 Ykj8+km41Q6RjP4468XKa2u6tdMi5FNiVl8NAHFCXxb4AOnynnwa28GPLPB79BPhUj Au6aLcMtpZxvOVQrCisSOy6uYbkr/WW72FD8a6xI12rQOqNKJYgsCsDfU3qSmte/yx s4KpUAgmT9xq0Jd+LAEdRUrG4UXZNnfAwp8+8HnAzUf7pjbGp1BOeVafD5DRcHOIeU fNqomtEXTS7zT8+oqCmfx5AW+Amji6I79Woeqex7AvHoIb2Nc21iUZreX+eyWsggt7 xce0l8terT+bA== Date: Tue, 2 Apr 2024 17:44:04 -0700 From: Eric Biggers To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , "Chang S . Bae" Subject: Re: [PATCH v2 0/6] Faster AES-XTS on modern x86_64 CPUs Message-ID: <20240403004404.GC2576@sol.localdomain> References: <20240329080355.2871-1-ebiggers@kernel.org> <20240329093130.GA65937@sol.localdomain> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240329093130.GA65937@sol.localdomain> On Fri, Mar 29, 2024 at 02:31:30AM -0700, Eric Biggers wrote: > > I wouldn't mind retiring the existing xts(aesni) > > code entirely, and using the xts() wrapper around ecb-aes-aesni on > > 32-bit and on non-AVX uarchs with AES-NI. > > Yes, it will need to be benchmarked, but that probably makes sense. If > Wikipedia is to be trusted, on the Intel side only Westmere (from 2010) has > AES-NI but not AVX, and on the AMD side all CPUs with AES-NI have AVX... It looks like I missed some low-power CPUs. Intel's Silvermont (2013), Goldmont (2016), Goldmont Plus (2017), and Tremont (2020) support AES-NI but not AVX. Their successor, Gracemont (2021), supports AVX. I don't have any one of those immediately available to run a test on. But just doing a quick benchmark on Zen 1, xts-aes-aesni has 62% higher throughput than xts(ecb-aes-aesni). The significant difference seems expected, since there's a lot of API overhead in the xts template, and it computes all the tweaks twice in C code. So I'm thinking we'll need to keep xts-aes-aesni around for now, alongside xts-aes-aesni-avx. (And with all the SIMD instructions taking a different number of arguments and having different names for AVX vs non-AVX, I don't see a clean way to unify them in assembly. They could be unified if we used C intrinsics instead of assembly and compiled a C function with and without the "avx" target. However, intrinsics bring their own issues and make it hard to control the generated code. I don't really want to rely on intrinsics for this code.) - Eric