All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: testmgr - Only disable migration in crypto_disable_simd_for_test()
@ 2021-09-28 11:54 Sebastian Andrzej Siewior
  2021-10-05 18:17 ` Eric Biggers
  2021-10-08 12:24 ` Herbert Xu
  0 siblings, 2 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-09-28 11:54 UTC (permalink / raw)
  To: linux-crypto
  Cc: Herbert Xu, David S. Miller, Thomas Gleixner, Sebastian Andrzej Siewior

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 <bigeasy@linutronix.de>
---
 crypto/testmgr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1061,14 +1061,14 @@ 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();
 }
 
 /*

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-08 12:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 11:54 [PATCH] crypto: testmgr - Only disable migration in crypto_disable_simd_for_test() Sebastian Andrzej Siewior
2021-10-05 18:17 ` Eric Biggers
2021-10-07  9:42   ` Sebastian Andrzej Siewior
2021-10-07 17:53     ` Eric Biggers
2021-10-07 19:03       ` Sebastian Andrzej Siewior
2021-10-08 11:34         ` Herbert Xu
2021-10-08 12:24 ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.