All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Rakuram Eswaran <rakuram.e96@gmail.com>
Cc: ardb@kernel.org, corbet@lwn.net, linux-crypto@vger.kernel.org,
	linux-doc@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	skhan@linuxfoundation.org
Subject: Re: [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst
Date: Sat, 23 Aug 2025 22:36:23 -0400	[thread overview]
Message-ID: <20250824023623.GB12644@quark> (raw)
In-Reply-To: <20250823091837.5037-1-rakuram.e96@gmail.com>

Hi Rakuram,

On Sat, Aug 23, 2025 at 02:48:32PM +0530, Rakuram Eswaran wrote:
> Thanks for applying my patch!
> 
> I noticed your comment about the file being dated. 
> I’d be interested in helping to update it to cover the more modern 
> CRC implementations — things like carryless multiplication and 
> hardware CRC instructions on x86, ARM, etc.
> 
> Since I’m not very familiar yet with these optimized approaches. 
> Could you suggest a good starting point for exploring this in the kernel 
> (or any references you recommend)? 
> 
> I was planning to look at lib/crc32.c and the arch-specific 
> implementations, but would appreciate your guidance.
> 
> Best Regards,
> Rakuram 

https://www.corsix.org/content/alternative-exposition-crc32_4k_pclmulqdq
has a fairly good explanation.

In the kernel, x86 uses crc32 instructions for crc32c(), and arm64 uses
crc32 instructions for crc32c(), crc32_le(), and crc32_be().

x86, arm, arm64, powerpc, s390, and riscv all have CRC implementations
using carryless multiplication instructions.  The riscv one might be the
easiest to read since it is mostly written in C, rather than assembly.
See: lib/crc/riscv/crc-clmul-template.h

- Eric

      reply	other threads:[~2025-08-24  2:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 16:26 [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst Rakuram Eswaran
2025-08-21  3:59 ` Eric Biggers
2025-08-23  9:18   ` Rakuram Eswaran
2025-08-24  2:36     ` 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=20250824023623.GB12644@quark \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=rakuram.e96@gmail.com \
    --cc=skhan@linuxfoundation.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.