[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <514ccb3b1a2fbd37f238f169eef0f40c89d3e3dd.camel@xry111.site>
Date: Mon, 17 Oct 2022 16:13:47 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Arnd Bergmann <arnd@...db.de>, Huacai Chen <chenhuacai@...nel.org>
Cc: Huacai Chen <chenhuacai@...ngson.cn>, loongarch@...ts.linux.dev,
Xuefeng Li <lixuefeng@...ngson.cn>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
guoren <guoren@...nel.org>, WANG Xuerui <kernel@...0n.name>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: Add unaligned access support
On Mon, 2022-10-17 at 09:38 +0200, Arnd Bergmann wrote:
> > Some unaligned accesses are observed from the kernel network stack, it
> > seems related to whether the packet aligns to IP header or MAC header.
>
> This is usually a bug in the device driver. It's a fairly common bug
> since the network driver has to ensure the alignment is correct, but
> it's usually fixable, and fixing it results in better performance on
> machines that support unaligned access as well.
Or, maybe a GCC bug is causing -mstrict-align not implemented correctly.
> > And, gcc has a -mstrict-align parameter, if without this, there are
> > unaligned instructions.
>
> Does this default to strict or non-strict mode? Usually gcc does not
> allow to turn this off on architectures that have no hardware support
> for unaligned access.
On LoongArch the unaligned access support is optional. An
implementation is allowed to implement it or not. The software can
determine if it's supported by a CPUCFG instruction.
I think -march=la264 will turn off strict align, but it's not added into
GCC yet.
The GCC default is -mno-strict-align. I expressed my concern about this
decision when I reviewed the GCC port, but at last they just kept the
decision. But the kernel already sets -mstrict-align in CFLAGS anyway.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists