[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad862f5ad048404ab452e25bba074824@AcuMS.aculab.com>
Date: Tue, 18 Jan 2022 12:44:57 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'Jason A. Donenfeld'" <Jason@...c4.com>,
Herbert Xu <herbert@...dor.apana.org.au>
CC: "geert@...ux-m68k.org" <geert@...ux-m68k.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"wireguard@...ts.zx2c4.com" <wireguard@...ts.zx2c4.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"tytso@....edu" <tytso@....edu>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"jeanphilippe.aumasson@...il.com" <jeanphilippe.aumasson@...il.com>,
"ardb@...nel.org" <ardb@...nel.org>
Subject: RE: [PATCH crypto v3 0/2] reduce code size from blake2s on m68k and
other small platforms
From: Jason A. Donenfeld
> Sent: 18 January 2022 11:43
>
> On 1/18/22, Herbert Xu <herbert@...dor.apana.org.au> wrote:
> > As the patches that triggered this weren't part of the crypto
> > tree, this will have to go through the random tree if you want
> > them for 5.17.
>
> Sure, will do.
I've rammed the code through godbolt... https://godbolt.org/z/Wv64z9zG8
Some things I've noticed;
1) There is no point having all the inline functions.
Far better to have real functions to do the work.
Given the cost of hashing 64 bytes of data the extra
function call won't matter.
Indeed for repeated calls it will help because the required
code will be in the I-cache.
2) The compiles I tried do manage to remove the blake2_sigma[][]
when unrolling everything - which is a slight gain for the full
unroll. But I doubt it is that significant if the access can
get sensibly optimised.
For non-x86 that might require all the values by multiplied by 4.
3) Although G() is a massive register dependency chain the compiler
knows that G(,[0-3],) are independent and can execute in parallel.
This does help execution time on multi-issue cpu (like x86).
With care it ought to be possible to use the same code for G(,[4-7],)
without stopping the compiler interleaving all the instructions.
4) I strongly suspect that using a loop for the rounds will have
minimal impact on performance - especially if the first call is
'cold cache'.
But I've not got time to test the code.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists