Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1183958lqe; Mon, 8 Apr 2024 00:46:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOtPKHC/RvYnjwHDQ6XMzRQ1hbkFpFpGw7ZwDMZjks084RCVUpqNvmD1ExiS43kvH5uBdVZwWafVghkDsOj2AYEfgbqDrTO6SIDSMdRA== X-Google-Smtp-Source: AGHT+IHxFH2NzOdB7Pbfp0M5fMP7YBCKCSdcLvzlN7as8H9u/CM2KYyD3EU4DWL2cIVKPreR8za8 X-Received: by 2002:a50:a699:0:b0:56e:22b6:d924 with SMTP id e25-20020a50a699000000b0056e22b6d924mr4997408edc.13.1712562381555; Mon, 08 Apr 2024 00:46:21 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m26-20020a50931a000000b00568b48f6670si3412353eda.666.2024.04.08.00.46.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 00:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-134928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 3DD331F21A77 for ; Mon, 8 Apr 2024 07:46:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBAB33A1B6; Mon, 8 Apr 2024 07:42:29 +0000 (UTC) Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) (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 6AC9838DF1 for ; Mon, 8 Apr 2024 07:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.58.85.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562149; cv=none; b=k55CnTRNstyA1HuwhsxnVtdQ25ePByEWnudyCL9wcYgdj6myE0HORywxWnqhE/GOVsN2SKzXNPXPHjvePyNCkAwPaHuoPameGzMNNgwQQ/SSMoy+FC6Y0PuK0lpAfxI7b8lXnM48RJE1LbC3nIudhazovvKAJM5SCmPiIeoNktg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562149; c=relaxed/simple; bh=DPkYREXK+oG3yOff06Zvn06OcLTopHco0B279Mx5pMg=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: MIME-Version:Content-Type; b=LPUpe4RFHKnOBneRyJ4uWlETk3zLaNu5jkch8C795cMS1mfV+5SlZMmylAUz1Vj3FUv9LyWdWSc1gf72MnAbj5kKNdKTDkhMAywjMuDTgaNsKEN4tBWFtf3s/FBJhWUmoWJ5XVYx+Rx8A9XCBNu3A50cX0eLARWGNUNIRnh8doQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM; spf=pass smtp.mailfrom=aculab.com; arc=none smtp.client-ip=185.58.85.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aculab.com Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-142-w_BydM-EMUCFUZlYFJq51A-1; Mon, 08 Apr 2024 08:42:18 +0100 X-MC-Unique: w_BydM-EMUCFUZlYFJq51A-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 8 Apr 2024 08:41:44 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Mon, 8 Apr 2024 08:41:44 +0100 From: David Laight To: 'Eric Biggers' CC: Ard Biesheuvel , "linux-crypto@vger.kernel.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "Andy Lutomirski" , "Chang S . Bae" Subject: RE: [PATCH 0/6] Faster AES-XTS on modern x86_64 CPUs Thread-Topic: [PATCH 0/6] Faster AES-XTS on modern x86_64 CPUs Thread-Index: AQHaf518oZDDPKfpuUWrj9ZpRMjHLrFWPMWwgAET/ICAAHT4IIACRoYAgAQETzA= Date: Mon, 8 Apr 2024 07:41:44 +0000 Message-ID: References: <20240326080305.402382-1-ebiggers@kernel.org> <20240326164755.GB1524@sol.localdomain> <6629b8120807458ab76e1968056f5e10@AcuMS.aculab.com> <20240404013529.GB24248@quark.localdomain> <142077804bee45daac3b0fad8bc4c2fe@AcuMS.aculab.com> <20240405191904.GA1205@quark.localdomain> In-Reply-To: <20240405191904.GA1205@quark.localdomain> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Eric Biggers > Sent: 05 April 2024 20:19 .. > I did some tests on Sapphire Rapids using a system call that I customized= to do > nothing except possibly a kernel_fpu_begin / kernel_fpu_end pair. >=20 > On average the bare syscall took 70 ns. The syscall with the kernel_fpu_= begin / > kernel_fpu_end pair took 160 ns if the userspace program used xmm only, 3= 40 ns > if it used ymm, or 360 ns if it used zmm... >=20 > Note that without the kernel_fpu_begin / kernel_fpu_end pair, AES-NI > instructions cannot be used and the alternative would be xts(ecb(aes-gene= ric)). > On the same CPU, encrypting a single 512-byte sector with xts(ecb(aes-gen= eric)) > takes about 2235ns. With xts-aes-vaes-avx10_512 it takes 75 ns... So most of the cost of a single 512-byte sector is the kernel_fpu_begin(). But it is so much slower any other way it is still faster. =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)