From f6a123bfe1ac24b4af64e48b214fe8bc8babe50a Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <>
Date: Tue, 28 Sep 2021 13:54:01 +0200
Subject: [PATCH 026/166] crypto: testmgr - Only disable migration in

crypto_disable_simd_for_test() disables preemption in order to receive a
stable per-CPU variable which it needs to modify in order to alter
crypto_simd_usable() results.

This can also be achived by migrate_disable() which forbidds CPU
migrations but allows the task to be preempted. The latter is important
for PREEMPT_RT since operation like skcipher_walk_first() may allocate
memory which must not happen with disabled preemption on PREEMPT_RT.

Use migrate_disable() in crypto_disable_simd_for_test() to achieve a
stable per-CPU pointer.

Signed-off-by: Sebastian Andrzej Siewior <>
 crypto/testmgr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-5.15.13-rt26/crypto/testmgr.c
@ linux-5.15.13-rt26/crypto/testmgr.c:1064 @ static void generate_random_testvec_conf
 static void crypto_disable_simd_for_test(void)
-	preempt_disable();
+	migrate_disable();
 	__this_cpu_write(crypto_simd_disabled_for_test, true);
 static void crypto_reenable_simd_for_test(void)
 	__this_cpu_write(crypto_simd_disabled_for_test, false);
-	preempt_enable();
+	migrate_enable();