diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2021-09-28 13:54:01 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2021-10-08 14:02:46 +0200 |
commit | 82e269ad8afe1c73aa6c28dca3c23fecc6c8b616 (patch) | |
tree | 69f1df91ff3f788f505d0568dace8868644a8c94 /crypto/testmgr.c | |
parent | crypto: qat - share adf_enable_pf2vf_comms() from adf_pf2vf_msg.c (diff) | |
download | linux-82e269ad8afe1c73aa6c28dca3c23fecc6c8b616.tar.xz linux-82e269ad8afe1c73aa6c28dca3c23fecc6c8b616.zip |
crypto: testmgr - Only disable migration in crypto_disable_simd_for_test()
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r-- | crypto/testmgr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 70f69f0910c9..58eee8eab4bf 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1061,14 +1061,14 @@ static void generate_random_testvec_config(struct testvec_config *cfg, 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(); } /* |