From owner-freebsd-arm@FreeBSD.ORG Tue Mar 10 00:27:19 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C0E4885 for ; Tue, 10 Mar 2015 00:27:19 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [IPv6:2001:4f8:3:ffe0:406a:0:50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00620AEA for ; Tue, 10 Mar 2015 00:27:18 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [127.0.1.5]) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9) with ESMTP id t2A0RI35040550 for ; Tue, 10 Mar 2015 00:27:18 GMT (envelope-from root@phabric-backend.isc.freebsd.org) Received: (from root@localhost) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9/Submit) id t2A0RImk040549; Tue, 10 Mar 2015 00:27:18 GMT (envelope-from root) Date: Tue, 10 Mar 2015 00:27:18 +0000 To: freebsd-arm@freebsd.org From: "meloun-miracle-cz (Michal Meloun)" Subject: [Differential] [Commented On] D2017: Allow to disable alignment faults in the kernel configuration file Message-ID: X-Priority: 3 Thread-Topic: D2017: Allow to disable alignment faults in the kernel configuration file X-Herald-Rules: none X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: X-Phabricator-Cc: In-Reply-To: References: Thread-Index: M2IwYjY0ZDAxMWY3ZTNlM2Y4OWM0M2JjYjUzIFT+OmY= X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2015 00:27:19 -0000 meloun-miracle-cz added a comment. > **Jakub Palider wrote:** >Yes, I think I understand your reasoning, but you refer to a more >generic problem, related to CPU settings vs compiler code generation. >Let me show a more concrete example. Below is an extract from fault when >there is no ARM32_DISABLE_ALIGNMENT_FAULTS set. > >r7=a5b60b36a >Stopped at tcp_input+0x738: ldr r0, [r7, #0x004] > >Here, we can see instruction (LDR) which *does* operate on unaligned >addresses, so I assume compiler was clever enough not to use any of >those "forbidden" instructions (e.g. LDMIA/STMIA). This resolution is invalid, imho. The kernel is compiled with “-mno-unaligned-access”, and if everything is in order, the compiler cannot generate any unaligned access. The fault in tcp_input() indicates problem in code, compiler evidently assumes aligned address here. Due to this (incorrect) assumption compiler is free to generate any instruction (LDM/STM including). Or I miss something? Enabling of unaligned access is big win for network code. But this case is evident papering over real problem. And this problem must be solved first. REVISION DETAIL https://reviews.freebsd.org/D2017 To: zbb, ian, andrew, imp Cc: meloun-miracle-cz, freebsd-arm