From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796539938; b=zwP/vQRzNPIk33+6/IvpuQfw34v4rrs5VfPIZ1scbaHPKgLGxuuu1wWk0/ezHTA5eR5c fGWJceGkGWf1jbdHEc7QvYsRqXdsqERULIzZardiTnvgBtV+swZqYXvtVi2/eIlaQnwIq UgLXB7aTRRVm4HO0LFnStLThhFJyHXQo9wzZBDilesLRX+Ga3+DUf4evymm3Yf+yVBffO vhi9VqOiUOA4j+f2C8mAPIvEACC66ShejSCuMYysoG5uxhxN1OfcZSj2K47rDN1iuqkOh DA/3wcm8iU2pTJZVf+OOhV5XgJgfUPRu2MoGH2EA3rsMdyLpLwbyO20GRlzCdLqi5xw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796539938; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:Subject:From:To:Cc: Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version; bh=U9A4utJeRSiAfHIMEJa1qrmM6DiDNqX38lKaZjjBC3s=; b=BZ318le7+E/awEdbwQ8wj7BEJKOrQh05vM4TFEW7wZ2oWYWqAiwnksoLU5xqTSlVaHul ++qwGzbyniYjfSy6BsDLmEEIbdfVV8svqStcnv0vGYN59k0FPGnO0gpOest5Wra/Cb4dj LuijOTRLcv/6e7K4IDrgAjv6HEBGJ8Lcqt/EGclel1IZ9BqJo4MhtV0CVajMWkwyrL4AN KwmJDWvW5qFZigaWCzH7pbKDL3Vr4NTU5LUpP8UQajCtDqwdjg0QdIiV1WSZY/XsnMiNo 5Dp1WZvm8M1n00KMyON5GYkrBXxCyX+bGwjFakEuSxzdY7e4sHSRXpyQSMVIS3x89Lw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass header.d=xry111.site header.i=@xry111.site header.a=rsa-sha256 header.s=default header.b=EuHAvh1O; arc=none smtp.remote-ip=89.208.246.23 Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9550606A321; Sun, 6 Dec 2026 06:52:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A9550606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=xry111.site header.i=@xry111.site header.a=rsa-sha256 header.s=default header.b=EuHAvh1O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xry111.site; s=default; t=1796539936; bh=U9A4utJeRSiAfHIMEJa1qrmM6DiDNqX38lKaZjjBC3s=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EuHAvh1OyIk5j/62MVYF/tc3ZLHCA88yvzvpRzNmucQWwtLGjGIEqbzk1XK7hnWjg 2bXkpoMbacxEtP27gI+DebcUKBNQVH8Vb9vEBjhVuOLw/1zi5rv+K6Exs75bv2aQ20 TbXWh+rxqGrEMXqbs6l61/SHqrYaN/4hJM8kyi8Y= Received: from [IPv6:2408:824e:f07:fc0:1509:e891:d4ba:c559] (unknown [IPv6:2408:824e:f07:fc0:1509:e891:d4ba:c559]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (secp384r1) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 1630E65EC3; Sun, 6 Dec 2026 01:52:13 -0500 (EST) Message-ID: Subject: Re: [PATCH RFC] LoongArch: Enable HAVE_EFFICIENT_UNALIGNED_ACCESS by default From: Xi Ruoyao To: Tiezhu Yang , Huacai Chen Cc: loongarch@lists.linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 06 Dec 2026 14:52:01 +0800 In-Reply-To: <20261205100121.3605-1-yangtiezhu@loongson.cn> References: <20261205100121.3605-1-yangtiezhu@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.62.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Sat, 2026-12-05 at 18:01 +0800, Tiezhu Yang wrote: > Currently, CONFIG_ARCH_STRICT_ALIGN is enabled by default in Kconfig > to prevent unaligned memory accesses on certain LoongArch processors > without hardware support (such as Loongson-2K0300/2K0500/2K1000). >=20 > However, all Loongson-3 series processors and some newer Loongson-2K > processors (Loongson-2K2000/2K3000) natively support unaligned access > in hardware. Thus, keeping -mstrict-align enabled by default degrades > performance and increases code size on mainstream hardware. >=20 > Moreover, when ARCH_STRICT_ALIGN is disabled, unaligned.o is not built > and software emulation is compiled out. As a result, a single generic > kernel image built without ARCH_STRICT_ALIGN cannot run on processors > without hardware unaligned access support. >=20 > Enable HAVE_EFFICIENT_UNALIGNED_ACCESS by default through disabling > CONFIG_ARCH_STRICT_ALIGN by default so that modern LoongArch systems > can fully benefit from hardware unaligned access, allowing subsystems > such as networking, bpf, and cryptography to perform direct word-size > unaligned loads/stores instead of falling back to slow byte-by-byte > accesses or extra alignment padding. >=20 > To preserve compatibility so that a single generic kernel image can > still run on certain processors without hardware UAL support, keep > software unaligned access emulation always available as a fallback > (while hot paths like memcpy/memset/copy_user already dynamically > switch via ALTERNATIVE based on CPU_FEATURE_UAL). IMO it's easier to just move CONFIG_ARCH_STRICT_ALIGN out of CONFIG_EXPERT and let the distro maintainer to decide (based on if they are building a desktop/server distro or a embedded distro). The desktop/server distros already cannot run on the embedded processors like 2K0300/2K0500 because the uses of LSX and there's no way to salvage it. So it does not make sense to be so idealistic and attempt to use one kernel image for both desktop/server and embedded. --=20 Xi Ruoyao