linux/arch
Ard Biesheuvel 6c3d86e6ff crypto: x86/aes-ni-xts - use direct calls to and 4-way stride
commit 86ad60a65f29dd862a11c22bb4b5be28d6c5cef1 upstream.

The XTS asm helper arrangement is a bit odd: the 8-way stride helper
consists of back-to-back calls to the 4-way core transforms, which
are called indirectly, based on a boolean that indicates whether we
are performing encryption or decryption.

Given how costly indirect calls are on x86, let's switch to direct
calls, and given how the 8-way stride doesn't really add anything
substantial, use a 4-way stride instead, and make the asm core
routine deal with any multiple of 4 blocks. Since 512 byte sectors
or 4 KB blocks are the typical quantities XTS operates on, increase
the stride exported to the glue helper to 512 bytes as well.

As a result, the number of indirect calls is reduced from 3 per 64 bytes
of in/output to 1 per 512 bytes of in/output, which produces a 65% speedup
when operating on 1 KB blocks (measured on a Intel(R) Core(TM) i7-8650U CPU)

Fixes: 9697fa39ef ("x86/retpoline/crypto: Convert crypto assembler indirect jumps")
Tested-by: Eric Biggers <ebiggers@google.com> # x86_64
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ardb: rebase onto stable/linux-5.4.y]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-20 10:39:47 +01:00
..
alpha
arc
arm KVM: arm64: Ensure I-cache isolation between vcpus of a same VM 2021-03-17 17:03:57 +01:00
arm64 KVM: arm64: nvhe: Save the SPE context early 2021-03-20 10:39:46 +01:00
c6x
csky
h8300
hexagon
ia64
m68k
microblaze
mips MIPS: Drop 32-bit asm string functions 2021-03-07 12:20:43 +01:00
nds32
nios2
openrisc
parisc parisc: Bump 64-bit IRQ stack size to 64 KB 2021-03-07 12:20:47 +01:00
powerpc powerpc/64s: Fix instruction encoding for lis in ppc_function_entry() 2021-03-17 17:03:57 +01:00
riscv
s390 s390/smp: __smp_rescan_cpus() - move cpumask away from stack 2021-03-17 17:03:45 +01:00
sh
sparc sparc64: Use arch_validate_flags() to validate ADI flag 2021-03-17 17:03:43 +01:00
um um: mm: check more comprehensively for stub changes 2021-03-04 10:26:50 +01:00
unicore32
x86 crypto: x86/aes-ni-xts - use direct calls to and 4-way stride 2021-03-20 10:39:47 +01:00
xtensa
.gitignore
Kconfig