From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29008C54798 for ; Tue, 27 Feb 2024 10:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6L1H4zjTcvFHYsYdXsqGJVLT5Alf7J+PLFEyuiKyydI=; b=MhIsEUOMj2Fx0l RugXRgDw2rGQ3YUIc1p9rGiFIR2pD09O7MjDnT4NSOq/9xRUR0GbZc4y4kGGhyvz912Xw8AwEoCkW onhdHdtl51INg6cWue1Z2UDjuVfuryWP5PFDKiFhs/ndgOK/2UCAv/dZr+3xRtmWK5GgYD/fCQmTm S2SdoMo1EWzN5Dr6sQuI4dBEo5Bjbtj1HU9ZBHDx9q0j43OK58N5ye9/fU5yU6OMYiKkKt2z8PWH3 BghHC+4iwoSVcBUkQxq2dtPobdctQEOS3d5RxN9SMVvEJ9J0vJXMG9KL1ky+nvaamlp3BtnDlfvSY 8Cd/L3ORTANi1gj+c67A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reuhx-00000004jxQ-0gYl; Tue, 27 Feb 2024 10:29:09 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reuhu-00000004jvz-2Ufp for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 10:29:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AaMsMZWiwvSaJp1atd6FKd0pROFWF3fPGtmIY0iqYYs=; b=nJOIxtZ52FqIAVUFl2d7cP0vTC F1ANU0h5omGFVqaHz+i1HZQ/9eCovQVlWBEKYvHWcTgj/WlJK5s9ngZ2ESModv77AqFeEFgfOYNhM WuunX11xsvZ1EFu00Byzj9MB2hE2+TuhPu6d9p6pJcC4XIZ7tcmnEOZdLNgYiubkOCbQxMEt1a2wR l5lRgW/fVcaLTA6xaKpEElQO/kDQrISXdGzbUm3M4GGs3itlVmricP/bMq29RcArGak8WDOnK3xyi 7KK4fDE0xQatqYO1vGATvNtgxUAr8Wj3DEWWPkYSbrodbniRmVPfY0Kap03XGhONynL7yldslsE1S lXYyXE9w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:55912) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1reuhc-0007lc-2j; Tue, 27 Feb 2024 10:28:48 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1reuhZ-0007JB-VJ; Tue, 27 Feb 2024 10:28:46 +0000 Date: Tue, 27 Feb 2024 10:28:45 +0000 From: "Russell King (Oracle)" To: Christophe Leroy Cc: Guenter Roeck , Charlie Jenkins , David Laight , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Arnd Bergmann , "linux-kernel@vger.kernel.org" , Palmer Dabbelt , Linux ARM Subject: Re: [PATCH v10] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Message-ID: References: <20240223-fix_sparse_errors_checksum_tests-v10-1-b6a45914b7d8@rivosinc.com> <7ae930a7-3b10-4470-94ee-89cb650b3349@csgroup.eu> <9b4ce664-3ddb-4789-9d5d-8824f9089c48@csgroup.eu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9b4ce664-3ddb-4789-9d5d-8824f9089c48@csgroup.eu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_022906_666437_2A6563D5 X-CRM114-Status: GOOD ( 33.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 27, 2024 at 06:47:38AM +0000, Christophe Leroy wrote: > = > = > Le 27/02/2024 =E0 00:48, Guenter Roeck a =E9crit=A0: > > On 2/26/24 15:17, Charlie Jenkins wrote: > >> On Mon, Feb 26, 2024 at 10:33:56PM +0000, David Laight wrote: > >>> ... > >>>> I think you misunderstand. "NET_IP_ALIGN offset is what the kernel > >>>> defines to be supported" is a gross misinterpretation. It is not > >>>> "defined to be supported" at all. It is the _preferred_ alignment > >>>> nothing more, nothing less. > >> > >> This distinction is arbitrary in practice, but I am open to being prov= en > >> wrong if you have data to back up this statement. If the driver chooses > >> to not follow this, then the driver might not work. ARM defines the > >> NET_IP_ALIGN to be 2 to pad out the header to be on the supported > >> alignment. If the driver chooses to pad with one byte instead of 2 > >> bytes, the driver may fail to work as the CPU may stall after the > >> misaligned access. > >> > >>> > >>> I'm sure I've seen code that would realign IP headers to a 4 byte > >>> boundary before processing them - but that might not have been in > >>> Linux. > >>> > >>> I'm also sure there are cpu which will fault double length misaligned > >>> memory transfers - which might be used to marginally speed up code. > >>> Assuming more than 4 byte alignment for the IP header is likely > >>> 'wishful thinking'. > >>> > >>> There is plenty of ethernet hardware that can only write frames > >>> to even boundaries and plenty of cpu that fault misaligned accesses. > >>> There are even cases of both on the same silicon die. > >>> > >>> You also pretty much never want a fault handler to fixup misaligned > >>> ethernet frames (or really anything else for that matter). > >>> It is always going to be better to check in the code itself. > >>> > >>> x86 has just made people 'sloppy' :-) > >>> > >>> =A0=A0=A0=A0David > >>> > >>> - > >>> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, = > >>> MK1 1PT, UK > >>> Registration No: 1397386 (Wales) > >>> > >> > >> If somebody has a solution they deem to be better, I am happy to change > >> this test case. Otherwise, I would appreciate a maintainer resolving > >> this discussion and apply this fix. > >> > > Agreed. > > = > > I do have a couple of patches which add explicit unaligned tests as wel= l as > > corner case tests (which are intended to trigger as many carry overflows > > as possible). Once I get those working reliably, I'll be happy to submit > > them as additional tests. > > = > = > The functions definitely have to work at least with and without VLAN, = > which means the alignment cannot be greater than 4 bytes. That's also = > the outcome of the discussion. Thanks for completely ignoring what I've said. No. The alignment ends up being commonly 2 bytes. As I've said several times, network drivers do _not_ have to respect NET_IP_ALIGN. There are 32-bit ARM drivers which have a DMA engine in them which can only DMA to a 32-bit aligned address. This means that the start of the ethernet header is placed at a 32-bit aligned address making the IP header misaligned to 32-bit. I don't see what is so difficult to understand about this... but it seems that my comments on this are being ignored time and time again, and I can only think that those who are ignoring my comments have some alterior motive here. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel