lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <59745bb8-00d0-4fa3-b75c-511db310ac16@app.fastmail.com>
Date:   Tue, 07 Feb 2023 15:10:54 +0100
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Jianmin Lv" <lvjianmin@...ngson.cn>,
        "WANG Xuerui" <kernel@...0n.name>,
        "David Laight" <David.Laight@...LAB.COM>,
        "Huacai Chen" <chenhuacai@...nel.org>
Cc:     "Huacai Chen" <chenhuacai@...ngson.cn>,
        "loongarch@...ts.linux.dev" <loongarch@...ts.linux.dev>,
        Linux-Arch <linux-arch@...r.kernel.org>,
        "Xuefeng Li" <lixuefeng@...ngson.cn>, guoren <guoren@...nel.org>,
        "Jiaxun Yang" <jiaxun.yang@...goat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] LoongArch: Make -mstrict-align be configurable

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ