Thread (3 messages) flat view 3 messages, 2 authors, 2012-10-25
STALE5070d

[PATCH] crypto - ablk_helper: add module parameter to allow testing cryptd redirection of requests

From: Jussi Kivilinna <hidden>
Date: 2012-10-21 17:45:31
Subsystem: the rest, x86 architecture (32-bit and 64-bit) · Maintainers: Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen

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 <redacted>
---
 arch/x86/crypto/ablk_helper.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/crypto/ablk_helper.c b/arch/x86/crypto/ablk_helper.c
index 43282fe..52385a3 100644
--- a/arch/x86/crypto/ablk_helper.c
+++ b/arch/x86/crypto/ablk_helper.c
@@ -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");
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help