Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DAF7C05027 for ; Mon, 6 Feb 2023 11:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbjBFLS6 (ORCPT ); Mon, 6 Feb 2023 06:18:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjBFLSz (ORCPT ); Mon, 6 Feb 2023 06:18:55 -0500 Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE80793EF for ; Mon, 6 Feb 2023 03:18:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1675682332; bh=MMQELgfzmTy2xoXiOtkuiLj6chI+faYOtG4k4503QqY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FxqEIztYJEsnztsYoMzZasFmEUzUN8QwwE+GVpct7yREFVRzDZtJQJQr7aBsZTnmx Cskc+ZLptA9aIP+LY5WeMczatirrNccPnYmdx+MiYGBOZPHEf3mVDAmVcKgqojYzFc 5coUMLOyLkYePMjFb+4I/ZAD6610bXAqWQOVLyXs= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 8E48365BFE; Mon, 6 Feb 2023 06:18:49 -0500 (EST) Message-ID: Subject: Re: [PATCH] LoongArch: Make -mstrict-align be configurable From: Xi Ruoyao To: Jianmin Lv , WANG Xuerui , Huacai Chen , Arnd Bergmann , Huacai Chen Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Jiaxun Yang , linux-kernel@vger.kernel.org Date: Mon, 06 Feb 2023 19:18:47 +0800 In-Reply-To: <5303aeda-5c66-ede6-b3ac-7d8ebd73ec70@loongson.cn> References: <20230202084238.2408516-1-chenhuacai@loongson.cn> <5fc85453-1e2c-1f00-7879-1b5fa318c78a@xen0n.name> <5303aeda-5c66-ede6-b3ac-7d8ebd73ec70@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2023-02-06 at 18:24 +0800, Jianmin Lv wrote: > Hi, Xuerui >=20 > I think the kernels produced with and without -mstrict-align have mainly= =20 > following differences: > - Diffirent size. I build two kernls (vmlinux), size of kernel with=20 > -mstrict-align is 26533376 bytes and size of kernel without=20 > -mstrict-align is 26123280 bytes. > - Diffirent performance. For example, in kernel function jhash(), the=20 > assemble code slices with and without -mstrict-align are following: But there are still questions remaining: (1) Is the difference contributed by a bad code generation of GCC? If true, it's better to improve GCC before someone starts to build a distro for LA264 as it would benefit the user space as well. (2) Is there some "big bad unaligned access loop" on a hot spot in the kernel code? If true, it may be better to just refactor the C code because doing so will benefit all ports, not only LoongArch. Otherwise, it may be unworthy to optimize for some cold paths. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University