Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-crypto@vger.kernel.org,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	x86@kernel.org
Subject: Re: [PATCH 0/8] lib/crypto: De-bloat and optimize sha512-ssse3-asm.S
Date: Tue, 24 Nov 2026 20:33:46 +0000	[thread overview]
Message-ID: <20261124203346.GC2227373@google.com> (raw)
In-Reply-To: <1a78f7c9-59de-4ac4-8adf-aee0538d813c@app.fastmail.com>

On Tue, Nov 24, 2026 at 12:27:22PM +0100, Ard Biesheuvel wrote:
> I gave this a spin on my Sandy Bridge machine, which indeed takes a 20%
> performance hit from removing the AVX version.

Thanks for confirming the expected 20% from
"lib/crypto: x86/sha2: Drop one-off implementations for Sandy/Ivy Bridge"
(https://lore.kernel.org/linux-crypto/20261115080900.216434-1-ebiggers@kernel.org/)

I still think we should take that patch anyway, for all the reasons
given in the commit message.  Do you agree?

It just doesn't make sense to still be maintaining two entire asm files
just for Sandy/Ivy Bridge.  Especially for SHA-2, which such legacy
systems (mostly desktop/laptop) are unlikely to be using in a
performance-critical way in the kernel.  If it was e.g. AES-XTS, that
would be more worthwhile since people actually do use dm-crypt.

If we do keep the files, IMO we'd still need to fix the excessive
unrolling, excessive stack frame lacking zeroization, and incorrect
enablement on CPUs that don't need the shld hack.

> These changes regress it by another 3-4%

That's unfortunate.  Would you be able to test the performance after
just patches 1-2?  Those are the most important ones, which I think are
worthwhile anyway even if there's a marginal throughput decrease in a
warm cache microbenchmark loop.

The other patches in the series I don't mind dropping if they don't help
in the microbenchmark.  "lib/crypto: x86/sha512: Keep W[t]+K[t] in %xmm5
instead of stack" in particular I think is suspect, based on what I
measured when trying to remove frame_WK from the AVX2 code.  It is
annoying that we have to store anything on the stack at all, though.

- Eric

      reply	other threads:[~2026-11-24 20:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  2:20 [PATCH 0/8] lib/crypto: De-bloat and optimize sha512-ssse3-asm.S Eric Biggers
2026-11-22  2:20 ` [PATCH 1/8] lib/crypto: x86/sha512: Partially roll up sha512_transform_ssse3() Eric Biggers
2026-11-22  2:20 ` [PATCH 2/8] lib/crypto: x86/sha512: Keep message schedule in XMM registers Eric Biggers
2026-11-22  2:20 ` [PATCH 3/8] lib/crypto: x86/sha512: Keep W[t]+K[t] in %xmm5 instead of stack Eric Biggers
2026-11-22  2:20 ` [PATCH 4/8] lib/crypto: x86/sha512: Keep XMM_QWORD_BSWAP in %xmm14 across blocks Eric Biggers
2026-11-22  2:20 ` [PATCH 5/8] lib/crypto: x86/sha512: Use pshufb for ror64(x, 8) in SSSE3 s0 Eric Biggers
2026-11-22  2:20 ` [PATCH 6/8] lib/crypto: x86/sha512: Keep state in registers across blocks in SSSE3 Eric Biggers
2026-11-22  2:20 ` [PATCH 7/8] lib/crypto: x86/sha512: Shorten critical-path additions " Eric Biggers
2026-11-22  2:20 ` [PATCH 8/8] lib/crypto: x86/sha512: Use local labels for data Eric Biggers
2026-11-24 11:27 ` [PATCH 0/8] lib/crypto: De-bloat and optimize sha512-ssse3-asm.S Ard Biesheuvel
2026-11-24 20:33   ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124203346.GC2227373@google.com \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox