All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] crypto: use unaligned accessors in aligned fast paths
@ 2018-10-08 21:15 ` Ard Biesheuvel
  0 siblings, 0 replies; 23+ messages in thread
From: Ard Biesheuvel @ 2018-10-08 21:15 UTC (permalink / raw)
  To: linux-crypto
  Cc: jason, herbert, arnd, Ard Biesheuvel, ebiggers, linux-arm-kernel

CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS behaves a bit counterintuitively
on ARM: we set it for architecture revisions v6 and up, which support
any alignment for load/store instructions that operate on bytes, half
words or words. However, load/store double word and load store multiple
instructions still require 32-bit alignment, and using them on unaligned
quantities results in costly alignment traps that have to be fixed up by
the kernel's fixup code.

Fortunately, the unaligned accessors do the right thing here: on
architectures that really tolerate any misalignment, they simply resolve
to the aligned accessors, while on ARMv6+ (which uses the packed struct
wrappers for unaligned accesses), they result in load/store sequences
that avoid the instructions that require 32-bit alignment.

Since there is not really a downside to using the unaligned accessors on
aligned paths for architectures other than ARM that define
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, let's switch to them in a couple
of places in the crypto code.

Note that all patches are against code that has been observed to be emitted
with ldm or ldrd instructions when building ARM's multi_v7_defconfig.

Ard Biesheuvel (3):
  crypto: memneq - use unaligned accessors for aligned fast path
  crypto: crypto_xor - use unaligned accessors for aligned fast path
  crypto: siphash - drop _aligned variants

 crypto/algapi.c         |   7 +-
 crypto/memneq.c         |  24 +++--
 include/crypto/algapi.h |  11 +-
 include/linux/siphash.h | 106 +++++++++-----------
 lib/siphash.c           | 103 ++-----------------
 5 files changed, 83 insertions(+), 168 deletions(-)

-- 
2.11.0

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

end of thread, other threads:[~2018-10-09  8:38 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 21:15 [PATCH 0/3] crypto: use unaligned accessors in aligned fast paths Ard Biesheuvel
2018-10-08 21:15 ` Ard Biesheuvel
2018-10-08 21:15 ` [PATCH 1/3] crypto: memneq - use unaligned accessors for aligned fast path Ard Biesheuvel
2018-10-08 21:15   ` Ard Biesheuvel
2018-10-09  3:34   ` Eric Biggers
2018-10-09  3:34     ` Eric Biggers
2018-10-09  6:01     ` Ard Biesheuvel
2018-10-09  6:01       ` Ard Biesheuvel
2018-10-08 21:15 ` [PATCH 2/3] crypto: crypto_xor " Ard Biesheuvel
2018-10-08 21:15   ` Ard Biesheuvel
2018-10-09  3:47   ` Eric Biggers
2018-10-09  3:47     ` Eric Biggers
2018-10-09  8:38     ` Ard Biesheuvel
2018-10-09  8:38       ` Ard Biesheuvel
2018-10-08 21:15 ` [PATCH 3/3] crypto: siphash - drop _aligned variants Ard Biesheuvel
2018-10-08 21:15   ` Ard Biesheuvel
2018-10-09  4:11   ` Jason A. Donenfeld
2018-10-09  4:11     ` Jason A. Donenfeld
2018-10-09  5:59     ` Ard Biesheuvel
2018-10-09  5:59       ` Ard Biesheuvel
2018-10-09  6:10       ` Jeffrey Walton
2018-10-09  6:10         ` Jeffrey Walton
2018-10-09  6:10         ` Jeffrey Walton

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.