Re: [Patch V5 7/7] crypto: AES CBC multi-buffer tcrypt

2017-04-20 Thread kbuild test robot
Hi Megha,

[auto build test WARNING on next-20170420]
[also build test WARNING on v4.11-rc7]
[cannot apply to crypto/master sparc-next/master v4.9-rc8 v4.9-rc7 v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Megha-Dey/crypto-AES-CBC-multibuffer-implementation/20170421-064210
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=parisc 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:13,
from include/linux/crypto.h:21,
from include/crypto/aead.h:16,
from crypto/tcrypt.c:27:
   crypto/tcrypt.c: In function 'test_mb_acipher_cycles':
>> include/linux/kern_levels.h:4:18: warning: format '%llu' expects argument of 
>> type 'long long unsigned int', but argument 2 has type 'long unsigned int' 
>> [-Wformat=]
#define KERN_SOH "\001"  /* ASCII Start Of Header */
 ^
   include/linux/kern_levels.h:23:19: note: in expansion of macro 'KERN_SOH'
#define KERN_CONT KERN_SOH "c"
  ^~~~
>> include/linux/printk.h:315:9: note: in expansion of macro 'KERN_CONT'
 printk(KERN_CONT fmt, ##__VA_ARGS__)
^
>> crypto/tcrypt.c:1082:3: note: in expansion of macro 'pr_cont'
  pr_cont("1 operation in %llu cycles (%d bytes)\n",
  ^~~

vim +/KERN_CONT +315 include/linux/printk.h

a0cba217 Linus Torvalds 2016-08-09  299 printk(KERN_CRIT pr_fmt(fmt), 
##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  300  #define pr_err(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  301 printk(KERN_ERR pr_fmt(fmt), 
##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  302  #define pr_warning(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  303 printk(KERN_WARNING 
pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  304  #define pr_warn pr_warning
a0cba217 Linus Torvalds 2016-08-09  305  #define pr_notice(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  306 printk(KERN_NOTICE pr_fmt(fmt), 
##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  307  #define pr_info(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  308 printk(KERN_INFO pr_fmt(fmt), 
##__VA_ARGS__)
7b1460ec Steven Rostedt 2015-04-15  309  /*
7b1460ec Steven Rostedt 2015-04-15  310   * Like KERN_CONT, pr_cont() should 
only be used when continuing
7b1460ec Steven Rostedt 2015-04-15  311   * a line with no newline ('\n') 
enclosed. Otherwise it defaults
7b1460ec Steven Rostedt 2015-04-15  312   * back to KERN_DEFAULT.
7b1460ec Steven Rostedt 2015-04-15  313   */
968ab183 Linus Torvalds 2010-11-15  314  #define pr_cont(fmt, ...) \
968ab183 Linus Torvalds 2010-11-15 @315 printk(KERN_CONT fmt, 
##__VA_ARGS__)
968ab183 Linus Torvalds 2010-11-15  316  
968ab183 Linus Torvalds 2010-11-15  317  /* pr_devel() should produce zero code 
unless DEBUG is defined */
968ab183 Linus Torvalds 2010-11-15  318  #ifdef DEBUG
968ab183 Linus Torvalds 2010-11-15  319  #define pr_devel(fmt, ...) \
968ab183 Linus Torvalds 2010-11-15  320 printk(KERN_DEBUG pr_fmt(fmt), 
##__VA_ARGS__)
968ab183 Linus Torvalds 2010-11-15  321  #else
968ab183 Linus Torvalds 2010-11-15  322  #define pr_devel(fmt, ...) \
5264f2f7 Joe Perches2011-01-12  323 no_printk(KERN_DEBUG 
pr_fmt(fmt), ##__VA_ARGS__)

:: The code at line 315 was first introduced by commit
:: 968ab1838a5d48f02f5b471aa1d0e59e2cc2ccbc include/linux/kernel.h: Move 
logging bits to include/linux/printk.h

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [Patch V5 7/7] crypto: AES CBC multi-buffer tcrypt

2017-04-20 Thread kbuild test robot
Hi Megha,

[auto build test WARNING on next-20170420]
[also build test WARNING on v4.11-rc7]
[cannot apply to crypto/master sparc-next/master v4.9-rc8 v4.9-rc7 v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Megha-Dey/crypto-AES-CBC-multibuffer-implementation/20170421-064210
config: m68k-sun3_defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   crypto/tcrypt.c: In function 'test_mb_acipher_cycles':
>> crypto/tcrypt.c:1082:3: warning: format '%llu' expects argument of type 
>> 'long long unsigned int', but argument 2 has type 'long unsigned int' 
>> [-Wformat=]
  pr_cont("1 operation in %llu cycles (%d bytes)\n",
  ^

vim +1082 crypto/tcrypt.c

  1066   * Initiate a maximum of MB_WIDTH operations per loop
  1067   * Measure performance over MB_WIDTH iterations
  1068   * Let do_multi_acipher_op count the cycles
  1069   */
  1070  for (i = 0; i < ITR; i++) {
  1071  mb_start = get_cycles();
  1072  ret = do_multi_acipher_op(req, enc);
  1073  
  1074  mb_end = get_cycles();
  1075  cycles += mb_end - mb_start;
  1076  if (ret)
  1077  goto out;
  1078  }
  1079  
  1080  out:
  1081  if (ret == 0)
> 1082  pr_cont("1 operation in %llu cycles (%d bytes)\n",
  1083  (cycles + 4) / (ITR*MB_WIDTH), blen);
  1084  
  1085  return ret;
  1086  }
  1087  
  1088  static void test_mb_acipher_speed(const char *algo, int enc, unsigned 
int secs,
  1089  struct cipher_speed_template *template,
  1090  unsigned int tcount, u8 *keysize)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[Patch V5 7/7] crypto: AES CBC multi-buffer tcrypt

2017-04-20 Thread Megha Dey
The tcrypt test framework for CBC multi-buffer testing is
laid out in this patch. Tcrypt has been extended to validate
the functionality and performance of AES CBC multi-buffer support.

A new test(mode=600) has been added to test the speed of the multibuffer
case, as multi-buffer encrypt will wait for additional encrypt requests
that never arrive to kick off computation. So we always incur the extra
delay before flush timer expires to trigger the computation in the
(mode=500)
test. We create the new tests that will send out these additional
requests
that can be aggregated and computed in parallel for true throughput
speed test
of the multi-buffer encrypt test case.case.

The enhanced CBC tests create multiple transforms and exercise
the multi-buffer implementation. Crafted requests are sent at once
to the multiple transforms created and the returned responses
are compared with expected results. The test vectors are so chosen
as to exercise the scatter-gather list to the maximum allowable limit
within the framework.

Originally-by: Chandramouli Narayanan 
Signed-off-by: Megha Dey 
Acked-by: Tim Chen 
---
 crypto/tcrypt.c  | 257 +++-
 crypto/testmgr.c | 707 +++
 crypto/testmgr.h |  64 -
 3 files changed, 1015 insertions(+), 13 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 9a11f3c..1d4416a 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "tcrypt.h"
 
 /*
@@ -84,7 +85,7 @@ struct tcrypt_result {
int err;
 };
 
-static void tcrypt_complete(struct crypto_async_request *req, int err)
+void tcrypt_complete(struct crypto_async_request *req, int err)
 {
struct tcrypt_result *res = req->data;
 
@@ -183,6 +184,11 @@ static int test_aead_cycles(struct aead_request *req, int 
enc, int blen)
 
 #define XBUFSIZE 8
 #define MAX_IVLEN 32
+#define MB_WIDTH 8
+struct scatterlist mb_sg[MB_WIDTH][XBUFSIZE];
+struct skcipher_request *mb_req[MB_WIDTH];
+struct tcrypt_result mb_tresult[MB_WIDTH];
+char *mb_xbuf[MB_WIDTH][XBUFSIZE];
 
 static int testmgr_alloc_buf(char *buf[XBUFSIZE])
 {
@@ -780,6 +786,46 @@ static inline int do_one_acipher_op(struct 
skcipher_request *req, int ret)
return ret;
 }
 
+
+/*
+ * Perform a maximum of MB_WIDTH operations.
+ * Await the results and measure performance.
+ */
+cycles_t mb_start, mb_end;
+static int mb_err[MB_WIDTH];
+
+static inline int do_multi_acipher_op(
+   struct skcipher_request *req[MB_WIDTH], int enc)
+{
+   int i, ret, comp_ret = 0;
+   bool is_async;
+
+   for (i = 0; i < MB_WIDTH; ++i) {
+   ret = enc == ENCRYPT ? crypto_skcipher_encrypt(req[i])
+   : crypto_skcipher_decrypt(req[i]);
+   mb_err[i] = ret;
+   if (ret == -EINPROGRESS || ret == -EBUSY)
+   continue; /* on with next req */
+   /* any other error, bail out */
+   if (ret)
+   return ret;
+   }
+   for (i = 0; i < MB_WIDTH; ++i) {
+   struct tcrypt_result *tr = req[i]->base.data;
+
+   is_async = mb_err[i] == -EINPROGRESS || mb_err[i] == -EBUSY;
+   if (is_async) {
+   wait_for_completion(>completion);
+   reinit_completion(>completion);
+   }
+   comp_ret = tr->err;
+   if (comp_ret)
+   pr_info("multi_acipher_op error\n");
+   }
+
+   return comp_ret;
+}
+
 static int test_acipher_jiffies(struct skcipher_request *req, int enc,
int blen, int secs)
 {
@@ -927,6 +973,7 @@ static void test_skcipher_speed(const char *algo, int enc, 
unsigned int secs,
if (ret) {
pr_err("setkey() failed flags=%x\n",
crypto_skcipher_get_flags(tfm));
+
goto out_free_req;
}
 
@@ -980,6 +1027,203 @@ static void test_skcipher_speed(const char *algo, int 
enc, unsigned int secs,
crypto_free_skcipher(tfm);
 }
 
+static int test_mb_acipher_jiffies(
+   struct skcipher_request *req[MB_WIDTH], int enc, int blen, int secs)
+{
+   unsigned long start, end;
+   int bcount;
+   int ret;
+
+   /* initiate a maximum of MB_WIDTH operations and measure performance */
+   for (start = jiffies, end = start + secs * HZ, bcount = 0;
+   time_before(jiffies, end); bcount += MB_WIDTH) {
+   ret = do_multi_acipher_op(req, enc);
+   if (ret)
+   return ret;
+   }
+
+   pr_cont("%d operations in %d seconds (%ld bytes)\n",
+   bcount, secs, (long)bcount * blen);
+   return 0;
+}
+
+#define ITR 8
+static int