Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp31477lqp; Tue, 11 Jun 2024 13:32:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV694dzHgOe41wOZvYn9HMiufwA6TVBqKy2FsmzhFZ6FtNXyeyw9oot4M9fULcN9haTLbBL9UwO3lUwvjMJ7lBqJXQ73YbDHSfXNJeMbw== X-Google-Smtp-Source: AGHT+IGtpSxFtrljXozYN6lAxbOow61id9uscd329bZligYzN3Fm9XfjI2GOgnQuFjxuqgDZOEqg X-Received: by 2002:a05:6214:598e:b0:6b0:7b72:4e1 with SMTP id 6a1803df08f44-6b07b7205c8mr82562076d6.65.1718137938813; Tue, 11 Jun 2024 13:32:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718137938; cv=pass; d=google.com; s=arc-20160816; b=b8vcrMmI9v0KNFHfTZLAIE5DW6t63afb4YZBsX03ErIpXV0+2w0M5/jl6wy4IjFh91 leG8HFPHcrYW86ocPlMa6KURXHCdosYzLgWh7BGnhC7QuaFrYZHwcmDkafbnzZbNTHpf wlLm2gr3mIjJ3rueoDyrNklMDEr7EX2lAYoyAjT23xv9iGMbeB8zd2mvz6OF9MrBeM0+ Xx0B9RDcsNWHcV0Cg2Ej5PXVmg/OyDFbx2bhuHg8VsLO1ZVSi6rXNdHV+FoK+grkG6Li +WDEzw5mCOXY1e28S1bboyfSbQNxZSPEqdPLDwO6mUH8A02W2FATT9SbUOe+3pfbWV/p oUxg== 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=LpD99CgrJgGRYUTF75cNSbd9uM+bW6YmMhRbbeCBMSM=; fh=WX5sgR3VQpLR5g6z+9pfvt88hmxQBAkmun/QVKBzADs=; b=aYiFdm5hMIyQ1OmJuCIT5pv37/jHDaQYrq5Nn9AQoaNqHYVV1oeWsoqb2BEg/tehPl RwwI3LnU4PVTiMfcyDPXHltFsP9HFrzovTK9BbNFWDVn6iP+DZx6KpkxY9/UmOEHCYZP L5Sg+h7z+S4jf4jccIM7vWXDAaG3h2locq1u+sfLD7YGPUOkZ+Xo0gbNkSK+q93hrjQv 01O9j7XSXga50/ugyY30G3csP0zA+YHyvfeCtqZzyqmCMxfXOyQZkfZd0vsgiolCWMLa /NEOUvx9wqOMfnEuEm3V0bpQgWghwUIKhQsdshdexaV8Oq4tz3cweRYl0l/IqA17z6CE 8MXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ITi6r1cQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4904-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4904-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. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b07ff887c1si53588976d6.169.2024.06.11.13.32.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 13:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4904-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ITi6r1cQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4904-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4904-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 887E11C22DC4 for ; Tue, 11 Jun 2024 20:32:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 791E01514DA; Tue, 11 Jun 2024 20:32:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ITi6r1cQ" 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 2DE2912E61; Tue, 11 Jun 2024 20:32:11 +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=1718137932; cv=none; b=FCFA2fbQbxnH37X/+7a1Q0Xkeg/AXJmkEXg7k4Qx8wkx5l3DCfZR0JHuwI8PdG6hq7SzVFzBer8dMjTF31H+4foHfeZW2FWvi8ARfTKOZMTRJdphj0ws3lUkG/aglvrOpbC4/rV3IWx5ZRkP3zWzFrQ/G5K6IX3BRAcAMktbiuw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718137932; c=relaxed/simple; bh=G8ObqV4GF1j+oexJE9NDUI3l/V6Cek7aJDyNu1zlm9o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qbezBctzYzGu/uH+bikVne1iMomqgTGbltFtMn5uz6JIObqz3YQLg2I+AZSZPFxF+FQ95HmTQ7qVG2CzShj5gE/qy9wCz4Yd/7OX1QgV4ZG5aKM+3MQJwWxT/7eac2kXygHE15OBqrw3A9gnw6KHfzegxgIQWYYHO/L+wlF7lBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ITi6r1cQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C199C2BD10; Tue, 11 Jun 2024 20:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718137931; bh=G8ObqV4GF1j+oexJE9NDUI3l/V6Cek7aJDyNu1zlm9o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ITi6r1cQKPeOmmodbECro67RGdiyNgpUQXFCIr/0smWwsxuIYn9Xy4mw4YVBstr9m gwOXW+aMNgxwWKlPP3+G7lJ+uUb6R6Ucy3ApqkiEJN1oAK+sq3Kht4M1HN9dtJJD/L vHfWynXI/OKQrluEnLQ5WrdUqadNP7RaNR9mu66RgaKT8ZDlR5u6fuKUEOgbmIeKFS F9QYV9+98uh94NzcPP8cwSBa3MGFfZr6RiMwvCP57VdC3YgllZyLZx+EiNJPx2gfgu 7F1ZhKmfa2Bs3gUR0ckol1DgXS6LR86VGjwjo0d6lPWJe+N82YwApaSHld/JO9UIXX aYjWziC/8YcTA== Date: Tue, 11 Jun 2024 13:32:09 -0700 From: Eric Biggers To: Herbert Xu Cc: Ard Biesheuvel , Steffen Klassert , netdev@vger.kernel.org, linux-crypto@vger.kernel.org, fsverity@lists.linux.dev, dm-devel@lists.linux.dev, x86@kernel.org, linux-arm-kernel@lists.infradead.org, Sami Tolvanen , Bart Van Assche , Tim Chen Subject: Re: [PATCH v4 6/8] fsverity: improve performance by using multibuffer hashing Message-ID: <20240611203209.GB128642@sol.localdomain> References: <20240610164258.GA3269@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: On Tue, Jun 11, 2024 at 11:39:08PM +0800, Herbert Xu wrote: > On Tue, Jun 11, 2024 at 11:21:43PM +0800, Herbert Xu wrote: > > > > Therefore if we switched to a linked-list API networking could > > give us the buffers with minimal changes. > > BTW, this is not just about parallelising hashing. Just as one of > the most significant benefits of GSO does not come from hardware > offload, but rather the amortisation of (network) stack overhead. > IOW you're traversing a very deep stack once instead of 40 times > (this is the factor for 64K vs MTU, if we extend beyond 64K (which > we absolute should do) the benefit would increase as well). > > The same should apply to the Crypto API. So even if this was a > purely software solution with no assembly code at all, it may well > improve GCM performance (at least for users able to feed us bulk > data, like networking). > At best this would save an indirect call per message, if the underlying algorithm explicitly added support for it and the user of the API migrated to the multi-request model. This alone doesn't seem worth the effort of migrating to multi-request, especially considering the many other already-possible optimizations that would not require API changes or migrating users to multi-request. The x86_64 AES-GCM is pretty well optimized now after my recent patches, but there's still an indirect call associated with the use of the SIMD helper which could be eliminated, saving one per message (already as much as we could hope to get from multi-request). authenc on the other hand is almost totally unoptimized, as I mentioned before; it makes little sense to talk about any sort of multi-request optimization for it at this point. - Eric