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 051FFC54798 for ; Tue, 27 Feb 2024 18:21:52 +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=Tb9+DQSiFpg1qWJaX/A/6nANxJ4I/mn7AkmTjeeacn0=; b=UEprGnJv1e2Gx3 JoIgQEcL2KDCDq2m/6PNxfrEr78zj+tZPVQjry5vB2SefdDqDHWd8e33WPy6ZRjr57ny3QMEVf39U C+uDamhCwSOKO488YFzNjlV7oije2Dtk3XF+z3tkiq5GRNmvOIbVFAn1Pgs03Wb0mI/gMRWC3nasd UZM0SW/43t48L82mcnqD9S+MhnRLEY6hjpKwrnp5NYUT+xmCU6BO+FmvYMbVhhoVZhvr6LtmpPR2E WO6JyH0nQlXc51DErqu+SxySdGpBLjEzSvGp38UlIwNewoEGO2XQ9qTiVAgrQAOzCZwF5bLOPG9+U /i+ofX9hIl01MvL6RAjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf25H-00000006QKg-1gl2; Tue, 27 Feb 2024 18:21:43 +0000 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf25F-00000006QIv-0Fia for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 18:21:42 +0000 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6e49a5b1bbfso1645523a34.3 for ; Tue, 27 Feb 2024 10:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1709058100; x=1709662900; 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=g+hXgGvfIukYiuX7oT5dD0w+P1l7ILZfgg3s4jt5+V8=; b=BU0F6eVZCF3piBGA0JAcksYBq/8yBhgDTGm20VpmQO7yCpayxnOk27LWeyHPuwgB+g KfMR6MXHbgb2r6Gavmiz/GEqVSgJokLbbIJinzVPMrqG6iyyz/r2N744AjnNDqNWx+Ya onc0w3xRDDgHmTuMoNoN/oRUSynWA6T1s7nftI3c7bEfR8Pt5FRZsql6AkfUVRScWxRd GE2bwdrnqD1B3BDq4iDRub8zsr6tI0T6+zsVFLBhxVSc6iQify5rRbn7gWL8XfXnUiJo Egk1G5jwGIzPqcePWYt0D88SzIY1cLK12t+myQiopxwK7rsd3eRmvvOH31WnUjwKovka xETQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709058100; x=1709662900; 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=g+hXgGvfIukYiuX7oT5dD0w+P1l7ILZfgg3s4jt5+V8=; b=PFPQrZcunUkuKHPo0aUazrOdNZ2DVO4DnaUYFhW3hdPdiVW7FZnkuewUJzNN5QSWBC 7ANv12WRvT7wMt6KN7P8w6V9x6/QTBnBYgLlYewV6Ce5Fucyjk5BVtuQTdApQmD6uBSD NDaXn2de+leKwhUwGPKNZGQ/qRx2VjBXXmpvDt6yzqHmnIuCW3X7xklAZMMai1BWstSE eZquyydSGnPVFl1iEtQYsQ+jyOQnx2NwraYlIJrtjMHNmvwFJTF7M/og6rb0ZDN5os9O cYl2VGfv+Pn7BizyEE/Fe8xpL2ZG5799YBkdPo8LxSwKxKf4KrGjBEm7e+lqy5F2+veZ vS3g== X-Forwarded-Encrypted: i=1; AJvYcCVlO6OOLuw6qN+8EP8QGkMRpGT539MBl0DmGZRHxa43mGzLRgNCr6wS8UnuXHexv58siNoyVF3Ip0MmT4K/FNNZHYh9tExOM3w6hxGn3GsndjK9vJs= X-Gm-Message-State: AOJu0Yy/O8X1GW+tqjK/bYW4wvKbVn0zOLlG4rRr4sA2Mcz8cX4dsQGs W5CUbS1ZCKjsVjV67Lm77flY6lIyPuiwYQHQ6MTZePQe3hQqRxuyW25qlVNWTm8= X-Google-Smtp-Source: AGHT+IHy19BdiOqGtWa+05trywiGWkBCZLJJtn9eoBSJIKrRk807vnyKQQxY04Gjxamk5BorZ1zOVA== X-Received: by 2002:a05:6830:11c5:b0:6e4:909a:9848 with SMTP id v5-20020a05683011c500b006e4909a9848mr11283491otq.2.1709058099747; Tue, 27 Feb 2024 10:21:39 -0800 (PST) Received: from ghost ([2600:1010:b010:c64b:16cb:453c:679d:bee6]) by smtp.gmail.com with ESMTPSA id i23-20020a631317000000b005ce472f2d0fsm6072238pgl.66.2024.02.27.10.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:21:39 -0800 (PST) Date: Tue, 27 Feb 2024 10:21:34 -0800 From: Charlie Jenkins To: Christophe Leroy Cc: "Russell King (Oracle)" , 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: <9b4ce664-3ddb-4789-9d5d-8824f9089c48@csgroup.eu> <9f756413-806c-4cd0-a6cf-8dd82af14e88@csgroup.eu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9f756413-806c-4cd0-a6cf-8dd82af14e88@csgroup.eu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_102141_141350_7F9BF67B X-CRM114-Status: GOOD ( 49.53 ) 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:11:24PM +0000, Christophe Leroy wrote: > = > = > Le 27/02/2024 =E0 18:54, Charlie Jenkins a =E9crit=A0: > > On Tue, Feb 27, 2024 at 11:32:19AM +0000, Christophe Leroy wrote: > >> > >> > >> Le 27/02/2024 =E0 11:28, Russell King (Oracle) a =E9crit=A0: > >>> 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 kern= el > >>>>>>>> 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 = proven > >>>>>> wrong if you have data to back up this statement. If the driver ch= ooses > >>>>>> 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 misali= gned > >>>>>>> memory transfers - which might be used to marginally speed up cod= e. > >>>>>>> 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 access= es. > >>>>>>> There are even cases of both on the same silicon die. > >>>>>>> > >>>>>>> You also pretty much never want a fault handler to fixup misalign= ed > >>>>>>> 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 Key= nes, > >>>>>>> MK1 1PT, UK > >>>>>>> Registration No: 1397386 (Wales) > >>>>>>> > >>>>>> > >>>>>> If somebody has a solution they deem to be better, I am happy to c= hange > >>>>>> this test case. Otherwise, I would appreciate a maintainer resolvi= ng > >>>>>> this discussion and apply this fix. > >>>>>> > >>>>> Agreed. > >>>>> > >>>>> I do have a couple of patches which add explicit unaligned tests as= well as > >>>>> corner case tests (which are intended to trigger as many carry over= flows > >>>>> as possible). Once I get those working reliably, I'll be happy to s= ubmit > >>>>> 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. > >>> > >> > >> I'm sorry for this misunderstanding. I'm not ignoring what you said at > >> all. I understood that ARM is able to handle unaligned accesses with > >> some exception handlers at worst case and that DMA constraints may lead > >> to the IP header beeing on a 2 bytes alignment only. > >> > >> However I also understood from others that some architectures can't > >> handle such a 2 bytes only alignments. > >> > >> It's been suggested during the discussion that alignment tests should = be > >> added later in a follow-up patch. So for the time being I'm trying to > >> find a compromise and get the existing tests working on all platforms > >> but with a smaller alignment than the 16-bytes alignment brought by > >> Charlie's v10 patch. And a 4 bytes alignment seemed to me to be a good > >> compromise for this fix. The idea is also to make the fix as minimal as > >> possible, unlike Charlie's patch that is churning up the tests quite > >> heavily. > > = > > Do you have a list of platforms this is failing on? I haven't seen any > > reports that haven't been fixed. > = > I don't have such a list, but I guess you do ? If all platforms have = > already been fixed, why are you sending this patch at all ? This patch is what is doing the "fixing". Over the course of 10 versions I have "fixed" the test cases to work on platforms that have various alignment and endianness constraints. The endianness changes were picked off of these patches and spun out into a different patch by you. = I originally introduced these two new test cases since I wrote the riscv checksum function implementations and these tests were helpful for me and I figured they may be helpful for somebody else too. - Charlie > = > Christophe _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel