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 01CE9C433FE for ; Tue, 22 Feb 2022 17:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234479AbiBVRCw convert rfc822-to-8bit (ORCPT ); Tue, 22 Feb 2022 12:02:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbiBVRCv (ORCPT ); Tue, 22 Feb 2022 12:02:51 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 865902B1B2 for ; Tue, 22 Feb 2022 09:02:25 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-164-i5Yi4IRPO7OQJB0p3ITDCA-1; Tue, 22 Feb 2022 17:02:18 +0000 X-MC-Unique: i5Yi4IRPO7OQJB0p3ITDCA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Tue, 22 Feb 2022 17:02:16 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.028; Tue, 22 Feb 2022 17:02:16 +0000 From: David Laight To: 'Keith Busch' , "linux-nvme@lists.infradead.org" , "linux-block@vger.kernel.org" , "linux-crypto@vger.kernel.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" CC: "axboe@kernel.dk" , "hch@lst.de" , "martin.petersen@oracle.com" , "colyli@suse.de" Subject: RE: [PATCHv3 10/10] x86/crypto: add pclmul acceleration for crc64 Thread-Topic: [PATCHv3 10/10] x86/crypto: add pclmul acceleration for crc64 Thread-Index: AQHYKAoDxC35E9Q8uUaW/UAMQuY/zKyfybxw Date: Tue, 22 Feb 2022 17:02:16 +0000 Message-ID: References: <20220222163144.1782447-1-kbusch@kernel.org> <20220222163144.1782447-11-kbusch@kernel.org> In-Reply-To: <20220222163144.1782447-11-kbusch@kernel.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Keith Busch > Sent: 22 February 2022 16:32 > > The crc64 table lookup method is inefficient, using a significant number > of CPU cycles in the block stack per IO. If available on x86, use a > PCLMULQDQ implementation to accelerate the calculation. > > The assembly from this patch was mostly generated by gcc from a C > program using library functions provided by x86 intrinsics, and measures > ~20x faster than the table lookup. I think I'd like to see the C code and compiler options used to generate the assembler as comments in the committed source file. Either that or reasonable comments in the assembler. It is also quite a lot of code. What is the break-even length for 'cold cache' including the FPU saves. ... > +.section .rodata > +.align 32 > +.type shuffleMasks, @object > +.size shuffleMasks, 32 > +shuffleMasks: > + .string "" > + .ascii "\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\217\216\215" > + .ascii "\214\213\212\211\210\207\206\205\204\203\202\201\200" That has to be the worst way to define 32 bytes. > +.section .rodata.cst16,"aM",@progbits,16 > +.align 16 > +.LC0: > + .quad -1523270018343381984 > + .quad 2443614144669557164 > + .align 16 > +.LC1: > + .quad 2876949357237608311 > + .quad 3808117099328934763 Not sure what those are, but I bet there are better ways to define/describe them. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)