public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: David Sterba <dsterba@suse.cz>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-btrfs@vger.kernel.org,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Subject: Re: [PATCH 2/2] crypto/crc32[c]: register only "-lib" drivers
Date: Tue, 17 Jun 2025 13:47:56 -0700	[thread overview]
Message-ID: <20250617204756.GD1288@sol> (raw)
In-Reply-To: <20250617202050.GB1288@sol>

On Tue, Jun 17, 2025 at 01:20:50PM -0700, Eric Biggers wrote:
> On Tue, Jun 17, 2025 at 10:17:48PM +0200, David Sterba wrote:
> > On Fri, Jun 13, 2025 at 11:37:53AM -0700, Eric Biggers wrote:
> > > From: Eric Biggers <ebiggers@google.com>
> > > 
> > > For the "crc32" and "crc32c" shash algorithms, instead of registering
> > > "*-generic" drivers as well as conditionally registering "*-$(ARCH)"
> > > drivers, instead just register "*-lib" drivers.  These just use the
> > > regular library functions crc32_le() and crc32c(), so they just do the
> > > right thing and are fully accelerated when supported by the CPU.
> > > 
> > > This eliminates the need for the CRC library to export crc32_le_base()
> > > and crc32c_base().  Separate patches make those static functions.
> > > 
> > > Since this patch removes the "crc32-generic" and "crc32c-generic" driver
> > > names which crypto/testmgr.c expects to exist, update crypto/testmgr.c
> > > accordingly.  This does mean that crypto/testmgr.c will no longer
> > > fuzz-test the "generic" implementation against the "arch" implementation
> > > for crc32 and crc32c, but this was redundant with crc_kunit anyway.
> > > 
> > > Besides the above, and btrfs_init_csum_hash() which the previous patch
> > > fixed, no code appears to have been relying on the "crc32-generic" or
> > > "crc32c-generic" driver names specifically.
> > > 
> > > btrfs does export the checksum driver name in
> > > /sys/fs/btrfs/$uuid/checksum.  This patch makes that file contain
> > > "crc32c-lib" instead of "crc32c-generic" or "crc32c-$(ARCH)".  This
> > > should be fine, since in practice the purpose of this file seems to have
> > > been just to allow users to manually check whether they needed to enable
> > > the optimized CRC32C code.  This was needed only because of the bug in
> > > old kernels where the optimized CRC32C code defaulted to off and even
> > > needed to be explicitly added to the ramdisk to be used.  Now that it
> > > just works in Linux 6.14 and later, there's no need for users to take
> > > any action and this file is basically obsolete.
> > 
> > Well, not the whole file, because it says which checksumming algo is
> > used for the filesystem, but the implementation part is.
> 
> Oh, right.  It's one of those sysfs files that don't follow the normal sysfs
> convention and contain multiple values.  I'll update the paragraph above to
> clarify that it's referring to the driver name part of the file.

I revised it to:

btrfs does export the checksum name and checksum driver name in
/sys/fs/btrfs/$uuid/checksum.  This commit makes the driver name portion
of that file contain "crc32c-lib" instead of "crc32c-generic" or
"crc32c-$(ARCH)".  This should be fine, since in practice the purpose of
the driver name portion of this file seems to have been just to allow
users to manually check whether they needed to enable the optimized
CRC32C code.  This was needed only because of the bug in old kernels
where the optimized CRC32C code defaulted to off and even needed to be
explicitly added to the ramdisk to be used.  Now that it just works in
Linux 6.14 and later, there's no need for users to take any action and
the driver name portion of this is basically obsolete.  (Also, note that
the crc32c driver name already changed in 6.14.)

  reply	other threads:[~2025-06-17 20:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 18:37 [PATCH 0/2] Simplify the shash wrappers for the CRC32 library Eric Biggers
2025-06-13 18:37 ` [PATCH 1/2] btrfs: stop parsing crc32c driver name Eric Biggers
2025-06-13 18:37 ` [PATCH 2/2] crypto/crc32[c]: register only "-lib" drivers Eric Biggers
2025-06-17 20:17   ` David Sterba
2025-06-17 20:20     ` Eric Biggers
2025-06-17 20:47       ` Eric Biggers [this message]
2025-06-18  8:58         ` David Sterba
2025-06-19 10:27         ` Daniel Vacek
2025-06-19 12:59           ` David Sterba
2025-06-17  3:39 ` [PATCH 0/2] Simplify the shash wrappers for the CRC32 library Eric Biggers
2025-06-17 20:19 ` David Sterba

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=20250617204756.GD1288@sol \
    --to=ebiggers@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=ardb@kernel.org \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.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