Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Wentao Guan <guanwentao@uniontech.com>,
	Huacai Chen <chenhuacai@loongson.cn>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-crypto <linux-crypto@vger.kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	loongarch <loongarch@lists.linux.dev>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Tianyang Zhang <zhangtianyang@loongson.cn>
Subject: Re: [PATCH 1/2] lib/crc: loongarch: Use hardware unaligned load in CRC32(C) loops
Date: Mon, 12 Oct 2026 07:22:00 +0000	[thread overview]
Message-ID: <20261012072200.GA828441@google.com> (raw)
In-Reply-To: <CAAhV-H59DV-qF98M1Uu=Y4k1a8YNw0_RnP_nH-yr8fZu-jnFXQ@mail.gmail.com>

On Mon, Oct 12, 2026 at 02:43:47PM +0800, Huacai Chen wrote:
> Yes, we considered modifying {get,put}_unaligned_* globally. But it is
> not arch-specific code and we have no way to override it.
> 
> On the other hand, the byte-to-byte {get,put}_unaligned_* is always
> correct, we are free to only optimise the hot path (like crc32 code).

The unaligned access macros are used in lots of other
performance-critical code.  Hacks in random places don't scale.

> > > Since loongarch made the incorrect decision to not specify unaligned
> > > access unconditionally, similar to RISC-V it can be worked around only
> > > by overriding that in the kconfig.  For loongarch that appears that
> > > already be implemented; just unset CONFIG_ARCH_STRICT_ALIGN when you
> > > know the kernel will run only on CPUs that have fixed this bug.
> > I think that we have the use cases to provide the general kernel instead of the two kernel with
> > different config, so the image increase will be tolerated.
> Yes, the default configuration is to keep CONFIG_ARCH_STRICT_ALIGN set
> for single kernel binary.

So don't do that.  It does not work for divergent unaligned access
support, as the other architectures have learned long ago.

- Eric

  reply	other threads:[~2026-10-12  7:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 14:29 [PATCH 1/2] lib/crc: loongarch: Use hardware unaligned load in CRC32(C) loops Huacai Chen
2026-10-11 14:29 ` [PATCH 2/2] lib/crc: loongarch: Add 3-way parallel CRC32(C) for large buffers Huacai Chen
2026-10-11 15:12   ` Eric Biggers
2026-10-12  6:45     ` Huacai Chen
2026-10-12  7:24       ` Eric Biggers
2026-10-12 10:02         ` Huacai Chen
2026-10-11 14:48 ` Re:[PATCH 1/2] lib/crc: loongarch: Use hardware unaligned load in CRC32(C) loops Wentao Guan
2026-10-11 15:00 ` [PATCH " Eric Biggers
2026-10-11 15:14   ` Wentao Guan
2026-10-12  6:43     ` Huacai Chen
2026-10-12  7:22       ` Eric Biggers [this message]
2026-10-12 11:11         ` Wentao Guan
2026-10-12 13:08           ` David Laight
2026-10-12 14:50             ` Wentao Guan

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=20261012072200.GA828441@google.com \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=guanwentao@uniontech.com \
    --cc=kernel@xen0n.name \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=zhangtianyang@loongson.cn \
    /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