Skip to contentSkip to conversation

crypto: x86 - fix RCU stalls

RFC PATCH Superseded Robert Elliott 9 participants 126 messages Oct 6, 2022 – Dec 16, 2022 Page 3 of 3

Subsystems (4)
lore
Share & tools
lore
#120 lore raw

PATCH v4 22/24 crypto: x86 - report missing CPU features via module parameters

In reply to Robert Elliott

Don't refuse to load modules based on missing additional x86 features (e.g., OSXSAVE) or x86 XSAVE features (e.g., YMM). Instead, load the module, but don't register any crypto drivers. Report the fact that one or more features are missing in a new missing_x86_features module parameter (0 = no problems, 1 = something is missing; each module parameter description lists all the features that it wants).

For the SHA functions that register up to four drivers based on CPU features, report separate module parameters for each set:
missing_x86_features_avx2 missing_x86_features_avx

---
 arch/x86/crypto/aegis128-aesni-glue.c      | 15 ++++++++++---
 arch/x86/crypto/aria_aesni_avx_glue.c      | 24 +++++++++++---------
 arch/x86/crypto/camellia_aesni_avx2_glue.c | 25 ++++++++++++---------
 arch/x86/crypto/camellia_aesni_avx_glue.c  | 25 ++++++++++++---------
 arch/x86/crypto/cast5_avx_glue.c           | 20 ++++++++++-------
 arch/x86/crypto/cast6_avx_glue.c           | 20 ++++++++++-------
 arch/x86/crypto/curve25519-x86_64.c        | 12 ++++++++--
 arch/x86/crypto/nhpoly1305-avx2-glue.c     | 14 +++++++++---
 arch/x86/crypto/polyval-clmulni_glue.c     | 15 ++++++++++---
 arch/x86/crypto/serpent_avx2_glue.c        | 24 +++++++++++---------
 arch/x86/crypto/serpent_avx_glue.c         | 21 ++++++++++-------
 arch/x86/crypto/sha1_ssse3_glue.c          | 20 +++++++++++++----
 arch/x86/crypto/sha256_ssse3_glue.c        | 18 +++++++++++++--
 arch/x86/crypto/sha512_ssse3_glue.c        | 18 +++++++++++++--
 arch/x86/crypto/sm3_avx_glue.c             | 22 ++++++++++--------
 arch/x86/crypto/sm4_aesni_avx2_glue.c      | 26 +++++++++++++---------
 arch/x86/crypto/sm4_aesni_avx_glue.c       | 26 +++++++++++++---------
 arch/x86/crypto/twofish_avx_glue.c         | 19 ++++++++++------
 18 files changed, 243 insertions(+), 121 deletions(-)
arch/x86/crypto/aegis128-aesni-glue.c +12 -3
index a3ebd018953c..e0312ecf34a8 100644
@@ -288,6 +288,11 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (SSE2) and/or XSAVE features (SSE)");
+
 static struct simd_aead_alg *simd_alg;
 
 static int __init crypto_aegis128_aesni_module_init(void)
@@ -296,8 +301,10 @@ static int __init crypto_aegis128_aesni_module_init(void)
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_XMM2) ||
-	    !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
-		return -ENODEV;
+	    !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL)) {
+		missing_x86_features = 1;
+		return 0;
+	}
 
 	return simd_register_aeads_compat(&crypto_aegis128_aesni_alg, 1,
 					  &simd_alg);
@@ -305,7 +312,9 @@ static int __init crypto_aegis128_aesni_module_init(void)
 
 static void __exit crypto_aegis128_aesni_module_exit(void)
 {
-	simd_unregister_aeads(&crypto_aegis128_aesni_alg, 1, &simd_alg);
+	if (!missing_x86_features)
+		simd_unregister_aeads(&crypto_aegis128_aesni_alg, 1, &simd_alg);
+	missing_x86_features = 0;
 }
 
 module_init(crypto_aegis128_aesni_module_init);
arch/x86/crypto/aria_aesni_avx_glue.c +14 -10
index 9fd3d1fe1105..ebb9760967b5 100644
@@ -176,23 +176,25 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (AES-NI, OSXSAVE) and/or XSAVE features (SSE, YMM)");
+
 static int __init aria_avx_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_AES) ||
 	    !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-		pr_info("AES or OSXSAVE instructions are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	if (boot_cpu_has(X86_FEATURE_GFNI)) {
@@ -213,8 +215,10 @@ static int __init aria_avx_init(void)
 
 static void __exit aria_avx_exit(void)
 {
-	simd_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs),
-				  aria_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs),
+					  aria_simd_algs);
+	missing_x86_features = 0;
 	using_x86_gfni = 0;
 }
 
arch/x86/crypto/camellia_aesni_avx2_glue.c +15 -10
index 6c48fc9f3fde..e8ae1e1a801d 100644
@@ -105,26 +105,28 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (AES-NI, AVX, OSXSAVE) and/or XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *camellia_simd_algs[ARRAY_SIZE(camellia_algs)];
 
 static int __init camellia_aesni_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_AES) ||
 	    !boot_cpu_has(X86_FEATURE_AVX) ||
 	    !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-		pr_info("AES-NI, AVX, or OSXSAVE instructions are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(camellia_algs,
@@ -134,8 +136,11 @@ static int __init camellia_aesni_init(void)
 
 static void __exit camellia_aesni_fini(void)
 {
-	simd_unregister_skciphers(camellia_algs, ARRAY_SIZE(camellia_algs),
-				  camellia_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(camellia_algs,
+					  ARRAY_SIZE(camellia_algs),
+					  camellia_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(camellia_aesni_init);
arch/x86/crypto/camellia_aesni_avx_glue.c +15 -10
index 6d7fc96d242e..6784d631575c 100644
@@ -105,25 +105,27 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (AES-NI, OSXSAVE) and/or XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *camellia_simd_algs[ARRAY_SIZE(camellia_algs)];
 
 static int __init camellia_aesni_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_AES) ||
 	    !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-		pr_info("AES-NI or OSXSAVE instructions are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(camellia_algs,
@@ -133,8 +135,11 @@ static int __init camellia_aesni_init(void)
 
 static void __exit camellia_aesni_fini(void)
 {
-	simd_unregister_skciphers(camellia_algs, ARRAY_SIZE(camellia_algs),
-				  camellia_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(camellia_algs,
+					  ARRAY_SIZE(camellia_algs),
+					  camellia_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(camellia_aesni_init);
arch/x86/crypto/cast5_avx_glue.c +12 -8
index bdc3c763334c..34ef032bb8d0 100644
@@ -100,19 +100,21 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *cast5_simd_algs[ARRAY_SIZE(cast5_algs)];
 
 static int __init cast5_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(cast5_algs,
@@ -122,8 +124,10 @@ static int __init cast5_init(void)
 
 static void __exit cast5_exit(void)
 {
-	simd_unregister_skciphers(cast5_algs, ARRAY_SIZE(cast5_algs),
-				  cast5_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(cast5_algs, ARRAY_SIZE(cast5_algs),
+					  cast5_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(cast5_init);
arch/x86/crypto/cast6_avx_glue.c +12 -8
index addca34b3511..71559fd3ea87 100644
@@ -100,19 +100,21 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *cast6_simd_algs[ARRAY_SIZE(cast6_algs)];
 
 static int __init cast6_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(cast6_algs,
@@ -122,8 +124,10 @@ static int __init cast6_init(void)
 
 static void __exit cast6_exit(void)
 {
-	simd_unregister_skciphers(cast6_algs, ARRAY_SIZE(cast6_algs),
-				  cast6_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(cast6_algs, ARRAY_SIZE(cast6_algs),
+					  cast6_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(cast6_init);
arch/x86/crypto/curve25519-x86_64.c +10 -2
index 6d222849e409..74672351e534 100644
@@ -1706,13 +1706,20 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (BMI2)");
+
 static int __init curve25519_mod_init(void)
 {
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!boot_cpu_has(X86_FEATURE_BMI2))
-		return -ENODEV;
+	if (!boot_cpu_has(X86_FEATURE_BMI2)) {
+		missing_x86_features = 1;
+		return 0;
+	}
 
 	static_branch_enable(&curve25519_use_bmi2_adx);
 
@@ -1725,6 +1732,7 @@ static void __exit curve25519_mod_exit(void)
 	if (IS_REACHABLE(CONFIG_CRYPTO_KPP) &&
 	    static_branch_likely(&curve25519_use_bmi2_adx))
 		crypto_unregister_kpp(&curve25519_alg);
+	missing_x86_features = 0;
 }
 
 module_init(curve25519_mod_init);
arch/x86/crypto/nhpoly1305-avx2-glue.c +11 -3
index fa415fec5793..2e63947bc9fa 100644
@@ -67,20 +67,28 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (OSXSAVE)");
+
 static int __init nhpoly1305_mod_init(void)
 {
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!boot_cpu_has(X86_FEATURE_OSXSAVE))
-		return -ENODEV;
+	if (!boot_cpu_has(X86_FEATURE_OSXSAVE)) {
+		missing_x86_features = 1;
+		return 0;
+	}
 
 	return crypto_register_shash(&nhpoly1305_alg);
 }
 
 static void __exit nhpoly1305_mod_exit(void)
 {
-	crypto_unregister_shash(&nhpoly1305_alg);
+	if (!missing_x86_features)
+		crypto_unregister_shash(&nhpoly1305_alg);
 }
 
 module_init(nhpoly1305_mod_init);
arch/x86/crypto/polyval-clmulni_glue.c +12 -3
index b98e32f8e2a4..20d4a68ec1d7 100644
@@ -182,20 +182,29 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (AVX)");
+
 static int __init polyval_clmulni_mod_init(void)
 {
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!boot_cpu_has(X86_FEATURE_AVX))
-		return -ENODEV;
+	if (!boot_cpu_has(X86_FEATURE_AVX)) {
+		missing_x86_features = 1;
+		return 0;
+	}
 
 	return crypto_register_shash(&polyval_alg);
 }
 
 static void __exit polyval_clmulni_mod_exit(void)
 {
-	crypto_unregister_shash(&polyval_alg);
+	if (!missing_x86_features)
+		crypto_unregister_shash(&polyval_alg);
+	missing_x86_features = 0;
 }
 
 module_init(polyval_clmulni_mod_init);
arch/x86/crypto/serpent_avx2_glue.c +14 -10
index bc18149fb928..2aa62c93a16f 100644
@@ -101,23 +101,25 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (OSXSAVE) and/or XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *serpent_simd_algs[ARRAY_SIZE(serpent_algs)];
 
 static int __init serpent_avx2_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-		pr_info("OSXSAVE instructions are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(serpent_algs,
@@ -127,8 +129,10 @@ static int __init serpent_avx2_init(void)
 
 static void __exit serpent_avx2_fini(void)
 {
-	simd_unregister_skciphers(serpent_algs, ARRAY_SIZE(serpent_algs),
-				  serpent_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(serpent_algs, ARRAY_SIZE(serpent_algs),
+					  serpent_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(serpent_avx2_init);
arch/x86/crypto/serpent_avx_glue.c +13 -8
index 0db18d99da50..28ee9717df49 100644
@@ -107,19 +107,21 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *serpent_simd_algs[ARRAY_SIZE(serpent_algs)];
 
 static int __init serpent_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(serpent_algs,
@@ -129,8 +131,11 @@ static int __init serpent_init(void)
 
 static void __exit serpent_exit(void)
 {
-	simd_unregister_skciphers(serpent_algs, ARRAY_SIZE(serpent_algs),
-				  serpent_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(serpent_algs,
+					  ARRAY_SIZE(serpent_algs),
+					  serpent_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(serpent_init);
arch/x86/crypto/sha1_ssse3_glue.c +16 -4
index 2445648cf234..405af5e14b67 100644
@@ -351,9 +351,17 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features_avx2;
+static int missing_x86_features_avx;
+module_param(missing_x86_features_avx2, int, 0444);
+module_param(missing_x86_features_avx, int, 0444);
+MODULE_PARM_DESC(missing_x86_features_avx2,
+		 "Missing x86 instruction set extensions (BMI1, BMI2) to support AVX2");
+MODULE_PARM_DESC(missing_x86_features_avx,
+		 "Missing x86 XSAVE features (SSE, YMM) to support AVX");
+
 static int __init sha1_ssse3_mod_init(void)
 {
-	const char *feature_name;
 	int ret;
 
 	if (!x86_match_cpu(module_cpu_ids))
@@ -374,10 +382,11 @@ static int __init sha1_ssse3_mod_init(void)
 
 		if (boot_cpu_has(X86_FEATURE_BMI1) &&
 		    boot_cpu_has(X86_FEATURE_BMI2)) {
-
 			ret = crypto_register_shash(&sha1_avx2_alg);
 			if (!ret)
 				using_x86_avx2 = 1;
+		} else {
+			missing_x86_features_avx2 = 1;
 		}
 	}
 
@@ -385,11 +394,12 @@ static int __init sha1_ssse3_mod_init(void)
 	if (boot_cpu_has(X86_FEATURE_AVX)) {
 
 		if (cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-			       &feature_name)) {
-
+				      NULL)) {
 			ret = crypto_register_shash(&sha1_avx_alg);
 			if (!ret)
 				using_x86_avx = 1;
+		} else {
+			missing_x86_features_avx = 1;
 		}
 	}
 
@@ -415,6 +425,8 @@ static void __exit sha1_ssse3_mod_fini(void)
 	unregister_sha1_avx2();
 	unregister_sha1_avx();
 	unregister_sha1_ssse3();
+	missing_x86_features_avx2 = 0;
+	missing_x86_features_avx = 0;
 }
 
 module_init(sha1_ssse3_mod_init);
arch/x86/crypto/sha256_ssse3_glue.c +16 -2
index 1464e6ccf912..293cf7085dd3 100644
@@ -413,9 +413,17 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features_avx2;
+static int missing_x86_features_avx;
+module_param(missing_x86_features_avx2, int, 0444);
+module_param(missing_x86_features_avx, int, 0444);
+MODULE_PARM_DESC(missing_x86_features_avx2,
+		 "Missing x86 instruction set extensions (BMI2) to support AVX2");
+MODULE_PARM_DESC(missing_x86_features_avx,
+		 "Missing x86 XSAVE features (SSE, YMM) to support AVX");
+
 static int __init sha256_ssse3_mod_init(void)
 {
-	const char *feature_name;
 	int ret;
 
 	if (!x86_match_cpu(module_cpu_ids))
@@ -440,6 +448,8 @@ static int __init sha256_ssse3_mod_init(void)
 						ARRAY_SIZE(sha256_avx2_algs));
 			if (!ret)
 				using_x86_avx2 = 1;
+		} else {
+			missing_x86_features_avx2 = 1;
 		}
 	}
 
@@ -447,11 +457,13 @@ static int __init sha256_ssse3_mod_init(void)
 	if (boot_cpu_has(X86_FEATURE_AVX)) {
 
 		if (cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-			       &feature_name)) {
+				      NULL)) {
 			ret = crypto_register_shashes(sha256_avx_algs,
 						ARRAY_SIZE(sha256_avx_algs));
 			if (!ret)
 				using_x86_avx = 1;
+		} else {
+			missing_x86_features_avx = 1;
 		}
 	}
 
@@ -478,6 +490,8 @@ static void __exit sha256_ssse3_mod_fini(void)
 	unregister_sha256_avx2();
 	unregister_sha256_avx();
 	unregister_sha256_ssse3();
+	missing_x86_features_avx2 = 0;
+	missing_x86_features_avx = 0;
 }
 
 module_init(sha256_ssse3_mod_init);
arch/x86/crypto/sha512_ssse3_glue.c +16 -2
index 04e2af951a3e..9f13baf7dda9 100644
@@ -319,6 +319,15 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features_avx2;
+static int missing_x86_features_avx;
+module_param(missing_x86_features_avx2, int, 0444);
+module_param(missing_x86_features_avx, int, 0444);
+MODULE_PARM_DESC(missing_x86_features_avx2,
+		 "Missing x86 instruction set extensions (BMI2) to support AVX2");
+MODULE_PARM_DESC(missing_x86_features_avx,
+		 "Missing x86 XSAVE features (SSE, YMM) to support AVX");
+
 static void unregister_sha512_avx2(void)
 {
 	if (using_x86_avx2) {
@@ -330,7 +339,6 @@ static void unregister_sha512_avx2(void)
 
 static int __init sha512_ssse3_mod_init(void)
 {
-	const char *feature_name;
 	int ret;
 
 	if (!x86_match_cpu(module_cpu_ids))
@@ -343,6 +351,8 @@ static int __init sha512_ssse3_mod_init(void)
 					ARRAY_SIZE(sha512_avx2_algs));
 			if (!ret)
 				using_x86_avx2 = 1;
+		} else {
+			missing_x86_features_avx2 = 1;
 		}
 	}
 
@@ -350,11 +360,13 @@ static int __init sha512_ssse3_mod_init(void)
 	if (boot_cpu_has(X86_FEATURE_AVX)) {
 
 		if (cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				       &feature_name)) {
+				      NULL)) {
 			ret = crypto_register_shashes(sha512_avx_algs,
 					ARRAY_SIZE(sha512_avx_algs));
 			if (!ret)
 				using_x86_avx = 1;
+		} else {
+			missing_x86_features_avx = 1;
 		}
 	}
 
@@ -376,6 +388,8 @@ static void __exit sha512_ssse3_mod_fini(void)
 	unregister_sha512_avx2();
 	unregister_sha512_avx();
 	unregister_sha512_ssse3();
+	missing_x86_features_avx2 = 0;
+	missing_x86_features_avx = 0;
 }
 
 module_init(sha512_ssse3_mod_init);
arch/x86/crypto/sm3_avx_glue.c +13 -9
index c7786874319c..169ba6a2c806 100644
@@ -126,22 +126,24 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (BMI2) and/or XSAVE features (SSE, YMM)");
+
 static int __init sm3_avx_mod_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_BMI2)) {
-		pr_info("BMI2 instruction are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return crypto_register_shash(&sm3_avx_alg);
@@ -149,7 +151,9 @@ static int __init sm3_avx_mod_init(void)
 
 static void __exit sm3_avx_mod_exit(void)
 {
-	crypto_unregister_shash(&sm3_avx_alg);
+	if (!missing_x86_features)
+		crypto_unregister_shash(&sm3_avx_alg);
+	missing_x86_features = 0;
 }
 
 module_init(sm3_avx_mod_init);
arch/x86/crypto/sm4_aesni_avx2_glue.c +15 -11
index 125b00db89b1..6bcf78231888 100644
@@ -133,27 +133,29 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (AES-NI, AVX, OSXSAVE) and/or XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *
 simd_sm4_aesni_avx2_skciphers[ARRAY_SIZE(sm4_aesni_avx2_skciphers)];
 
 static int __init sm4_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_AVX) ||
 	    !boot_cpu_has(X86_FEATURE_AES) ||
 	    !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-		pr_info("AVX, AES-NI, and/or OSXSAVE instructions are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(sm4_aesni_avx2_skciphers,
@@ -163,9 +165,11 @@ static int __init sm4_init(void)
 
 static void __exit sm4_exit(void)
 {
-	simd_unregister_skciphers(sm4_aesni_avx2_skciphers,
-				ARRAY_SIZE(sm4_aesni_avx2_skciphers),
-				simd_sm4_aesni_avx2_skciphers);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(sm4_aesni_avx2_skciphers,
+					  ARRAY_SIZE(sm4_aesni_avx2_skciphers),
+					  simd_sm4_aesni_avx2_skciphers);
+	missing_x86_features = 0;
 }
 
 module_init(sm4_init);
arch/x86/crypto/sm4_aesni_avx_glue.c +15 -11
index ac8182b197cf..03775b1079dc 100644
@@ -452,26 +452,28 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 instruction set extensions (AES-NI, OSXSAVE) and/or XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *
 simd_sm4_aesni_avx_skciphers[ARRAY_SIZE(sm4_aesni_avx_skciphers)];
 
 static int __init sm4_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
 	if (!boot_cpu_has(X86_FEATURE_AES) ||
 	    !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-		pr_info("AES-NI or OSXSAVE instructions are not detected.\n");
-		return -ENODEV;
+		missing_x86_features = 1;
+		return 0;
 	}
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
-				&feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(sm4_aesni_avx_skciphers,
@@ -481,9 +483,11 @@ static int __init sm4_init(void)
 
 static void __exit sm4_exit(void)
 {
-	simd_unregister_skciphers(sm4_aesni_avx_skciphers,
-					ARRAY_SIZE(sm4_aesni_avx_skciphers),
-					simd_sm4_aesni_avx_skciphers);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(sm4_aesni_avx_skciphers,
+					  ARRAY_SIZE(sm4_aesni_avx_skciphers),
+					  simd_sm4_aesni_avx_skciphers);
+	missing_x86_features = 0;
 }
 
 module_init(sm4_init);
arch/x86/crypto/twofish_avx_glue.c +12 -7
index 4657e6efc35d..ae3cc4ad6f4f 100644
@@ -110,18 +110,21 @@ static const struct x86_cpu_id module_cpu_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);
 
+static int missing_x86_features;
+module_param(missing_x86_features, int, 0444);
+MODULE_PARM_DESC(missing_x86_features,
+		 "Missing x86 XSAVE features (SSE, YMM)");
+
 static struct simd_skcipher_alg *twofish_simd_algs[ARRAY_SIZE(twofish_algs)];
 
 static int __init twofish_init(void)
 {
-	const char *feature_name;
-
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, &feature_name)) {
-		pr_info("CPU feature '%s' is not supported.\n", feature_name);
-		return -ENODEV;
+	if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
+		missing_x86_features = 1;
+		return 0;
 	}
 
 	return simd_register_skciphers_compat(twofish_algs,
@@ -131,8 +134,10 @@ static int __init twofish_init(void)
 
 static void __exit twofish_exit(void)
 {
-	simd_unregister_skciphers(twofish_algs, ARRAY_SIZE(twofish_algs),
-				  twofish_simd_algs);
+	if (!missing_x86_features)
+		simd_unregister_skciphers(twofish_algs, ARRAY_SIZE(twofish_algs),
+					  twofish_simd_algs);
+	missing_x86_features = 0;
 }
 
 module_init(twofish_init);
Signature · 1 line
2.38.1
#121 lore raw

PATCH v4 23/24 crypto: x86 - report suboptimal CPUs via module parameters

In reply to Robert Elliott

Don't refuse to load modules on certain CPUs and print a message
to the console. Instead, load the module but don't register the
crypto functions, and report this condition via a new module suboptimal_x86 module parameter with this description:
Crypto driver not registered because performance on this CPU would be suboptimal

Reword the descriptions of the existing force module parameter to match this modified behavior:
force: Force crypto driver registration on suboptimal CPUs

Make the new module parameters readable via sysfs:

	/sys/module/blowfish_x86_64/parameters/suboptimal_x86:0
	/sys/module/camellia_x86_64/parameters/suboptimal_x86:0
	/sys/module/des3_ede_x86_64/parameters/suboptimal_x86:1
	/sys/module/twofish_x86_64_3way/parameters/suboptimal_x86:1

If the module has been loaded and is reporting suboptimal_x86=1, remove it to try loading again:

	modprobe -r blowfish_x86_64
	modprobe blowfish_x86_64 force=1

or specify it on the kernel command line:

	blowfish_x86_64.force=1
---
 arch/x86/crypto/blowfish_glue.c     | 29 +++++++++++++++++------------
 arch/x86/crypto/camellia_glue.c     | 27 ++++++++++++++++-----------
 arch/x86/crypto/des3_ede_glue.c     | 26 +++++++++++++++++---------
 arch/x86/crypto/twofish_glue_3way.c | 26 +++++++++++++++-----------
 4 files changed, 65 insertions(+), 43 deletions(-)
arch/x86/crypto/blowfish_glue.c +17 -12
index 4c0ead71b198..8e4de7859e34 100644
@@ -283,7 +283,7 @@ static struct skcipher_alg bf_skcipher_algs[] = {
 	},
 };
 
-static bool is_blacklisted_cpu(void)
+static bool is_suboptimal_cpu(void)
 {
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
 		return false;
@@ -292,7 +292,7 @@ static bool is_blacklisted_cpu(void)
 		/*
 		 * On Pentium 4, blowfish-x86_64 is slower than generic C
 		 * implementation because use of 64bit rotates (which are really
-		 * slow on P4). Therefore blacklist P4s.
+		 * slow on P4).
 		 */
 		return true;
 	}
@@ -302,7 +302,12 @@ static bool is_blacklisted_cpu(void)
 
 static int force;
 module_param(force, int, 0);
-MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
+MODULE_PARM_DESC(force, "Force crypto driver registration on suboptimal CPUs");
+
+static int suboptimal_x86;
+module_param(suboptimal_x86, int, 0444);
+MODULE_PARM_DESC(suboptimal_x86,
+		 "Crypto driver not registered because performance on this CPU would be suboptimal");
 
 static const struct x86_cpu_id module_cpu_ids[] = {
 	X86_MATCH_FEATURE(X86_FEATURE_ANY, NULL),
@@ -317,12 +322,9 @@ static int __init blowfish_init(void)
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!force && is_blacklisted_cpu()) {
-		printk(KERN_INFO
-			"blowfish-x86_64: performance on this CPU "
-			"would be suboptimal: disabling "
-			"blowfish-x86_64.\n");
-		return -ENODEV;
+	if (!force && is_suboptimal_cpu()) {
+		suboptimal_x86 = 1;
+		return 0;
 	}
 
 	err = crypto_register_alg(&bf_cipher_alg);
@@ -339,9 +341,12 @@ static int __init blowfish_init(void)
 
 static void __exit blowfish_fini(void)
 {
-	crypto_unregister_alg(&bf_cipher_alg);
-	crypto_unregister_skciphers(bf_skcipher_algs,
-				    ARRAY_SIZE(bf_skcipher_algs));
+	if (!suboptimal_x86) {
+		crypto_unregister_alg(&bf_cipher_alg);
+		crypto_unregister_skciphers(bf_skcipher_algs,
+					    ARRAY_SIZE(bf_skcipher_algs));
+	}
+	suboptimal_x86 = 0;
 }
 
 module_init(blowfish_init);
arch/x86/crypto/camellia_glue.c +16 -11
index a3df1043ed73..2cb9b24d9437 100644
@@ -1356,7 +1356,7 @@ static struct skcipher_alg camellia_skcipher_algs[] = {
 	}
 };
 
-static bool is_blacklisted_cpu(void)
+static bool is_suboptimal_cpu(void)
 {
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
 		return false;
@@ -1376,7 +1376,12 @@ static bool is_blacklisted_cpu(void)
 
 static int force;
 module_param(force, int, 0);
-MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
+MODULE_PARM_DESC(force, "Force crypto driver registration on suboptimal CPUs");
+
+static int suboptimal_x86;
+module_param(suboptimal_x86, int, 0444);
+MODULE_PARM_DESC(suboptimal_x86,
+		 "Crypto driver not registered because performance on this CPU would be suboptimal");
 
 static const struct x86_cpu_id module_cpu_ids[] = {
 	X86_MATCH_FEATURE(X86_FEATURE_ANY, NULL),
@@ -1391,12 +1396,9 @@ static int __init camellia_init(void)
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!force && is_blacklisted_cpu()) {
-		printk(KERN_INFO
-			"camellia-x86_64: performance on this CPU "
-			"would be suboptimal: disabling "
-			"camellia-x86_64.\n");
-		return -ENODEV;
+	if (!force && is_suboptimal_cpu()) {
+		suboptimal_x86 = 1;
+		return 0;
 	}
 
 	err = crypto_register_alg(&camellia_cipher_alg);
@@ -1413,9 +1415,12 @@ static int __init camellia_init(void)
 
 static void __exit camellia_fini(void)
 {
-	crypto_unregister_alg(&camellia_cipher_alg);
-	crypto_unregister_skciphers(camellia_skcipher_algs,
-				    ARRAY_SIZE(camellia_skcipher_algs));
+	if (!suboptimal_x86) {
+		crypto_unregister_alg(&camellia_cipher_alg);
+		crypto_unregister_skciphers(camellia_skcipher_algs,
+					    ARRAY_SIZE(camellia_skcipher_algs));
+	}
+	suboptimal_x86 = 0;
 }
 
 module_init(camellia_init);
arch/x86/crypto/des3_ede_glue.c +17 -9
index 168cac5c6ca6..a4cac5129148 100644
@@ -334,7 +334,7 @@ static struct skcipher_alg des3_ede_skciphers[] = {
 	}
 };
 
-static bool is_blacklisted_cpu(void)
+static bool is_suboptimal_cpu(void)
 {
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
 		return false;
@@ -343,7 +343,7 @@ static bool is_blacklisted_cpu(void)
 		/*
 		 * On Pentium 4, des3_ede-x86_64 is slower than generic C
 		 * implementation because use of 64bit rotates (which are really
-		 * slow on P4). Therefore blacklist P4s.
+		 * slow on P4).
 		 */
 		return true;
 	}
@@ -353,7 +353,12 @@ static bool is_blacklisted_cpu(void)
 
 static int force;
 module_param(force, int, 0);
-MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
+MODULE_PARM_DESC(force, "Force crypto driver registration on suboptimal CPUs");
+
+static int suboptimal_x86;
+module_param(suboptimal_x86, int, 0444);
+MODULE_PARM_DESC(suboptimal_x86,
+		 "Crypto driver not registered because performance on this CPU would be suboptimal");
 
 static const struct x86_cpu_id module_cpu_ids[] = {
 	X86_MATCH_FEATURE(X86_FEATURE_ANY, NULL),
@@ -368,9 +373,9 @@ static int __init des3_ede_x86_init(void)
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!force && is_blacklisted_cpu()) {
-		pr_info("des3_ede-x86_64: performance on this CPU would be suboptimal: disabling des3_ede-x86_64.\n");
-		return -ENODEV;
+	if (!force && is_suboptimal_cpu()) {
+		suboptimal_x86 = 1;
+		return 0;
 	}
 
 	err = crypto_register_alg(&des3_ede_cipher);
@@ -387,9 +392,12 @@ static int __init des3_ede_x86_init(void)
 
 static void __exit des3_ede_x86_fini(void)
 {
-	crypto_unregister_alg(&des3_ede_cipher);
-	crypto_unregister_skciphers(des3_ede_skciphers,
-				    ARRAY_SIZE(des3_ede_skciphers));
+	if (!suboptimal_x86) {
+		crypto_unregister_alg(&des3_ede_cipher);
+		crypto_unregister_skciphers(des3_ede_skciphers,
+					    ARRAY_SIZE(des3_ede_skciphers));
+	}
+	suboptimal_x86 = 0;
 }
 
 module_init(des3_ede_x86_init);
arch/x86/crypto/twofish_glue_3way.c +15 -11
index 790e5a59a9a7..8db2f23b3056 100644
@@ -103,7 +103,7 @@ static struct skcipher_alg tf_skciphers[] = {
 	},
 };
 
-static bool is_blacklisted_cpu(void)
+static bool is_suboptimal_cpu(void)
 {
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
 		return false;
@@ -118,8 +118,7 @@ static bool is_blacklisted_cpu(void)
 		 * storing blocks in 64bit registers to allow three blocks to
 		 * be processed parallel. Parallel operation then allows gaining
 		 * more performance than was trade off, on out-of-order CPUs.
-		 * However Atom does not benefit from this parallelism and
-		 * should be blacklisted.
+		 * However Atom does not benefit from this parallelism.
 		 */
 		return true;
 	}
@@ -139,7 +138,12 @@ static bool is_blacklisted_cpu(void)
 
 static int force;
 module_param(force, int, 0);
-MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
+MODULE_PARM_DESC(force, "Force crypto driver registration on suboptimal CPUs");
+
+static int suboptimal_x86;
+module_param(suboptimal_x86, int, 0444);
+MODULE_PARM_DESC(suboptimal_x86,
+		 "Crypto driver not registered because performance on this CPU would be suboptimal");
 
 static const struct x86_cpu_id module_cpu_ids[] = {
 	X86_MATCH_FEATURE(X86_FEATURE_ANY, NULL),
@@ -152,12 +156,9 @@ static int __init twofish_3way_init(void)
 	if (!x86_match_cpu(module_cpu_ids))
 		return -ENODEV;
 
-	if (!force && is_blacklisted_cpu()) {
-		printk(KERN_INFO
-			"twofish-x86_64-3way: performance on this CPU "
-			"would be suboptimal: disabling "
-			"twofish-x86_64-3way.\n");
-		return -ENODEV;
+	if (!force && is_suboptimal_cpu()) {
+		suboptimal_x86 = 1;
+		return 0;
 	}
 
 	return crypto_register_skciphers(tf_skciphers,
@@ -166,7 +167,10 @@ static int __init twofish_3way_init(void)
 
 static void __exit twofish_3way_fini(void)
 {
-	crypto_unregister_skciphers(tf_skciphers, ARRAY_SIZE(tf_skciphers));
+	if (!suboptimal_x86)
+		crypto_unregister_skciphers(tf_skciphers, ARRAY_SIZE(tf_skciphers));
+
+	suboptimal_x86 = 0;
 }
 
 module_init(twofish_3way_init);
Signature · 1 line
2.38.1
#122 lore raw

PATCH v4 24/24 crypto: x86 - standarize module descriptions

In reply to Robert Elliott

Make the module descriptions for the x86 optimized crypto modules match the descriptions of the generic modules and the names in Kconfig.

End each description with "with <feature name>" listing the features used for module matching.
"-- accelerated for x86 with AVX2"

Mention any other required CPU features:
"(also required: AES-NI)"

Mention any CPU features that are not required but enable additional acceleration:

    "(optional: GF-NI)"
---
 arch/x86/crypto/aegis128-aesni-glue.c      | 2 +-
 arch/x86/crypto/aesni-intel_glue.c         | 2 +-
 arch/x86/crypto/aria_aesni_avx_glue.c      | 2 +-
 arch/x86/crypto/blake2s-glue.c             | 1 +
 arch/x86/crypto/blowfish_glue.c            | 2 +-
 arch/x86/crypto/camellia_aesni_avx2_glue.c | 2 +-
 arch/x86/crypto/camellia_aesni_avx_glue.c  | 2 +-
 arch/x86/crypto/camellia_glue.c            | 2 +-
 arch/x86/crypto/cast5_avx_glue.c           | 2 +-
 arch/x86/crypto/cast6_avx_glue.c           | 2 +-
 arch/x86/crypto/chacha_glue.c              | 2 +-
 arch/x86/crypto/crc32-pclmul_glue.c        | 2 +-
 arch/x86/crypto/crc32c-intel_glue.c        | 2 +-
 arch/x86/crypto/crct10dif-pclmul_glue.c    | 2 +-
 arch/x86/crypto/curve25519-x86_64.c        | 1 +
 arch/x86/crypto/des3_ede_glue.c            | 2 +-
 arch/x86/crypto/ghash-clmulni-intel_glue.c | 2 +-
 arch/x86/crypto/nhpoly1305-avx2-glue.c     | 2 +-
 arch/x86/crypto/nhpoly1305-sse2-glue.c     | 2 +-
 arch/x86/crypto/poly1305_glue.c            | 2 +-
 arch/x86/crypto/polyval-clmulni_glue.c     | 2 +-
 arch/x86/crypto/serpent_avx2_glue.c        | 2 +-
 arch/x86/crypto/serpent_avx_glue.c         | 2 +-
 arch/x86/crypto/serpent_sse2_glue.c        | 2 +-
 arch/x86/crypto/sha1_ssse3_glue.c          | 2 +-
 arch/x86/crypto/sha256_ssse3_glue.c        | 2 +-
 arch/x86/crypto/sha512_ssse3_glue.c        | 2 +-
 arch/x86/crypto/sm3_avx_glue.c             | 2 +-
 arch/x86/crypto/sm4_aesni_avx2_glue.c      | 2 +-
 arch/x86/crypto/sm4_aesni_avx_glue.c       | 2 +-
 arch/x86/crypto/twofish_avx_glue.c         | 2 +-
 arch/x86/crypto/twofish_glue.c             | 2 +-
 arch/x86/crypto/twofish_glue_3way.c        | 2 +-
 crypto/aes_ti.c                            | 2 +-
 crypto/blake2b_generic.c                   | 2 +-
 crypto/blowfish_common.c                   | 2 +-
 crypto/crct10dif_generic.c                 | 2 +-
 crypto/curve25519-generic.c                | 1 +
 crypto/sha256_generic.c                    | 2 +-
 crypto/sha512_generic.c                    | 2 +-
 crypto/sm3.c                               | 2 +-
 crypto/sm4.c                               | 2 +-
 crypto/twofish_common.c                    | 2 +-
 crypto/twofish_generic.c                   | 2 +-
 44 files changed, 44 insertions(+), 41 deletions(-)
arch/x86/crypto/aegis128-aesni-glue.c +1 -1
index e0312ecf34a8..e72ae7ba5f12 100644
@@ -322,6 +322,6 @@ module_exit(crypto_aegis128_aesni_module_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Ondrej Mosnacek <[email protected]>");
-MODULE_DESCRIPTION("AEGIS-128 AEAD algorithm -- AESNI+SSE2 implementation");
+MODULE_DESCRIPTION("AEGIS-128 AEAD algorithm -- accelerated for x86 with AES-NI (also required: SEE2)");
 MODULE_ALIAS_CRYPTO("aegis128");
 MODULE_ALIAS_CRYPTO("aegis128-aesni");
arch/x86/crypto/aesni-intel_glue.c +1 -1
index 80dbf98c53fd..3d8508598e76 100644
@@ -1311,6 +1311,6 @@ static void __exit aesni_exit(void)
 late_initcall(aesni_init);
 module_exit(aesni_exit);
 
-MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, Intel AES-NI instructions optimized");
+MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm -- accelerated for x86 with AES-NI (optional: AVX, AVX2)");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("aes");
arch/x86/crypto/aria_aesni_avx_glue.c +1 -1
index ebb9760967b5..1d23c7ef7aef 100644
@@ -227,6 +227,6 @@ module_exit(aria_avx_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Taehee Yoo <[email protected]>");
-MODULE_DESCRIPTION("ARIA Cipher Algorithm, AVX/AES-NI/GFNI optimized");
+MODULE_DESCRIPTION("ARIA Cipher Algorithm -- accelerated for x86 with AVX (also required: AES-NI, OSXSAVE)(optional: GF-NI)");
 MODULE_ALIAS_CRYPTO("aria");
 MODULE_ALIAS_CRYPTO("aria-aesni-avx");
arch/x86/crypto/blake2s-glue.c +1 -0
index 781cf9471cb6..0618f0d31fae 100644
@@ -90,3 +90,4 @@ static int __init blake2s_mod_init(void)
 module_init(blake2s_mod_init);
 
 MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("BLAKE2s hash algorithm -- accelerated for x86 with SSSE3 or AVX-512VL");
arch/x86/crypto/blowfish_glue.c +1 -1
index 8e4de7859e34..67f7562d2d02 100644
@@ -353,6 +353,6 @@ module_init(blowfish_init);
 module_exit(blowfish_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Blowfish Cipher Algorithm, asm optimized");
+MODULE_DESCRIPTION("Blowfish Cipher Algorithm -- accelerated for x86");
 MODULE_ALIAS_CRYPTO("blowfish");
 MODULE_ALIAS_CRYPTO("blowfish-asm");
arch/x86/crypto/camellia_aesni_avx2_glue.c +1 -1
index e8ae1e1a801d..da89fef184d2 100644
@@ -147,6 +147,6 @@ module_init(camellia_aesni_init);
 module_exit(camellia_aesni_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX2 optimized");
+MODULE_DESCRIPTION("Camellia Cipher Algorithm -- accelerated for x86 with AVX2 (also required: AES-NI, AVX, OSXSAVE)");
 MODULE_ALIAS_CRYPTO("camellia");
 MODULE_ALIAS_CRYPTO("camellia-asm");
arch/x86/crypto/camellia_aesni_avx_glue.c +1 -1
index 6784d631575c..0eebb56bc440 100644
@@ -146,6 +146,6 @@ module_init(camellia_aesni_init);
 module_exit(camellia_aesni_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX optimized");
+MODULE_DESCRIPTION("Camellia Cipher Algorithm -- accelerated for x86 with AVX (also required: AES-NI, OSXSAVE)");
 MODULE_ALIAS_CRYPTO("camellia");
 MODULE_ALIAS_CRYPTO("camellia-asm");
arch/x86/crypto/camellia_glue.c +1 -1
index 2cb9b24d9437..b8cad1655c66 100644
@@ -1427,6 +1427,6 @@ module_init(camellia_init);
 module_exit(camellia_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Camellia Cipher Algorithm, asm optimized");
+MODULE_DESCRIPTION("Camellia Cipher Algorithm -- accelerated for x86");
 MODULE_ALIAS_CRYPTO("camellia");
 MODULE_ALIAS_CRYPTO("camellia-asm");
arch/x86/crypto/cast5_avx_glue.c +1 -1
index 34ef032bb8d0..4a11d3ea9838 100644
@@ -133,6 +133,6 @@ static void __exit cast5_exit(void)
 module_init(cast5_init);
 module_exit(cast5_exit);
 
-MODULE_DESCRIPTION("Cast5 Cipher Algorithm, AVX optimized");
+MODULE_DESCRIPTION("Cast5 Cipher Algorithm -- accelerated for x86 with AVX");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("cast5");
arch/x86/crypto/cast6_avx_glue.c +1 -1
index 71559fd3ea87..53a92999a234 100644
@@ -133,6 +133,6 @@ static void __exit cast6_exit(void)
 module_init(cast6_init);
 module_exit(cast6_exit);
 
-MODULE_DESCRIPTION("Cast6 Cipher Algorithm, AVX optimized");
+MODULE_DESCRIPTION("Cast6 Cipher Algorithm -- accelerated for x86 with AVX");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("cast6");
arch/x86/crypto/chacha_glue.c +1 -1
index ec7461412c5e..563546d0bc2a 100644
@@ -320,7 +320,7 @@ module_exit(chacha_simd_mod_fini);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Martin Willi <[email protected]>");
-MODULE_DESCRIPTION("ChaCha and XChaCha stream ciphers (x64 SIMD accelerated)");
+MODULE_DESCRIPTION("ChaCha and XChaCha stream ciphers -- accelerated for x86 with SSSE3 (optional: AVX, AVX2, AVX-512VL and AVX-512BW)");
 MODULE_ALIAS_CRYPTO("chacha20");
 MODULE_ALIAS_CRYPTO("chacha20-simd");
 MODULE_ALIAS_CRYPTO("xchacha20");
arch/x86/crypto/crc32-pclmul_glue.c +1 -1
index d5e889c24bea..1c297fae5d39 100644
@@ -207,6 +207,6 @@ module_exit(crc32_pclmul_mod_fini);
 
 MODULE_AUTHOR("Alexander Boyko <[email protected]>");
 MODULE_LICENSE("GPL");
-
+MODULE_DESCRIPTION("CRC32 -- accelerated for x86 with PCLMULQDQ");
 MODULE_ALIAS_CRYPTO("crc32");
 MODULE_ALIAS_CRYPTO("crc32-pclmul");
arch/x86/crypto/crc32c-intel_glue.c +1 -1
index 3c2bf7032667..ba7899d04bb1 100644
@@ -275,7 +275,7 @@ module_init(crc32c_intel_mod_init);
 module_exit(crc32c_intel_mod_fini);
 
 MODULE_AUTHOR("Austin Zhang <[email protected]>, Kent Liu <[email protected]>");
-MODULE_DESCRIPTION("CRC32c (Castagnoli) optimization using Intel Hardware.");
+MODULE_DESCRIPTION("CRC32c (Castagnoli) -- accelerated for x86 with SSE4.2 (optional: PCLMULQDQ)");
 MODULE_LICENSE("GPL");
 
 MODULE_ALIAS_CRYPTO("crc32c");
arch/x86/crypto/crct10dif-pclmul_glue.c +1 -1
index a26dbd27da96..df9f81ee97a3 100644
@@ -162,7 +162,7 @@ module_init(crct10dif_intel_mod_init);
 module_exit(crct10dif_intel_mod_fini);
 
 MODULE_AUTHOR("Tim Chen <[email protected]>");
-MODULE_DESCRIPTION("T10 DIF CRC calculation accelerated with PCLMULQDQ.");
+MODULE_DESCRIPTION("T10 DIF CRC -- accelerated for x86 with PCLMULQDQ");
 MODULE_LICENSE("GPL");
 
 MODULE_ALIAS_CRYPTO("crct10dif");
arch/x86/crypto/curve25519-x86_64.c +1 -0
index 74672351e534..078508f53ff0 100644
@@ -1742,3 +1742,4 @@ MODULE_ALIAS_CRYPTO("curve25519");
 MODULE_ALIAS_CRYPTO("curve25519-x86");
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Jason A. Donenfeld <[email protected]>");
+MODULE_DESCRIPTION("Curve25519 algorithm -- accelerated for x86 with ADX (also requires BMI2)");
arch/x86/crypto/des3_ede_glue.c +1 -1
index a4cac5129148..fc90c0a076e3 100644
@@ -404,7 +404,7 @@ module_init(des3_ede_x86_init);
 module_exit(des3_ede_x86_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Triple DES EDE Cipher Algorithm, asm optimized");
+MODULE_DESCRIPTION("Triple DES EDE Cipher Algorithm -- accelerated for x86");
 MODULE_ALIAS_CRYPTO("des3_ede");
 MODULE_ALIAS_CRYPTO("des3_ede-asm");
 MODULE_AUTHOR("Jussi Kivilinna <[email protected]>");
arch/x86/crypto/ghash-clmulni-intel_glue.c +1 -1
index d19a8e9b34a6..30f4966df4de 100644
@@ -363,5 +363,5 @@ module_init(ghash_pclmulqdqni_mod_init);
 module_exit(ghash_pclmulqdqni_mod_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("GHASH hash function, accelerated by PCLMULQDQ-NI");
+MODULE_DESCRIPTION("GHASH hash function -- accelerated for x86 with PCLMULQDQ");
 MODULE_ALIAS_CRYPTO("ghash");
arch/x86/crypto/nhpoly1305-avx2-glue.c +1 -1
index 2e63947bc9fa..ed6209f027e7 100644
@@ -94,7 +94,7 @@ static void __exit nhpoly1305_mod_exit(void)
 module_init(nhpoly1305_mod_init);
 module_exit(nhpoly1305_mod_exit);
 
-MODULE_DESCRIPTION("NHPoly1305 ε-almost-∆-universal hash function (AVX2-accelerated)");
+MODULE_DESCRIPTION("NHPoly1305 ε-almost-∆-universal hash function -- accelerated for x86 with AVX2 (also required: OSXSAVE)");
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Eric Biggers <[email protected]>");
 MODULE_ALIAS_CRYPTO("nhpoly1305");
arch/x86/crypto/nhpoly1305-sse2-glue.c +1 -1
index c47765e46236..d09156e702dd 100644
@@ -83,7 +83,7 @@ static void __exit nhpoly1305_mod_exit(void)
 module_init(nhpoly1305_mod_init);
 module_exit(nhpoly1305_mod_exit);
 
-MODULE_DESCRIPTION("NHPoly1305 ε-almost-∆-universal hash function (SSE2-accelerated)");
+MODULE_DESCRIPTION("NHPoly1305 ε-almost-∆-universal hash function -- accelerated for x86 with SSE2");
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Eric Biggers <[email protected]>");
 MODULE_ALIAS_CRYPTO("nhpoly1305");
arch/x86/crypto/poly1305_glue.c +1 -1
index d3c0d5b335ea..78f88be4a22a 100644
@@ -313,6 +313,6 @@ module_exit(poly1305_simd_mod_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jason A. Donenfeld <[email protected]>");
-MODULE_DESCRIPTION("Poly1305 authenticator");
+MODULE_DESCRIPTION("Poly1305 authenticator -- accelerated for x86 (optional: AVX, AVX2, AVX-512F)");
 MODULE_ALIAS_CRYPTO("poly1305");
 MODULE_ALIAS_CRYPTO("poly1305-simd");
arch/x86/crypto/polyval-clmulni_glue.c +1 -1
index 20d4a68ec1d7..447f0f219759 100644
@@ -211,6 +211,6 @@ module_init(polyval_clmulni_mod_init);
 module_exit(polyval_clmulni_mod_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("POLYVAL hash function accelerated by PCLMULQDQ-NI");
+MODULE_DESCRIPTION("POLYVAL hash function - accelerated for x86 with PCLMULQDQ (also required: AVX)");
 MODULE_ALIAS_CRYPTO("polyval");
 MODULE_ALIAS_CRYPTO("polyval-clmulni");
arch/x86/crypto/serpent_avx2_glue.c +1 -1
index 2aa62c93a16f..0a57779a7559 100644
@@ -139,6 +139,6 @@ module_init(serpent_avx2_init);
 module_exit(serpent_avx2_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX2 optimized");
+MODULE_DESCRIPTION("Serpent Cipher Algorithm -- accelerated for x86 with AVX2 (also required: OSXSAVE)");
 MODULE_ALIAS_CRYPTO("serpent");
 MODULE_ALIAS_CRYPTO("serpent-asm");
arch/x86/crypto/serpent_avx_glue.c +1 -1
index 28ee9717df49..9d03fb25537f 100644
@@ -141,6 +141,6 @@ static void __exit serpent_exit(void)
 module_init(serpent_init);
 module_exit(serpent_exit);
 
-MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX optimized");
+MODULE_DESCRIPTION("Serpent Cipher Algorithm -- accelerated for x86 with AVX");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("serpent");
arch/x86/crypto/serpent_sse2_glue.c +1 -1
index 74f0c89f55ef..287b19527105 100644
@@ -131,6 +131,6 @@ static void __exit serpent_sse2_exit(void)
 module_init(serpent_sse2_init);
 module_exit(serpent_sse2_exit);
 
-MODULE_DESCRIPTION("Serpent Cipher Algorithm, SSE2 optimized");
+MODULE_DESCRIPTION("Serpent Cipher Algorithm -- accelerated for x86 with SSE2");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("serpent");
arch/x86/crypto/sha1_ssse3_glue.c +1 -1
index 405af5e14b67..113756544d4e 100644
@@ -433,7 +433,7 @@ module_init(sha1_ssse3_mod_init);
 module_exit(sha1_ssse3_mod_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, Supplemental SSE3 accelerated");
+MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm -- accelerated for x86 with SSSE3, AVX, AVX2, or SHA-NI");
 
 MODULE_ALIAS_CRYPTO("sha1");
 MODULE_ALIAS_CRYPTO("sha1-ssse3");
arch/x86/crypto/sha256_ssse3_glue.c +1 -1
index 293cf7085dd3..78fa25d2e4ba 100644
@@ -498,7 +498,7 @@ module_init(sha256_ssse3_mod_init);
 module_exit(sha256_ssse3_mod_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated");
+MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithms -- accelerated for x86 with SSSE3, AVX, AVX2, or SHA-NI");
 
 MODULE_ALIAS_CRYPTO("sha256");
 MODULE_ALIAS_CRYPTO("sha256-ssse3");
arch/x86/crypto/sha512_ssse3_glue.c +1 -1
index 9f13baf7dda9..2fa951069604 100644
@@ -396,7 +396,7 @@ module_init(sha512_ssse3_mod_init);
 module_exit(sha512_ssse3_mod_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, Supplemental SSE3 accelerated");
+MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithms -- accelerated for x86 with SSSE3, AVX, or AVX2");
 
 MODULE_ALIAS_CRYPTO("sha512");
 MODULE_ALIAS_CRYPTO("sha512-ssse3");
arch/x86/crypto/sm3_avx_glue.c +1 -1
index 169ba6a2c806..9e1177fbf032 100644
@@ -161,6 +161,6 @@ module_exit(sm3_avx_mod_exit);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Tianjia Zhang <[email protected]>");
-MODULE_DESCRIPTION("SM3 Secure Hash Algorithm, AVX assembler accelerated");
+MODULE_DESCRIPTION("SM3 Secure Hash Algorithm -- accelerated for x86 with AVX (also required: BMI2)");
 MODULE_ALIAS_CRYPTO("sm3");
 MODULE_ALIAS_CRYPTO("sm3-avx");
arch/x86/crypto/sm4_aesni_avx2_glue.c +1 -1
index 6bcf78231888..b497a6006c8d 100644
@@ -177,6 +177,6 @@ module_exit(sm4_exit);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Tianjia Zhang <[email protected]>");
-MODULE_DESCRIPTION("SM4 Cipher Algorithm, AES-NI/AVX2 optimized");
+MODULE_DESCRIPTION("SM4 Cipher Algorithm -- accelerated for x86 with AVX2 (also required: AES-NI, AVX, OSXSAVE)");
 MODULE_ALIAS_CRYPTO("sm4");
 MODULE_ALIAS_CRYPTO("sm4-aesni-avx2");
arch/x86/crypto/sm4_aesni_avx_glue.c +1 -1
index 03775b1079dc..e583ee0948af 100644
@@ -495,6 +495,6 @@ module_exit(sm4_exit);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Tianjia Zhang <[email protected]>");
-MODULE_DESCRIPTION("SM4 Cipher Algorithm, AES-NI/AVX optimized");
+MODULE_DESCRIPTION("SM4 Cipher Algorithm -- accelerated for x86 with AVX (also required: AES-NI, OSXSAVE)");
 MODULE_ALIAS_CRYPTO("sm4");
 MODULE_ALIAS_CRYPTO("sm4-aesni-avx");
arch/x86/crypto/twofish_avx_glue.c +1 -1
index ae3cc4ad6f4f..7b405c66d5fa 100644
@@ -143,6 +143,6 @@ static void __exit twofish_exit(void)
 module_init(twofish_init);
 module_exit(twofish_exit);
 
-MODULE_DESCRIPTION("Twofish Cipher Algorithm, AVX optimized");
+MODULE_DESCRIPTION("Twofish Cipher Algorithm -- accelerated for x86 with AVX");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("twofish");
arch/x86/crypto/twofish_glue.c +1 -1
index ade98aef3402..10729675e79c 100644
@@ -105,6 +105,6 @@ module_init(twofish_glue_init);
 module_exit(twofish_glue_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION ("Twofish Cipher Algorithm, asm optimized");
+MODULE_DESCRIPTION("Twofish Cipher Algorithm -- accelerated for x86");
 MODULE_ALIAS_CRYPTO("twofish");
 MODULE_ALIAS_CRYPTO("twofish-asm");
arch/x86/crypto/twofish_glue_3way.c +1 -1
index 8db2f23b3056..43f428b59684 100644
@@ -177,6 +177,6 @@ module_init(twofish_3way_init);
 module_exit(twofish_3way_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Twofish Cipher Algorithm, 3-way parallel asm optimized");
+MODULE_DESCRIPTION("Twofish Cipher Algorithm -- accelerated for x86 (3-way parallel)");
 MODULE_ALIAS_CRYPTO("twofish");
 MODULE_ALIAS_CRYPTO("twofish-asm");
crypto/aes_ti.c +1 -1
index 205c2c257d49..3cff553495ad 100644
@@ -78,6 +78,6 @@ static void __exit aes_fini(void)
 module_init(aes_init);
 module_exit(aes_fini);
 
-MODULE_DESCRIPTION("Generic fixed time AES");
+MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm -- generic fixed time");
 MODULE_AUTHOR("Ard Biesheuvel <[email protected]>");
 MODULE_LICENSE("GPL v2");
crypto/blake2b_generic.c +1 -1
index 6704c0355889..ee53f25ff254 100644
@@ -175,7 +175,7 @@ subsys_initcall(blake2b_mod_init);
 module_exit(blake2b_mod_fini);
 
 MODULE_AUTHOR("David Sterba <[email protected]>");
-MODULE_DESCRIPTION("BLAKE2b generic implementation");
+MODULE_DESCRIPTION("BLAKE2b hash algorithm");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("blake2b-160");
 MODULE_ALIAS_CRYPTO("blake2b-160-generic");
crypto/blowfish_common.c +1 -1
index 1c072012baff..8c75fdfcd09c 100644
@@ -394,4 +394,4 @@ int blowfish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
 EXPORT_SYMBOL_GPL(blowfish_setkey);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Blowfish Cipher common functions");
+MODULE_DESCRIPTION("Blowfish Cipher Algorithm common functions");
crypto/crct10dif_generic.c +1 -1
index e843982073bb..81c131c8ccd0 100644
@@ -116,7 +116,7 @@ subsys_initcall(crct10dif_mod_init);
 module_exit(crct10dif_mod_fini);
 
 MODULE_AUTHOR("Tim Chen <[email protected]>");
-MODULE_DESCRIPTION("T10 DIF CRC calculation.");
+MODULE_DESCRIPTION("T10 DIF CRC calculation");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("crct10dif");
 MODULE_ALIAS_CRYPTO("crct10dif-generic");
crypto/curve25519-generic.c +1 -0
index d055b0784c77..4f96583b31dd 100644
@@ -88,3 +88,4 @@ module_exit(curve25519_exit);
 MODULE_ALIAS_CRYPTO("curve25519");
 MODULE_ALIAS_CRYPTO("curve25519-generic");
 MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Curve25519 algorithm");
crypto/sha256_generic.c +1 -1
index bf147b01e313..141430c25e15 100644
@@ -102,7 +102,7 @@ subsys_initcall(sha256_generic_mod_init);
 module_exit(sha256_generic_mod_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm");
+MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithms");
 
 MODULE_ALIAS_CRYPTO("sha224");
 MODULE_ALIAS_CRYPTO("sha224-generic");
crypto/sha512_generic.c +1 -1
index be70e76d6d86..63c5616ec770 100644
@@ -219,7 +219,7 @@ subsys_initcall(sha512_generic_mod_init);
 module_exit(sha512_generic_mod_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SHA-512 and SHA-384 Secure Hash Algorithms");
+MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithms");
 
 MODULE_ALIAS_CRYPTO("sha384");
 MODULE_ALIAS_CRYPTO("sha384-generic");
crypto/sm3.c +1 -1
index d473e358a873..2a400eb69e66 100644
@@ -242,5 +242,5 @@ void sm3_final(struct sm3_state *sctx, u8 *out)
 }
 EXPORT_SYMBOL_GPL(sm3_final);
 
-MODULE_DESCRIPTION("Generic SM3 library");
+MODULE_DESCRIPTION("SM3 Secure Hash Algorithm generic library");
 MODULE_LICENSE("GPL v2");
crypto/sm4.c +1 -1
index 2c44193bc27e..d46b598b41cd 100644
@@ -180,5 +180,5 @@ void sm4_crypt_block(const u32 *rk, u8 *out, const u8 *in)
 }
 EXPORT_SYMBOL_GPL(sm4_crypt_block);
 
-MODULE_DESCRIPTION("Generic SM4 library");
+MODULE_DESCRIPTION("SM4 Cipher Algorithm generic library");
 MODULE_LICENSE("GPL v2");
crypto/twofish_common.c +1 -1
index f921f30334f4..daa28045069d 100644
@@ -690,4 +690,4 @@ int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len)
 EXPORT_SYMBOL_GPL(twofish_setkey);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Twofish cipher common functions");
+MODULE_DESCRIPTION("Twofish Cipher Algorithm common functions");
crypto/twofish_generic.c +1 -1
index 86b2f067a416..4fe42b4ac82d 100644
@@ -191,6 +191,6 @@ subsys_initcall(twofish_mod_init);
 module_exit(twofish_mod_fini);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION ("Twofish Cipher Algorithm");
+MODULE_DESCRIPTION("Twofish Cipher Algorithm");
 MODULE_ALIAS_CRYPTO("twofish");
 MODULE_ALIAS_CRYPTO("twofish-generic");
Signature · 1 line
2.38.1
maintainer
#123 lore raw

Re: [PATCH v4 00/24] crypto: fix RCU stalls

In reply to Robert Elliott
Quoted 10 lines · Robert Elliott

This series fixes the RCU stalls triggered by the x86 crypto modules discussed in
https://lore.kernel.org/all/MW5PR84MB18426EBBA3303770A8BC0BDFAB759@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM/

Two root causes were:
- too much data processed between kernel_fpu_begin and kernel_fpu_end calls (which are heavily used by the x86 optimized drivers)
- tcrypt not calling cond_resched during speed test loops

Quoted 3 lines

These problems have always been lurking, but improving the loading of the x86/sha512 module led to it happening a lot during boot when using SHA-512 for module signature checking.

Can we split this series up please? The fixes to the stalls should stand separately from the changes to how modules are loaded. The latter is more of an improvement while the former should be applied ASAP.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#124 lore raw

RE: [PATCH v4 00/24] crypto: fix RCU stalls

Quoted 8 lines

-----Original Message-----
From: Herbert Xu <[email protected]>
Sent: Wednesday, November 16, 2022 9:59 PM
Subject: Re: [PATCH v4 00/24] crypto: fix RCU stalls

On Tue, Nov 15, 2022 at 10:13:18PM -0600, Robert Elliott wrote:

...

Quoted 8 lines
Quoted 3 lines

These problems have always been lurking, but improving the loading of the x86/sha512 module led to it happening a lot during boot when using SHA-512 for module signature checking.

Can we split this series up please? The fixes to the stalls should stand separately from the changes to how modules are loaded. The latter is more of an improvement while the former should be applied ASAP.

Yes. With the v4 patch numbers:
[PATCH v4 01/24] crypto: tcrypt - test crc32
[PATCH v4 02/24] crypto: tcrypt - test nhpoly1305

Those ensure the changes to those hash modules are testable.

[PATCH v4 03/24] crypto: tcrypt - reschedule during cycles speed

That's only for tcrypt so not urgent for users, but pretty simple.

[PATCH v4 04/24] crypto: x86/sha - limit FPU preemption [PATCH v4 05/24] crypto: x86/crc - limit FPU preemption [PATCH v4 06/24] crypto: x86/sm3 - limit FPU preemption [PATCH v4 07/24] crypto: x86/ghash - use u8 rather than char [PATCH v4 08/24] crypto: x86/ghash - restructure FPU context saving [PATCH v4 09/24] crypto: x86/ghash - limit FPU preemption [PATCH v4 10/24] crypto: x86/poly - limit FPU preemption [PATCH v4 11/24] crypto: x86/aegis - limit FPU preemption [PATCH v4 12/24] crypto: x86/sha - register all variations [PATCH v4 13/24] crypto: x86/sha - minimize time in FPU context

That's the end of the fixes set.

[PATCH v4 14/24] crypto: x86/sha - load based on CPU features [PATCH v4 15/24] crypto: x86/crc - load based on CPU features [PATCH v4 16/24] crypto: x86/sm3 - load based on CPU features [PATCH v4 17/24] crypto: x86/poly - load based on CPU features [PATCH v4 18/24] crypto: x86/ghash - load based on CPU features [PATCH v4 19/24] crypto: x86/aesni - avoid type conversions [PATCH v4 20/24] crypto: x86/ciphers - load based on CPU features [PATCH v4 21/24] crypto: x86 - report used CPU features via module [PATCH v4 22/24] crypto: x86 - report missing CPU features via module [PATCH v4 23/24] crypto: x86 - report suboptimal CPUs via module [PATCH v4 24/24] crypto: x86 - standardize module descriptions

I'll put those in a new series.

For 6.1, I still suggest reverting aa031b8f702e ("crypto: x86/sha512 - load based on CPU features) since that exposed the problem. Target the fixes for 6.2 and module loading for 6.2 or 6.3.

#125 lore raw

Re: [PATCH v4 00/24] crypto: fix RCU stalls

Quoted 52 lines · Robert (Servers)
Quoted 6 lines

-----Original Message-----
From: Herbert Xu <[email protected]>
Sent: Wednesday, November 16, 2022 9:59 PM
Subject: Re: [PATCH v4 00/24] crypto: fix RCU stalls

On Tue, Nov 15, 2022 at 10:13:18PM -0600, Robert Elliott wrote:

...

Quoted 8 lines
Quoted 3 lines

These problems have always been lurking, but improving the loading of the x86/sha512 module led to it happening a lot during boot when using SHA-512 for module signature checking.

Can we split this series up please? The fixes to the stalls should stand separately from the changes to how modules are loaded. The latter is more of an improvement while the former should be applied ASAP.

Yes. With the v4 patch numbers:
[PATCH v4 01/24] crypto: tcrypt - test crc32
[PATCH v4 02/24] crypto: tcrypt - test nhpoly1305

Those ensure the changes to those hash modules are testable.

[PATCH v4 03/24] crypto: tcrypt - reschedule during cycles speed

That's only for tcrypt so not urgent for users, but pretty simple.

[PATCH v4 04/24] crypto: x86/sha - limit FPU preemption [PATCH v4 05/24] crypto: x86/crc - limit FPU preemption [PATCH v4 06/24] crypto: x86/sm3 - limit FPU preemption [PATCH v4 07/24] crypto: x86/ghash - use u8 rather than char [PATCH v4 08/24] crypto: x86/ghash - restructure FPU context saving [PATCH v4 09/24] crypto: x86/ghash - limit FPU preemption [PATCH v4 10/24] crypto: x86/poly - limit FPU preemption [PATCH v4 11/24] crypto: x86/aegis - limit FPU preemption [PATCH v4 12/24] crypto: x86/sha - register all variations [PATCH v4 13/24] crypto: x86/sha - minimize time in FPU context

That's the end of the fixes set.

[PATCH v4 14/24] crypto: x86/sha - load based on CPU features [PATCH v4 15/24] crypto: x86/crc - load based on CPU features [PATCH v4 16/24] crypto: x86/sm3 - load based on CPU features [PATCH v4 17/24] crypto: x86/poly - load based on CPU features [PATCH v4 18/24] crypto: x86/ghash - load based on CPU features [PATCH v4 19/24] crypto: x86/aesni - avoid type conversions [PATCH v4 20/24] crypto: x86/ciphers - load based on CPU features [PATCH v4 21/24] crypto: x86 - report used CPU features via module [PATCH v4 22/24] crypto: x86 - report missing CPU features via module [PATCH v4 23/24] crypto: x86 - report suboptimal CPUs via module [PATCH v4 24/24] crypto: x86 - standardize module descriptions

Quoted 1 line

I'll put those in a new series.

Thanks. Please take into account my review feedback this time for your next series.

Jason