From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.88 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796217729; b=IIZs6ynRxoTxFWw3CP++vt7a/JFyUUvEEi/8YnxSpZqv40/oGUdo6dU4vALhkbXexT1Y aj3l8fjlbXHsBXCgUN9AS4vd7z9e9PuGEIeVuJlSe7CWy5hpNGE/AmhbHf5O/ilW0uwwv M+5xGFY2kTAR0zzZYXjWYVAI62QftBYs3RiXsU4f3wb0DsH+rQRwYP7ab+3aFSoajBs1n C2pHwW9Qi+L+xG++lTFKh6EbxlK/ZyDwdspxzZKfFrLo8u5PURoXxX4ok5/gKb05Ott3s 0gRUe3PET2AS1GbvLsBUP6hA1m0o0rvvv4yh7dKWGv/PokWXLMn6wsYrnSMDQuzlKOA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796217729; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=uRTfZM6tq2jXlWvFDfRKFCPc7gYcczLL/gHZpLHH30U=; b=3GaQG52jySk7QEoqow29MBsWakvQtdhnsgIYWXEghoVfKTFvhL+TXYrRWh/KWxbDm7ko apNSKaA+4xT6l7hTx23533U/cdhM42Icnz8b1EJZFbjLGMCkk6i2zc/nOfod1dnVUw8pJ iZNp7i6laPg9wBEosOxF6SbHCrrAUQ8J8qrlhJ9ci0nov/XKa5/JuTE0EAnBVDv90ozVY ommlqWz58N7xUTA6p4AIXeNPKpUfFsauYUWeFlvnZc42KsPcd1YNjamyzMz3VDzGDyOWB zSfvUc+S+TUnYnn8hoGa51S25c0AQq/+neq2ATlq0x0HYy8Ke0twtOsqiq1mWT6AQeg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=KpcPscNd; arc=none smtp.remote-ip=91.218.175.88 Received: from mta0.migadu.com (out-88.mta0.migadu.com [91.218.175.88]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DD4F606A31A for ; Wed, 2 Dec 2026 13:22:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9DD4F606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=KpcPscNd X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=fRvSnOWh8iUztVEVztuw7/1x6HN146x2QcnyhrlfFVg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796217725; v=1; x=1796822525; b=KpcPscNdaom+bH8aMdyc81XLzcuV7RBasYzb7k5SQ2gmj7kdC0Rt6d9w3zxBzUYpLEMzc3ze 1Q4/dJFtHUyNWaBEWLaqUIRZrdQ24I18pMvZpgyHOLUe7Q87Avx/OWEy2YZ+ULAjQv1rabZ0LFq fF17VOlwIptQH55vF9KP1vt0= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 2160c5742e974311; Wed, 02 Dec 2026 13:22:05 +0000 X-Mizu-Trace-ID: 2160c5742e974311 X-Migadu-Flow: FLOW_OUT From: George Guo To: yangtiezhu@loongson.cn Cc: chenhuacai@kernel.org, guodongtai@kylinos.cn, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] LoongArch: Call fixup_exception() for unaligned accesses Date: Wed, 2 Dec 2026 05:21:58 -0800 Message-ID: <20261202132158.39948-1-dongtai.guo@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261202081108.20060-1-yangtiezhu@loongson.cn> References: <20261202081108.20060-1-yangtiezhu@loongson.cn> 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 Content-Transfer-Encoding: quoted-printable On 2026/12/2 16:11, Tiezhu Yang wrote:=0D > On LoongArch, atomic memory instructions (AM*) require natural=0D > alignment and always raise EXCCODE_ALE when given an unaligned=0D > address, whereas unaligned regular loads and stores are either=0D > handled in hardware or emulated in software.=0D >=0D > Consult fixup_exception() on the failure paths of do_ale() and=0D > emulate_load_store_insn() so that registered exception handlers=0D > can catch and recover from unaligned access faults.=0D =0D I tested this on Loongson-3C6000, with the LoongArch BPF arena atomics=0D series applied, using a new arena_atomics/unaligned subtest that does=0D 32-bit fetch add and fetch or, 64-bit xchg and cmpxchg one byte off an=0D aligned arena address.=0D =0D Without this patch, the kernel panics at the first atomic:=0D =0D Kernel ale access[#1]:=0D ...=0D ERA: ffff8000020136f4 bpf_prog_53d40cccca5faaf3_unaligned+0x10c/0x284=0D ESTAT: 00090000 [ALE] (IS=3D ECode=3D9 EsubCode=3D0)=0D BADV: ffff80008d600001=0D ...=0D Kernel panic - not syncing: Fatal exception=0D =0D With this patch, the test passed with both CONFIG_ARCH_STRICT_ALIGN=3Dy=0D and CONFIG_ARCH_STRICT_ALIGN=3Dn:=0D =0D $ sudo ./test_progs -a arena_atomics/unaligned=0D #3/10 arena_atomics/unaligned:OK=0D #3 arena_atomics:OK=0D Summary: 1/1 PASSED, 0 SKIPPED, 0/0 FAILED=0D =0D Reviewed-by: George Guo =0D Tested-by: George Guo =0D =0D I will send the test as a follow-up to this patch.=0D =0D Thanks,=0D George=0D