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 7B7C9C54798 for ; Wed, 28 Feb 2024 00:21:51 +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=3fb5djappnfKKPWMENMT+ZSNbuj40K9VjPrCmhHzClQ=; b=d5d/eo+G++Ce6E dDAvZUjbDMmVPWWMV70WDaYq7Y9xu5kCXJA01beDCuIZZFfvD0ySDYFVW5WxN/LHg7MEL1Xk9ZW2e Ec6vnRq7Jsmhb53aiHW66PaBLp9dK3tJy7BsZ5XSduTvmtsOJ0+FI3IKwaFCyE1YjNgMAPAdPr9aR 1YeD9qz1N+kI0FgLMn9mYA5w/lTVLdJFU1zPsLb12BABM22Zc6Vb8yhbWIPxHlzFkwoTiT1JZWdkg J0GGiXgOsB8wPZdae0Ju/Su/5s9JkfIhnSNIsGF/x+hMj47KHYZcbKebNzkrod/+oJh508jRPl0dn e8CuZ7AbV9XMB46i8TRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf7hd-00000007Ndw-1Zi8; Wed, 28 Feb 2024 00:21:41 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf7ha-00000007NdK-0T1X for linux-arm-kernel@lists.infradead.org; Wed, 28 Feb 2024 00:21:40 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1dcafff3c50so19532265ad.0 for ; Tue, 27 Feb 2024 16:21:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1709079697; x=1709684497; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=PeW62lD1HbXZTDjdIl3PrIGd38WT41hWRPPZB4yHjx4=; b=HNcc1WKk//BbuMvucWgPicy2IGpwEuqNxlN4NzslMAm1FmDKCqR8gFwE4rGEbd8PLY tNUnmcEKZqDD2kX9KLjclTrKt5uvCCiHFaJDfpUreXHsdjBwm+mDmfZ79M7fCofIvDsD ksO4XsKdta4Px6W7s4sB7iQx/iI7pTEjUHna2+G5NcX8RTceG1lvMuc66fMrreW3tu6j uqrPmuVYynrCWt5dqO5GzjWpBEWiOLZXzJRvwLWnIo5/VaMmAz0Uyh1Ej3z1O4GkXDYf QxjZU4Mmgb2DtCt1pKsjxhJrxfs+auglH8LX4YvTs5WrYU8Rfv8MB6WdDefMjO9S+XzF ZHHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709079697; x=1709684497; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PeW62lD1HbXZTDjdIl3PrIGd38WT41hWRPPZB4yHjx4=; b=tiCH21clB45ALMGLCWstwuEiVmeVhYbMQgkmN1BSBQxa0baIyF7F/xfgSbisnsOpVq 7OUEX6rfjvXZrddtcYNT28QwEcGPwJQYRX+ZtSKty2LgadzlQV4i5GT8K9w6QVsHvGQC RA2esH0M2JUSZLWG9qWZGj0hW7LgDMSmYvwORxZQMPetr5/vTyBzAcNlesGaWASns/4r HbO6FTaF8PE1opBbyUbulOTxnH5+HjZUKheabeC0Y//4fbEWudefk/L53+O2OpXoBQkC 31oBSDXN6eEJuIOacnE2wL+d+V0bckfanGIEwPqynz3c73xVr9AzUnB0rrhMXRT5UU7z Ffcw== X-Forwarded-Encrypted: i=1; AJvYcCUoaD5cBb8fi+wQKygbwtxjPOiwLY4JeeWTcHwRxoym5MhgrNATVPvMHEQ6zt5FPkIBvc4LUQ1vPFHzUEGcrgl5j46tSrQ9m+em+N4j+rfv2ZrefqU= X-Gm-Message-State: AOJu0Yy4C6AuviGesjgYXDYJ7j3doHGdiAO+9v/InuJIG1mEju8l6flQ Clh+4R5C7ZIVhELP4FrIiiAoLS5x+2bfsDQTNnq++5pQoNLVZGDlq8DJGXAG/hM= X-Google-Smtp-Source: AGHT+IE8o9Rp+lbcfhjYaSP1dtgN80cS98Hloq7Zy1IPFODlR1CtDAZKxgLbRePODf9CvxcoTuoJbQ== X-Received: by 2002:a17:903:1106:b0:1db:930e:e755 with SMTP id n6-20020a170903110600b001db930ee755mr16779201plh.35.1709079697022; Tue, 27 Feb 2024 16:21:37 -0800 (PST) Received: from ghost ([50.213.54.97]) by smtp.gmail.com with ESMTPSA id mm3-20020a1709030a0300b001db8145a1a2sm2102634plb.274.2024.02.27.16.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 16:21:36 -0800 (PST) Date: Tue, 27 Feb 2024 16:21:34 -0800 From: Charlie Jenkins To: "Russell King (Oracle)" Cc: Christophe Leroy , Guenter Roeck , 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: <7ae930a7-3b10-4470-94ee-89cb650b3349@csgroup.eu> <9b4ce664-3ddb-4789-9d5d-8824f9089c48@csgroup.eu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_162138_398586_35234C09 X-CRM114-Status: GOOD ( 46.78 ) 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 10:28:45AM +0000, Russell King (Oracle) wrote: > 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 pr= oven > > >> wrong if you have data to back up this statement. If the driver choo= ses > > >> 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 misalign= ed > > >>> 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 Keyne= s, = > > >>> MK1 1PT, UK > > >>> Registration No: 1397386 (Wales) > > >>> > > >> > > >> If somebody has a solution they deem to be better, I am happy to cha= nge > > >> 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 w= ell as > > > corner case tests (which are intended to trigger as many carry overfl= ows > > > as possible). Once I get those working reliably, I'll be happy to sub= mit > > > 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! I don't understand how the capabilities of some ARM drivers factor in here. It appears that a common case for calling this function is to pass in an IP header that is aligned along an ethernet header + NET_IP_ALIGN. It is perfectly acceptable that some drivers don't align along NET_IP_ALIGN, but that does not seem relevant here. This test case is supposed to be as true to the "general case" as possible, so I have aligned the data along 14 + NET_IP_ALIGN. On ARM this will be a 16-byte boundary since NET_IP_ALIGN is 2. A driver that does not follow this may not be appropriately tested by this test case, but anyone is welcome to submit additional test cases that address this additional alignment concern. - Charlie _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel