mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Elliott, Robert (Servers)" <elliott@hpe.com>
To: "Paul Menzel" <pmenzel@molgen.mpg.de>,
	"Stephan Müller" <smueller@chronox.de>,
	"Tim Chen" <tim.c.chen@linux.intel.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: RE: kdf108_init() takes over 250 ms
Date: Tue, 23 Aug 2022 20:10:01 +0000	[thread overview]
Message-ID: <MW5PR84MB1842811C4EECC0F4B35B5FB3AB709@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <6d6b6bcf-cab8-695b-568a-c1372ac531ee@molgen.mpg.de>


> -----Original Message-----
> From: Paul Menzel <pmenzel@molgen.mpg.de>
> Sent: Tuesday, August 23, 2022 9:52 AM
> To: Stephan Müller <smueller@chronox.de>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>; David S. Miller
> <davem@davemloft.net>; linux-crypto@vger.kernel.org; LKML <linux-
> kernel@vger.kernel.org>
> Subject: kdf108_init() takes over 250 ms
> 
> Dear Stephan,
> 
> On the Dell XPS 13 9370 with Debian sid/unstable, I noticed with Linux
> 5.18.16, that  `crypto_kdf108_init()` takes 263 ms to run even with
> disabled self-tests:
> 
...
> [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.18.0-4-amd64
> root=UUID=56f398e0-1e25-4fda-aa9f-611dece4b333 ro quiet
> module_blacklist=psmouse initcall_debug log_buf_len=4M cryptomgr.notests
...
> [    0.272127] calling  crypto_kdf108_init+0x0/0x149 @ 1
> [    0.530787] Freeing initrd memory: 39332K
> [    0.534667] alg: self-tests disabled
> [    0.534701] alg: self-tests for CTR-KDF (hmac(sha256)) passed
> [    0.534703] initcall crypto_kdf108_init+0x0/0x149 returned 0 after
> 262573 usecs
...
> 
> With self-tests enabled it’s only less than a millisecond longer.
> 
> ```
> [    0.282389] calling  crypto_kdf108_init+0x0/0x149 @ 1
> [    0.541096] Freeing initrd memory: 39332K
> [    0.545674] alg: self-tests for CTR-KDF (hmac(sha256)) passed
> [    0.545676] initcall crypto_kdf108_init+0x0/0x149 returned 0 after
> 263284 usecs
> ```

crypto_kdf108_init() call its self-test function directly rather
that alg_test(), which implements that notests flag. Maybe it
should go through alg_test().

Outside of that, check that Tim's x86-optimized SHA-256 module
is loaded, so it is used rather than the generic implementation.
One my system, that improves the kdf108 initialization time 
from 1.4 s to 0.38 s:

With sha256_generic:
  initcall sha256_generic_mod_init+0x0/0x16 returned 0 after 0 usecs
  ...
  initcall crypto_kdf108_init+0x0/0x18d returned 0 after 1425640 usecs

With sha256_ssse3 (using its AVX2 implementation):
  initcall sha256_ssse3_mod_init+0x0/0x1bf returned 0 after 12148 usecs
  ...
  initcall crypto_kdf108_init+0x0/0x153 returned 0 after 382799 usecs

That's controlled by CONFIG_CRYPTO_SHA256_SSSE3.



  reply	other threads:[~2022-08-23 20:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 14:51 Paul Menzel
2022-08-23 20:10 ` Elliott, Robert (Servers) [this message]
2022-08-26  7:47   ` Stephan Mueller
2025-06-29 20:06     ` Paul Menzel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MW5PR84MB1842811C4EECC0F4B35B5FB3AB709@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM \
    --to=elliott@hpe.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=smueller@chronox.de \
    --cc=tim.c.chen@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®