[LTP] [PATCH] pcrypt_aead01: break early when approaching timeout

Jan Stancek jstancek@redhat.com
Tue Oct 15 15:30:36 CEST 2019

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:
  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(+)

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");

More information about the ltp mailing list