All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Ard Biesheuvel <ardb+git@google.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	herbert@gondor.apana.org.au, will@kernel.org,
	catalin.marinas@arm.com, Kees Cook <kees@kernel.org>
Subject: Re: [PATCH 2/2] arm64/crc32: Implement 4-way interleave using PMULL
Date: Wed, 16 Oct 2024 16:24:11 +0000	[thread overview]
Message-ID: <20241016162411.GA3228925@google.com> (raw)
In-Reply-To: <CAMj1kXHDqD29TzE=2cw55qeKrnybgkYFCdy4jU_4E=OaUOkZNg@mail.gmail.com>

On Wed, Oct 16, 2024 at 09:12:41AM +0200, Ard Biesheuvel wrote:
> > I'd recommend calling the file crc32-4way.S and the functions
> > crc32*_arm64_4way(), rather than crc32-pmull.S and crc32*_pmull().  This would
> > avoid confusion with a CRC implementation that is actually based entirely on
> > pmull (which is possible).
> 
> I'm well aware :-)
> 
> commit 8fefde90e90c9f5c2770e46ceb127813d3f20c34
> Author: Ard Biesheuvel <ardb@kernel.org>
> Date:   Mon Dec 5 18:42:27 2016 +0000
> 
>     crypto: arm64/crc32 - accelerated support based on x86 SSE implementation
> 
> commit 598b7d41e544322c8c4f3737ee8ddf905a44175e
> Author: Ard Biesheuvel <ardb@kernel.org>
> Date:   Mon Aug 27 13:02:45 2018 +0200
> 
>     crypto: arm64/crc32 - remove PMULL based CRC32 driver
> 
> I removed it because it wasn't actually faster, although that might be
> different on modern cores.

The PMULL-based code removed by commit 598b7d41e544 was only 4-wide.  On
Apple M1, a 12-wide PMULL-based CRC32 is actually faster than 4-way CRC32,
especially if the eor3 instruction from the sha3 extension is utilized.

This was not the case on non-Apple CPUs I tested (in 2022), though.  12-wide is
very wide and is a bit inconvenient, and IMO it's not worth doing in the kernel
at this point.  It would be interesting to test the very latest CPUs, though.

- Eric

      reply	other threads:[~2024-10-16 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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=20241016162411.GA3228925@google.com \
    --to=ebiggers@kernel.org \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kees@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@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 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.