crypto - ablk_helper: add module parameter to allow testing cryptd redirection of requests
Subsystems (2)
PATCH 1/1 crypto - ablk_helper: add module parameter to allow testing cryptd redirection of requests
Add module parameter to allow forcing redirection of crypto requests to cryptd worker threads. This allows these code paths to be actually tested (easier).
--- arch/x86/crypto/ablk_helper.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/x86/crypto/ablk_helper.c +7 -2
@@ -33,6 +33,8 @@#include <asm/i387.h> #include <asm/crypto/ablk_helper.h> +static int force_cryptd_redirect; +int ablk_set_key (struct crypto_ablkcipher *tfm,const u8 *key,unsigned int key_len) {
@@ -70,7 +72,7 @@ int ablk_encrypt(struct ablkcipher_request *req)struct crypto_ablkcipher *tfm =crypto_ablkcipher_reqtfm (req);struct async_helper_ctx *ctx =crypto_ablkcipher_ctx (tfm); -if (!irq_fpu_usable ()) { +if (force_cryptd_redirect || !irq_fpu_usable ()) {struct ablkcipher_request *cryptd_req =ablkcipher_request_ctx (req);
@@ -89,7 +91,7 @@ int ablk_decrypt(struct ablkcipher_request *req)struct crypto_ablkcipher *tfm =crypto_ablkcipher_reqtfm (req);struct async_helper_ctx *ctx =crypto_ablkcipher_ctx (tfm); -if (!irq_fpu_usable ()) { +if (force_cryptd_redirect || !irq_fpu_usable ()) {struct ablkcipher_request *cryptd_req =ablkcipher_request_ctx (req);
@@ -146,4 +148,7 @@ int ablk_init(struct crypto_tfm *tfm) }EXPORT_SYMBOL_GPL (ablk_init); +module_param (force_cryptd_redirect, int,0 ); +MODULE_PARM_DESC (force_cryptd_redirect, +"Force all crypto request to cryptd worker instead of using current context (Use only for testing purposes!)" );MODULE_LICENSE ("GPL" );
Herbert Xu
maintainerQuoted 5 lines · Jussi Kivilinna
Add module parameter to allow forcing redirection of crypto requests to cryptd worker threads. This allows these code paths to be actually tested (easier).
Signed-off-by Jussi Kivilinna <[email protected]>
Wouldn't this be applicable in other spots too? Perhaps we need something that just makes irq_fpu_usable return false?
Cheers,
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
Quoting Herbert Xu <[email protected]>:
Quoted 9 lines · Jussi Kivilinna
Quoted 5 lines
Add module parameter to allow forcing redirection of crypto requests to cryptd worker threads. This allows these code paths to be actually tested (easier).
Signed-off-by Jussi Kivilinna <[email protected]>Wouldn't this be applicable in other spots too? Perhaps we need something that just makes
irq_fpu_usablereturn false?
That would make sense. Maybe some sort of debug config option which gives kernel that forces irq_fpu_usable to false?
-Jussi