From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2 1/6] crypto: optimize algorithm registration when self-tests disabled
Date: Thu, 10 Nov 2022 19:42:16 +0000 [thread overview]
Message-ID: <Y21UGAZMnytRfdmR@gmail.com> (raw)
In-Reply-To: <20221110081346.336046-2-ebiggers@kernel.org>
On Thu, Nov 10, 2022 at 12:13:41AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> Currently, registering an algorithm with the crypto API always causes a
> notification to be posted to the "cryptomgr", which then creates a
> kthread to self-test the algorithm. However, if self-tests are disabled
> in the kconfig (as is the default option), then this kthread just
> notifies waiters that the algorithm has been tested, then exits.
>
> This causes a significant amount of overhead, especially in the kthread
> creation and destruction, which is not necessary at all. For example,
> in a quick test I found that booting a "minimum" x86_64 kernel with all
> the crypto options enabled (except for the self-tests) takes about 400ms
> until PID 1 can start. Of that, a full 13ms is spent just doing this
> pointless dance, involving a kthread being created, run, and destroyed
> over 200 times. That's over 3% of the entire kernel start time.
>
> Fix this by just skipping the creation of the test larval and the
> posting of the registration notification entirely, when self-tests are
> disabled.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> crypto/algapi.c | 151 ++++++++++++++++++++++++++----------------------
> 1 file changed, 82 insertions(+), 69 deletions(-)
FYI, I realized that this patch breaks CRYPTO_MSG_ALG_LOADED (it isn't always
sent now). So I'll have to send a new version at least for that.
- Eric
next prev parent reply other threads:[~2022-11-10 19:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 8:13 [PATCH v2 0/6] crypto: reduce overhead when self-tests disabled Eric Biggers
2022-11-10 8:13 ` [PATCH v2 1/6] crypto: optimize algorithm registration " Eric Biggers
2022-11-10 19:42 ` Eric Biggers [this message]
2022-11-11 4:06 ` Herbert Xu
2022-11-10 8:13 ` [PATCH v2 2/6] crypto: optimize registration of internal algorithms Eric Biggers
2022-11-10 8:13 ` [PATCH v2 3/6] crypto: compile out crypto_boot_test_finished when tests disabled Eric Biggers
2022-11-10 8:13 ` [PATCH v2 4/6] crypto: skip kdf_sp800108 self-test " Eric Biggers
2022-11-10 8:13 ` [PATCH v2 5/6] crypto: silence noisy kdf_sp800108 self-test Eric Biggers
2022-11-10 8:13 ` [PATCH v2 6/6] crypto: compile out test-related algboss code when tests disabled Eric Biggers
2022-11-11 4:14 ` Herbert Xu
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=Y21UGAZMnytRfdmR@gmail.com \
--to=ebiggers@kernel.org \
--cc=linux-crypto@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.