OSDN Git Service

crypto: arm64/aes-bs - move kernel mode neon en/disable into loop
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sat, 10 Mar 2018 15:21:49 +0000 (15:21 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 16 Mar 2018 15:35:55 +0000 (23:35 +0800)
commit78ad7b08d8e096e5f00bc2cbeba9ef6d24be1bc4
tree7d33ca3298c706b3326d06114946af7355fd25de
parent6833817472702658bdce64ea56bb90813be85557
crypto: arm64/aes-bs - move kernel mode neon en/disable into loop

When kernel mode NEON was first introduced on arm64, the preserve and
restore of the userland NEON state was completely unoptimized, and
involved saving all registers on each call to kernel_neon_begin(),
and restoring them on each call to kernel_neon_end(). For this reason,
the NEON crypto code that was introduced at the time keeps the NEON
enabled throughout the execution of the crypto API methods, which may
include calls back into the crypto API that could result in memory
allocation or other actions that we should avoid when running with
preemption disabled.

Since then, we have optimized the kernel mode NEON handling, which now
restores lazily (upon return to userland), and so the preserve action
is only costly the first time it is called after entering the kernel.

So let's put the kernel_neon_begin() and kernel_neon_end() calls around
the actual invocations of the NEON crypto code, and run the remainder of
the code with kernel mode NEON disabled (and preemption enabled)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/aes-neonbs-glue.c