All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: Arnd Bergmann <arnd@arndb.de>, Huacai Chen <chenhuacai@kernel.org>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
	loongarch@lists.linux.dev, Xuefeng Li <lixuefeng@loongson.cn>,
	Tiezhu Yang <yangtiezhu@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: Add unaligned access support
Date: Mon, 17 Oct 2022 16:13:47 +0800	[thread overview]
Message-ID: <514ccb3b1a2fbd37f238f169eef0f40c89d3e3dd.camel@xry111.site> (raw)
In-Reply-To: <b97afda4-143c-46d2-a6af-dd6a700472ec@app.fastmail.com>

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@xry111.site>
School of Aerospace Science and Technology, Xidian University

      parent reply	other threads:[~2022-10-17  8:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 13:34 [PATCH] LoongArch: Add unaligned access support Huacai Chen
2022-10-16 15:04 ` Xi Ruoyao
2022-10-17  0:16   ` Huacai Chen
2022-10-17  5:49     ` WANG Xuerui
2022-10-17  7:12 ` Arnd Bergmann
2022-10-17  7:31   ` Huacai Chen
2022-10-17  7:38     ` Arnd Bergmann
2022-10-17  8:05       ` WANG Xuerui
2022-10-17  8:22         ` Arnd Bergmann
2022-10-17  8:13       ` Xi Ruoyao [this message]

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=514ccb3b1a2fbd37f238f169eef0f40c89d3e3dd.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=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-kernel@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=yangtiezhu@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.