]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00291086 crypto kernel module speed test in single fail
authorJay Monkman <jay.monkman@freescale.com>
Fri, 17 Jan 2014 19:06:46 +0000 (13:06 -0600)
committerJason Liu <r64343@freescale.com>
Sun, 19 Jan 2014 06:53:56 +0000 (14:53 +0800)
The tcrypt module is used to test the crypto API by being passed a
mode=<value> during module load. The test runs to completion before
insmod/modprobe returns. That makes the RCU stall detection in newer
kernels unhappy.

The simple fix is to add CONFIG_PREEMPT to the kernel config. That's
what this patch does. If that introduces other problems,
crypto/tcrypt.c can be modified to call schedule() in the correct
places. Here's a patch that should work if this one has to be
reverted:

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 66d254c..b771f7d 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -33,6 +33,7 @@
 #include <linux/jiffies.h>
 #include <linux/timex.h>
 #include <linux/interrupt.h>
+#include <linux/sched.h>
 #include "tcrypt.h"
 #include "internal.h"

@@ -182,6 +183,7 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int sec,
                                goto out;
                        }

+                        schedule();
                        printk("test %u (%d bit key, %d byte blocks): ", i,
                                        *keysize * 8, *b_size);

@@ -448,6 +450,7 @@ static void test_hash_speed(const char *algo, unsigned int sec,
                if (speed[i].klen)
                        crypto_hash_setkey(tfm, tvmem[0], speed[i].klen);

+                schedule();
                printk(KERN_INFO "test%3u "
                       "(%5u byte blocks,%5u bytes per update,%4u updates): ",
                       i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
@@ -688,12 +691,12 @@ static void test_ahash_speed(const char *algo, unsigned int sec,
                        break;
                }

+                schedule();
                pr_info("test%3u "
                        "(%5u byte blocks,%5u bytes per update,%4u updates): ",
                        i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);

                ahash_request_set_crypt(req, sg, output, speed[i].plen);
-
                if (sec)
                        ret = test_ahash_jiffies(req, speed[i].blen,
                                                 speed[i].plen, output, sec);
@@ -853,6 +856,7 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
                                goto out_free_req;
                        }

+                        schedule();
                        pr_info("test %u (%d bit key, %d byte blocks): ", i,
                                *keysize * 8, *b_size);

@@ -934,6 +938,7 @@ static void test_available(void)
                printk("alg %s ", *name);
                printk(crypto_has_alg(*name, 0, 0) ?
                       "found\n" : "not found\n");
+                schedule();
                name++;
        }
 }

Signed-off-by: Jay Monkman <jay.monkman@freescale.com>
(cherry picked from commit 2dc1e6a900df2b575914a7c58fc08e4b072c0e67)

arch/arm/configs/imx_v7_defconfig

index 8961330d2472279c1b000a65a2ac5fa78ce90f2c..028d7c382c70cb706e9b74dc3bb7af409203c22b 100644 (file)
@@ -29,7 +29,7 @@ CONFIG_SOC_VF610=y
 # CONFIG_SWP_EMULATE is not set
 CONFIG_SMP=y
 CONFIG_VMSPLIT_2G=y
-CONFIG_PREEMPT_VOLUNTARY=y
+CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
@@ -320,12 +320,30 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_FTRACE is not set
 CONFIG_SECURITYFS=y
 CONFIG_CRYPTO_USER=y
+CONFIG_CRYPTO_TEST=y
 CONFIG_CRYPTO_CCM=y
 CONFIG_CRYPTO_GCM=y
 CONFIG_CRYPTO_CBC=y
 CONFIG_CRYPTO_CTS=y
 CONFIG_CRYPTO_ECB=y
 CONFIG_CRYPTO_LRW=y
+CONFIG_CRYPTO_XTS=y
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MICHAEL_MIC=y
+CONFIG_CRYPTO_RMD128=y
+CONFIG_CRYPTO_RMD160=y
+CONFIG_CRYPTO_RMD256=y
+CONFIG_CRYPTO_RMD320=y
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+CONFIG_CRYPTO_SHA512=y
+CONFIG_CRYPTO_TGR192=y
+CONFIG_CRYPTO_WP512=y
+CONFIG_CRYPTO_BLOWFISH=y
+CONFIG_CRYPTO_CAMELLIA=y
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_TWOFISH=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_DEV_FSL_CAAM=y
 CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y