linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: Speed up CRC-32 using PMULL instructions
@ 2024-10-15 10:41 Ard Biesheuvel
  2024-10-15 10:41 ` [PATCH 1/2] arm64/lib: Handle CRC-32 alternative in C code Ard Biesheuvel
  2024-10-15 10:41 ` [PATCH 2/2] arm64/crc32: Implement 4-way interleave using PMULL Ard Biesheuvel
  0 siblings, 2 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2024-10-15 10:41 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, linux-crypto, herbert, will, catalin.marinas,
	Ard Biesheuvel, Eric Biggers, Kees Cook

From: Ard Biesheuvel <ardb@kernel.org>

The CRC-32 code is library code, and is not part of the crypto
subsystem. This means that callers may not generally be aware of the
kind of implementation that backs it, and so we've refrained from using
FP/SIMD code in the past, as it disables preemption, and this may incur
scheduling latencies that the caller did not anticipate.

This was solved a while ago, and on arm64, kernel mode FP/SIMD no longer
disables preemption.

This means we can happily use PMULL instructions in the CRC-32 library
code, which permits an optimization to be implemented that results in a
speedup of 2 - 2.8x for inputs >1k in size (on Apple M2)

Patch #1 implements some prepwork to handle the scalar CRC-32
alternatives patching in C code.

Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Kees Cook <kees@kernel.org>

Ard Biesheuvel (2):
  arm64/lib: Handle CRC-32 alternative in C code
  arm64/crc32: Implement 4-way interleave using PMULL

 arch/arm64/lib/Makefile      |   2 +-
 arch/arm64/lib/crc32-glue.c  |  70 ++++++
 arch/arm64/lib/crc32-pmull.S | 240 ++++++++++++++++++++
 arch/arm64/lib/crc32.S       |  21 +-
 4 files changed, 317 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm64/lib/crc32-glue.c
 create mode 100644 arch/arm64/lib/crc32-pmull.S

-- 
2.47.0.rc1.288.g06298d1525-goog



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

end of thread, other threads:[~2024-10-16 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 10:41 [PATCH 0/2] arm64: Speed up CRC-32 using PMULL instructions Ard Biesheuvel
2024-10-15 10:41 ` [PATCH 1/2] arm64/lib: Handle CRC-32 alternative in C code Ard Biesheuvel
2024-10-15 10:41 ` [PATCH 2/2] arm64/crc32: Implement 4-way interleave using PMULL Ard Biesheuvel
2024-10-16  3:03   ` Eric Biggers
2024-10-16  7:12     ` Ard Biesheuvel
2024-10-16 16:24       ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).