From: "Arnd Bergmann" <arnd@arndb.de>
To: "Huacai Chen" <chenhuacai@kernel.org>
Cc: "Huacai Chen" <chenhuacai@loongson.cn>,
loongarch@lists.linux.dev,
Linux-Arch <linux-arch@vger.kernel.org>,
"Xuefeng Li" <lixuefeng@loongson.cn>, guoren <guoren@kernel.org>,
"WANG Xuerui" <kernel@xen0n.name>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LoongArch: Make -mstrict-align be configurable
Date: Mon, 06 Feb 2023 11:33:10 +0100 [thread overview]
Message-ID: <f90129d9-3262-4e3a-9d78-57f641dbdb64@app.fastmail.com> (raw)
In-Reply-To: <CAAhV-H6kuzfjw5i8-6L_68c50nsXzFipHY5hxtbShuv16bqRbg@mail.gmail.com>
On Fri, Feb 3, 2023, at 03:08, Huacai Chen wrote:
> On Thu, Feb 2, 2023 at 5:47 PM Arnd Bergmann <arnd@arndb.de> wrote:
>>
>> On Thu, Feb 2, 2023, at 09:42, Huacai Chen wrote:
>> > Introduce Kconfig option ARCH_STRICT_ALIGN to make -mstrict-align be
>> > configurable.
>> >
>> > Not all LoongArch cores support h/w unaligned access, we can use the
>> > -mstrict-align build parameter to prevent unaligned accesses.
>> >
>> > This option is disabled by default to optimise for performance, but you
>> > can enabled it manually if you want to run kernel on systems without h/w
>> > unaligned access support.
>> >
>> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>>
>> This feels like it's a way too low-level option, I would not expect
>> users to be able to answer this correctly.
>>
>> What I would do instead is to have Kconfig options for specific
>> CPU implementations and derive the alignment requirements from
>> that.
> You mean provide something like CONFIG_CPU_XXXX as MIPS do? That
> seems not a good idea, too. If there are more than 3 CONFIG_CPU_XXXX,
> the complexity is more than CONFIG_ARCH_STRICT_ALIGN.
The way that mips does it is not useful since that forces you to
pick a single CPU from a 'choice' list in Kconfig, with the CPUs
being mutually exclusive in that list. What you need here is either
a strict hierarchy of CPUs like in arch/x86/Kconfig.cpus where each
option is a superset of the previous one, or a set of options
like in arch/arm/mm/Kconfig that are not mutually exclusive and
let you pick any combinations that you want to support in a kernel
image.
The important bit is that a kernel you build will by default
always work across all hardware except the ones that are
explicitly excluded.
> Then users are also unable to do a correct selection. On the other
> hand, we can add more words under CONFIG_ARCH_STRICT_ALIGN to
> describe which processors support hardware unaligned accesses.
Trying to handle this with help texts quickly gets out of hand
when you get to dozens of CPU specific optimizations that are
incompatible with other CPU cores. I assume you will need similar
options e.g. for the broken cpu-idle instruction on early cores
or the missing sub-word atomics, once these are fixed in new
CPU cores.
Arnd
next prev parent reply other threads:[~2023-02-06 10:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 8:42 [PATCH] LoongArch: Make -mstrict-align be configurable Huacai Chen
2023-02-02 9:01 ` David Laight
2023-02-03 2:00 ` Huacai Chen
2023-02-03 8:46 ` David Laight
2023-02-06 10:28 ` Jianmin Lv
2023-02-07 5:24 ` WANG Xuerui
2023-02-07 10:32 ` Arnd Bergmann
2023-02-07 13:28 ` Jianmin Lv
2023-02-07 14:10 ` Arnd Bergmann
2023-02-08 11:17 ` Huacai Chen
2023-02-02 9:46 ` Arnd Bergmann
2023-02-03 2:08 ` Huacai Chen
2023-02-06 10:33 ` Arnd Bergmann [this message]
2023-02-02 10:30 ` WANG Xuerui
2023-02-06 10:24 ` Jianmin Lv
2023-02-06 11:18 ` Xi Ruoyao
2023-02-06 13:13 ` Jianmin Lv
2023-02-06 13:22 ` Arnd Bergmann
2023-02-07 1:13 ` Jianmin Lv
2023-02-06 13:30 ` Xi Ruoyao
2023-02-07 1:27 ` Jianmin Lv
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=f90129d9-3262-4e3a-9d78-57f641dbdb64@app.fastmail.com \
--to=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=guoren@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=loongarch@lists.linux.dev \
/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