mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] lib/crypto: x86/chacha: Add 16-block AVX-512 implementation
@ 2026-10-25 23:47 Antonio Quartulli
  2026-10-25 23:47 ` [PATCH 1/2] lib/crypto: tests: Add KUnit tests and benchmark for ChaCha Antonio Quartulli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Antonio Quartulli @ 2026-10-25 23:47 UTC (permalink / raw)
  To: Eric Biggers, Jason A . Donenfeld, Ard Biesheuvel
  Cc: Antonio Quartulli, linux-crypto, linux-kernel

Hi all,

this series adds a 16-block ChaCha implementation for x86 using 512-bit
registers. It is preceded by a KUnit suite and benchmark for
chacha_crypt(), as lib/crypto has none for plain ChaCha yet.

Patch 1 stands on its own and passes with and without patch 2.

On AMD Zen 5, the new code doubles chacha_crypt() throughput for inputs
of 1 KiB and more, from about 5.2 GB/s to about 10.2 GB/s. It came out
of work on the OpenVPN data channel offload driver (ovpn), whose
ChaCha20-Poly1305 throughput is CPU-bound: in a VM benchmark it gained
about 10% at a 1500-byte MTU and 35% at 9000.

iPlease note that I could only measure Zen 5.
The new code is not used on the CPUs setting X86_FEATURE_PREFER_YMM
(Skylake-X, Ice Lake and Tiger Lake), but it is on
Rocket Lake, Sapphire Rapids and later, and on Zen 4, where 512-bit
operations are split into two halves. Numbers from any of those would be
very welcome.

Regards,
	Antonio

Antonio Quartulli (2):
  lib/crypto: tests: Add KUnit tests and benchmark for ChaCha
  lib/crypto: x86/chacha: Add 16-block AVX-512 (zmm) implementation

 lib/crypto/.kunitconfig                 |   1 +
 lib/crypto/tests/Kconfig                |   8 +
 lib/crypto/tests/Makefile               |   1 +
 lib/crypto/tests/chacha_kunit.c         | 269 +++++++++++++++
 lib/crypto/x86/chacha-avx512vl-x86_64.S | 413 +++++++++++++++++++++++-
 lib/crypto/x86/chacha.h                 |  29 +-
 6 files changed, 719 insertions(+), 2 deletions(-)
 create mode 100644 lib/crypto/tests/chacha_kunit.c


base-commit: 20ec6916d8712e84d58e8c688a25cd368ddeb82b
-- 
2.55.0


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

end of thread, other threads:[~2026-10-26  0:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 23:47 [PATCH 0/2] lib/crypto: x86/chacha: Add 16-block AVX-512 implementation Antonio Quartulli
2026-10-25 23:47 ` [PATCH 1/2] lib/crypto: tests: Add KUnit tests and benchmark for ChaCha Antonio Quartulli
2026-10-25 23:47 ` [PATCH 2/2] lib/crypto: x86/chacha: Add 16-block AVX-512 (zmm) implementation Antonio Quartulli
2026-10-26  0:35 ` [PATCH 0/2] lib/crypto: x86/chacha: Add 16-block AVX-512 implementation Eric Biggers
2026-10-26  0:46   ` Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®