diff mbox series

pcrypt_aead01: break early when approaching timeout

Message ID 031b8dbecf1c08d3b00f876943b744274e6a5785.1571146155.git.jstancek@redhat.com
State Accepted, archived
Headers show
Series pcrypt_aead01: break early when approaching timeout | expand

Commit Message

Jan Stancek Oct. 15, 2019, 1:30 p.m. UTC
PowerNV (P9 witherspoon, 176CPUs) systems running latest upstream
kernel (5.3.6) have been observed to come very close to test timeout
and also sporadically fail, because they couldn't complete 10000
iterations in time.

Each iteration of test leads to modprobe of cryptomgr and crypto
framework running number of tests, taking up to ~70ms per iteration.

Looking at traces, a significant contributor is wakeup time. After
one crypto test is done, it takes ~0.5ms for other tests to resume:
  (gettimeofday_us)
  1571141551769329      7 kworker/1:1(897):<-crypto_req_done
  1571141551769843   1603 cryptomgr_test(3813):

Booting with powersave=off cuts this latency significantly, single
iteration of test completes in ~10ms.

But changing kernel defaults isn't very practical solution, hence patch
is watching for timeout approaching and breaks the loop early.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/crypto/pcrypt_aead01.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Cyril Hrubis Oct. 15, 2019, 3:01 p.m. UTC | #1
Hi!
Acked.
Jan Stancek Oct. 18, 2019, 7:18 a.m. UTC | #2
----- Original Message -----
> Hi!
> Acked.
> 

Pushed.
diff mbox series

Patch

diff --git a/testcases/kernel/crypto/pcrypt_aead01.c b/testcases/kernel/crypto/pcrypt_aead01.c
index d9c27f69dce7..3dc8c58c2817 100644
--- a/testcases/kernel/crypto/pcrypt_aead01.c
+++ b/testcases/kernel/crypto/pcrypt_aead01.c
@@ -54,6 +54,12 @@  void run(void)
 		TEST(tst_crypto_del_alg(&ses, &a));
 		if (TST_RET)
 			tst_brk(TBROK | TRERRNO, "del_alg");
+
+		if (tst_timeout_remaining() < 10) {
+			tst_res(TINFO, "Time limit reached, stopping at "
+				"%d iterations", i);
+			break;
+		}
 	}
 
 	tst_res(TPASS, "Nothing bad appears to have happened");