From: "Wentao Guan" <guanwentao@uniontech.com>
To: "Eric Biggers" <ebiggers@kernel.org>,
"Huacai Chen" <chenhuacai@loongson.cn>
Cc: chenhuacai <chenhuacai@kernel.org>,
"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: Sun, 11 Oct 2026 23:14:02 +0800 [thread overview]
Message-ID: <tencent_4750F9C704AA3CFA1E7309B7@qq.com> (raw)
In-Reply-To: <20261011150052.GA168780@quark>
> On Sun, Oct 11, 2026 at 10:29:29PM +0800, Huacai Chen wrote:
> > +static inline u32 get_le32(const void *p)
> > +{
> > + if (static_branch_likely(&have_ual))
> > + return *((__le32 *)p);
> > + else
> > + return get_unaligned_le32(p);
> > +}
>
> No, this is just broken. The bare misaligned access is undefined
> behavior in C. Also, every other use of {get,put}_unaligned_* in the
> kernel would need this; it is not specific to the CRC code. Also, it is
Right, I got your thought. It not belong to CRC level.
> inefficient to compile both code paths into the binary.
>
> The only way that realistically works, as we know from the other
> architectures, is for the unaligned access support to be known at
> compile time, and to have {get,put}_unaligned_* do the right thing
> accordingly.
So the optimize it can be move to {get,put}_unaligned_* code?
>
> 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.
BRs
Wentao Guan
next prev parent reply other threads:[~2026-10-11 15:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 14:29 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 [this message]
2026-10-12 6:43 ` Huacai Chen
2026-10-12 7:22 ` Eric Biggers
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=tencent_4750F9C704AA3CFA1E7309B7@qq.com \
--to=guanwentao@uniontech.com \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=ebiggers@kernel.org \
--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
all inboxes | Powered by JetHome®