All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Jianmin Lv" <lvjianmin@loongson.cn>,
	"WANG Xuerui" <kernel@xen0n.name>,
	"David Laight" <David.Laight@ACULAB.COM>,
	"Huacai Chen" <chenhuacai@kernel.org>
Cc: "Huacai Chen" <chenhuacai@loongson.cn>,
	"loongarch@lists.linux.dev" <loongarch@lists.linux.dev>,
	Linux-Arch <linux-arch@vger.kernel.org>,
	"Xuefeng Li" <lixuefeng@loongson.cn>, guoren <guoren@kernel.org>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] LoongArch: Make -mstrict-align be configurable
Date: Tue, 07 Feb 2023 15:10:54 +0100	[thread overview]
Message-ID: <59745bb8-00d0-4fa3-b75c-511db310ac16@app.fastmail.com> (raw)
In-Reply-To: <924aa802-410d-a85c-b623-7ca30d15c637@loongson.cn>

On Tue, Feb 7, 2023, at 14:28, Jianmin Lv wrote:
> On 2023/2/7 下午6:32, Arnd Bergmann wrote:
>> I agree the default should always be to have a kernel that works on
>> every machine that has been produced, but this also depends on which
>> models specifically lack the unaligned access. If it's just about
>> pre-production silicon that is now all but scrapped, things are different
>> from a situation where users may actually use them for normal workloads.
>> 
>> Is there an overview of the available loongarch CPU cores that have
>> been produced so far, and which ones support unaligned access?
>
> So far, produced CPUs based LoongArch include 3A5000, 3B5000, 3C5000L, 
> 3C5000, 2K2000, 2K1000LA and 2K0500, where 2K1000LA and 2K0500 are 
> unaligned-access-unsupported, and others are unaligned-access-supported.

Ok, so these are actually some of the newer (though low-end)
implementations that require the workaround, not the older chips.

In this case, I think both the kernel and toolchain need to default
to -mstrict-align, unless someone specifically asks for the variant
that can support unaligned access. The kernel option could be
guarded by 'depends on EXPERT' to ensure that this is not set by
default.

To be sure that this is set correctly, the
arch/loongarch/kernel/unaligned.c file should also never be included
when EFFICIENT_UNALIGNED_ACCESS is set, to ensure that any attempt
to run such a non-portable kernel on 2K1000LA results in a
a kernel panic rather than silently fixing up the unaligned accesses
at a huge performance cost.

    Arnd

  reply	other threads:[~2023-02-07 14:11 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 [this message]
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
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=59745bb8-00d0-4fa3-b75c-511db310ac16@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=David.Laight@ACULAB.COM \
    --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 \
    --cc=lvjianmin@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 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.