linux/crypto
Eric Biggers 2beb81fbf0 crypto: remove CONFIG_CRYPTO_STATS
Remove support for the "Crypto usage statistics" feature
(CONFIG_CRYPTO_STATS).  This feature does not appear to have ever been
used, and it is harmful because it significantly reduces performance and
is a large maintenance burden.

Covering each of these points in detail:

1. Feature is not being used

Since these generic crypto statistics are only readable using netlink,
it's fairly straightforward to look for programs that use them.  I'm
unable to find any evidence that any such programs exist.  For example,
Debian Code Search returns no hits except the kernel header and kernel
code itself and translations of the kernel header:
https://codesearch.debian.net/search?q=CRYPTOCFGA_STAT&literal=1&perpkg=1

The patch series that added this feature in 2018
(https://lore.kernel.org/linux-crypto/1537351855-16618-1-git-send-email-clabbe@baylibre.com/)
said "The goal is to have an ifconfig for crypto device."  This doesn't
appear to have happened.

It's not clear that there is real demand for crypto statistics.  Just
because the kernel provides other types of statistics such as I/O and
networking statistics and some people find those useful does not mean
that crypto statistics are useful too.

Further evidence that programs are not using CONFIG_CRYPTO_STATS is that
it was able to be disabled in RHEL and Fedora as a bug fix
(https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2947).

Even further evidence comes from the fact that there are and have been
bugs in how the stats work, but they were never reported.  For example,
before Linux v6.7 hash stats were double-counted in most cases.

There has also never been any documentation for this feature, so it
might be hard to use even if someone wanted to.

2. CONFIG_CRYPTO_STATS significantly reduces performance

Enabling CONFIG_CRYPTO_STATS significantly reduces the performance of
the crypto API, even if no program ever retrieves the statistics.  This
primarily affects systems with large number of CPUs.  For example,
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2039576 reported
that Lustre client encryption performance improved from 21.7GB/s to
48.2GB/s by disabling CONFIG_CRYPTO_STATS.

It can be argued that this means that CONFIG_CRYPTO_STATS should be
optimized with per-cpu counters similar to many of the networking
counters.  But no one has done this in 5+ years.  This is consistent
with the fact that the feature appears to be unused, so there seems to
be little interest in improving it as opposed to just disabling it.

It can be argued that because CONFIG_CRYPTO_STATS is off by default,
performance doesn't matter.  But Linux distros tend to error on the side
of enabling options.  The option is enabled in Ubuntu and Arch Linux,
and until recently was enabled in RHEL and Fedora (see above).  So, even
just having the option available is harmful to users.

3. CONFIG_CRYPTO_STATS is a large maintenance burden

There are over 1000 lines of code associated with CONFIG_CRYPTO_STATS,
spread among 32 files.  It significantly complicates much of the
implementation of the crypto API.  After the initial submission, many
fixes and refactorings have consumed effort of multiple people to keep
this feature "working".  We should be spending this effort elsewhere.

Cc: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2024-03-01 18:35:40 +08:00
..
asymmetric_keys crypto: asymmetric_keys - remove redundant pointer secs 2024-01-26 16:39:32 +08:00
async_tx
842.c
acompress.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
adiantum.c crypto: adiantum - flush destination page before unmapping 2023-11-01 12:58:42 +08:00
aead.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
aegis-neon.h
aegis.h
aegis128-core.c
aegis128-neon-inner.c
aegis128-neon.c
aes_generic.c
aes_ti.c
af_alg.c crypto: af_alg - Disallow multiple in-flight AIO requests 2023-12-08 11:59:44 +08:00
ahash.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
akcipher.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
algapi.c crypto: api - Disallow identical driver names 2023-12-15 17:52:53 +08:00
algboss.c
algif_aead.c
algif_hash.c
algif_rng.c
algif_skcipher.c crypto: algif_skcipher - Fix stream cipher chaining 2023-12-08 11:59:46 +08:00
ansi_cprng.c
anubis.c
api.c crypto: api - Remove unnecessary NULL initialisation 2023-09-20 13:15:29 +08:00
arc4.c crypto: arc4 - Add internal state 2023-12-08 11:59:46 +08:00
aria_generic.c
authenc.c crypto: authenc - stop using alignmask of ahash 2023-10-27 18:04:29 +08:00
authencesn.c crypto: authencesn - stop using alignmask of ahash 2023-10-27 18:04:29 +08:00
blake2b_generic.c
blowfish_common.c
blowfish_generic.c
camellia_generic.c
cast5_generic.c
cast6_generic.c
cast_common.c
cbc.c crypto: skcipher - Add internal state support 2023-12-08 11:59:46 +08:00
ccm.c crypto: ccm - stop using alignmask of ahash 2023-10-27 18:04:29 +08:00
chacha20poly1305.c crypto: chacha20poly1305 - stop using alignmask of ahash 2023-10-27 18:04:29 +08:00
chacha_generic.c
cipher.c
cmac.c crypto: cmac - remove unnecessary alignment logic 2023-10-27 18:04:24 +08:00
compress.c
compress.h crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
crc32_generic.c
crc32c_generic.c
crc64_rocksoft_generic.c
crct10dif_common.c
crct10dif_generic.c
cryptd.c crypto: cryptd - Only access common skcipher fields on spawn 2023-10-13 18:27:26 +08:00
crypto_engine.c crypto: engine - Make crypto_engine_exit() return void 2023-10-01 16:28:15 +08:00
crypto_null.c
crypto_user.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
ctr.c crypto: ctr - Only access common skcipher fields on spawn 2023-10-13 18:27:27 +08:00
cts.c crypto: cts - Only access common skcipher fields on spawn 2023-10-13 18:27:27 +08:00
curve25519-generic.c
deflate.c crypto: deflate - Remove zlib-deflate 2023-10-12 21:59:32 +08:00
des_generic.c
dh.c crypto: dh - Make public key test FIPS-only 2024-03-01 18:35:40 +08:00
dh_helper.c
drbg.c crypto: drbg - Remove SHA1 from drbg 2023-11-17 19:16:29 +08:00
ecb.c crypto: skcipher - Add internal state support 2023-12-08 11:59:46 +08:00
ecc.c
ecc_curve_defs.h
ecdh.c
ecdh_helper.c
ecdsa.c
ecdsasignature.asn1
echainiv.c
ecrdsa.c
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
essiv.c crypto: essiv - Handle lskcipher spawns 2023-10-13 18:27:26 +08:00
fcrypt.c
fips.c
gcm.c crypto: gcm - stop using alignmask of ahash 2023-10-27 18:04:29 +08:00
geniv.c
ghash-generic.c
hash.h crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
hash_info.c crypto: FIPS 202 SHA-3 register in hash info for IMA 2023-10-27 18:04:30 +08:00
hctr2.c crypto: hctr2 - stop using alignmask of shash_alg 2023-10-27 18:04:25 +08:00
hmac.c crypto: hmac - remove unnecessary alignment logic 2023-10-27 18:04:24 +08:00
internal.h
jitterentropy-kcapi.c crypto: jitter - reuse allocated entropy collector 2023-10-13 18:31:07 +08:00
jitterentropy-testing.c
jitterentropy.c crypto: jitter - use permanent health test storage 2023-10-27 18:04:25 +08:00
jitterentropy.h crypto: jitter - reuse allocated entropy collector 2023-10-13 18:31:07 +08:00
Kconfig crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
kdf_sp800108.c
keywrap.c
khazad.c
kpp.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
lrw.c crypto: lrw - Only access common skcipher fields on spawn 2023-10-13 18:27:27 +08:00
lskcipher.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
lz4.c
lz4hc.c
lzo-rle.c
lzo.c
Makefile crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
md4.c
md5.c
michael_mic.c
nhpoly1305.c
pcbc.c crypto: pcbc - remove redundant assignment to nbytes 2024-01-26 16:39:32 +08:00
pcrypt.c
poly1305_generic.c
polyval-generic.c
proc.c
ripemd.h
rmd160.c
rng.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
rsa-pkcs1pad.c crypto: rsa-pkcs1pad - Add FIPS 202 SHA-3 support 2023-10-27 18:04:30 +08:00
rsa.c crypto: rsa - restrict plaintext/ciphertext values more 2024-02-09 12:57:18 +08:00
rsa_helper.c
rsaprivkey.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
rsapubkey.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
scatterwalk.c
scompress.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
seed.c
seqiv.c
serpent_generic.c
sha1_generic.c
sha3_generic.c
sha256_generic.c
sha512_generic.c
shash.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
sig.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
simd.c
skcipher.c crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
skcipher.h crypto: remove CONFIG_CRYPTO_STATS 2024-03-01 18:35:40 +08:00
sm2.c
sm2signature.asn1
sm3.c
sm3_generic.c
sm4.c
sm4_generic.c
streebog_generic.c
tcrypt.c crypto: tcrypt - Remove cfb and ofb 2023-12-08 11:59:46 +08:00
tcrypt.h
tea.c
testmgr.c crypto: testmgr - remove unused xts4096 and xts512 algorithms from testmgr.c 2024-01-26 16:39:33 +08:00
testmgr.h crypto: testmgr - Remove cfb and ofb 2023-12-08 11:59:46 +08:00
twofish_common.c
twofish_generic.c
vmac.c crypto: vmac - don't set alignmask 2023-10-27 18:04:24 +08:00
wp512.c
xcbc.c crypto: xcbc - remove unnecessary alignment logic 2023-10-27 18:04:25 +08:00
xctr.c
xor.c
xts.c crypto: xts - use 'spawn' for underlying single-block cipher 2023-10-20 13:39:25 +08:00
xxhash_generic.c
zstd.c