Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1460451rbb; Mon, 26 Feb 2024 09:56:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbMRPanhzqS7KqkrjWBXjf73MyTRGs7k+2+qyb64+uyIJKKxrulQVZhXmO+oEp6/tYkVL6fDrojro0hvd1uBe/kaOC0dpq5hmLUt9DcQ== X-Google-Smtp-Source: AGHT+IEsO0Pdu+93NhBuoqq5lnnn22wgJ4IjCBoG+GoSwDTZpiPrlriyue2l9/+aa4793bMY6Vrf X-Received: by 2002:a05:6870:1591:b0:21e:b315:ca47 with SMTP id j17-20020a056870159100b0021eb315ca47mr10376310oab.12.1708970160063; Mon, 26 Feb 2024 09:56:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708970160; cv=pass; d=google.com; s=arc-20160816; b=gd3G61jl4bMlA5UzF2q8ziGrk89Fpyx5T2GQJ5bIgmpZ1bK2DLepvRiQc0So8hv44H N+/eTZ3t4qNzbS4HqEFF9yuGSZkAiLBIjBq68RdgmB1iViVhQzmw7FPpqrsIlsZ/KyzD 3a6UjCrwEGyHpQpgnxyWwoWM6VskYb2qdxOhAoF3d64V1QMhv4fPnpwj9KgCeoSDJ5rk v2IxIdxeSiAgvy+DMwzzbI4OVovPS3TLCfGVvRO502mPT5hwoSFTs1NAxOCzIpJXT13q 3e5qsD0W/GQknr90iNWvOGCcVVeFTzwyuMMJoz4ligkME2fUOv4QljFCeCme/lFfftAY Y73A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DS/FPTlhqUV1Rbg7GjDt8wu7AR4Zgooi3ewXLgKys4c=; fh=sKejcycbJ5p32eobsL0/+1axn9/qjpQn+yd7dYVLIP8=; b=Q7V9Zuz2t8XKYjWzWqCfXFMSMksK1yvd/Hc72iqHZi4ffRTa6PzLi3gEHFtG6HQwQu 1Yhhtmzlos+GqO9uL143gXtLUCspAddQKJDkn4oKXHiPpOXowdZoVzcDOqmAp//uUbNQ olku6ds+M5Ufn6b10wR/VsbeR3UtAHlunb2A8v8QkehaDYU5fqHvLrNFGSOzf0KhR0mI pHTvxScQEMUE3ksv6AoN+X7hfBK9uElvMzdfGoQ/fhiyH/4tlcidsFltxEY3K0S+EtBl 0PzxDhPVTT4K0H3YWwuaC7gPK67Pk6pPduFOZLPPb3CWJZkysKuMbOBbwIUk1M8qtzHy Y+Fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uZZb1kEo; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-82104-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q10-20020a63f94a000000b005dc4fda246esi3983613pgk.615.2024.02.26.09.55.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:56:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82104-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uZZb1kEo; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-82104-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E913C295C2C for ; Mon, 26 Feb 2024 17:51:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58A1112E1CC; Mon, 26 Feb 2024 17:51:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="uZZb1kEo" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8053812F378; Mon, 26 Feb 2024 17:51:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708969877; cv=none; b=CHSGPIWa63nqMzxjvboor3tD9Q9CBU6f51Pz78jB1Gt+LeStsYaHyttX6DFH1v34kxyWfY2Exeu7nKpBjaP50ZsAeWGvfCxBExzRgsqTBJF/GBAw2kRyzCFz/CBv8NCXzkXhEC9s9EmvYFEDm495ilS8NRwpQgO2buxxN1/xGh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708969877; c=relaxed/simple; bh=qS8OT9weX4S2COy6j3APFrkuDaTbvAGT/4iWvd39c/E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Oqdhuj01A25H+7OVo8wlJ51JyXXeggCnvSgwGbemfc83XUHYjZC31xIy8i6owv7jQtPtgy9GJPUBjfuSUv/qqxuejLEQ3cRbWn/J9KEmbvEPWb17lpUopcIrALHjE0Ic7YVthnTSJTP9QJFJI1n6MBYs5qffmWQjC5YQlU8ZBA8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=uZZb1kEo; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk 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=DS/FPTlhqUV1Rbg7GjDt8wu7AR4Zgooi3ewXLgKys4c=; b=uZZb1kEoLX0PAJhCzRKUy1g8Uv SM+ZTC9ce6iXI97yEZwMtIvw5Lg3sO+8TwU/Yu8qkCLF1A+/VH/fSTtULAWPKnSCb+daQeBXzIyG6 8W1NEzzdisP4BLY3je4cSsZZO2YCORB9qBwKvUj8nIA60Y097T6ZwzAwoAfM89DWyDCCQ7jeO4gqh IXG/VZsGfdMjIN8I+ZpoYWgafqV2v0ukZQoO9cK1EOYfs4TBJDe29tRKB72oqoQIkZB+3dbtTFD8k SsPnkVQtYn4MFi5EgMUUpYmochutSB8T+EjoktzLSPzeHxbhESm3tNJU6WJ1FLIv2GybwO7+aRwFa 2lSAHhiQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35226) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ref81-0004XQ-0c; Mon, 26 Feb 2024 17:51:01 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ref7x-0006ci-SJ; Mon, 26 Feb 2024 17:50:57 +0000 Date: Mon, 26 Feb 2024 17:50:57 +0000 From: "Russell King (Oracle)" To: Guenter Roeck Cc: Christophe Leroy , 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) On Mon, Feb 26, 2024 at 08:44:29AM -0800, Guenter Roeck wrote: > On 2/26/24 03:34, Christophe Leroy wrote: > > > > > > Le 23/02/2024 ? 23:11, Charlie Jenkins a ?crit?: > > > The test cases for ip_fast_csum and csum_ipv6_magic were not properly > > > aligning the IP header, which were causing failures on architectures > > > that do not support misaligned accesses like some ARM platforms. To > > > solve this, align the data along (14 + NET_IP_ALIGN) bytes which is the > > > standard alignment of an IP header and must be supported by the > > > architecture. > > > > I'm still wondering what we are really trying to fix here. > > > > All other tests are explicitely testing that it works with any alignment. > > > > Shouldn't ip_fast_csum() and csum_ipv6_magic() work for any alignment as > > well ? I would expect it, I see no comment in arm code which explicits > > that assumption around those functions. > > > > Isn't the problem only the following line, because csum_offset is > > unaligned ? > > > > csum = *(__wsum *)(random_buf + i + csum_offset); > > > > Otherwise, if there really is an alignment issue for the IPv6 source or > > destination address, isn't it enough to perform a 32 bits alignment ? > > > > It isn't just arm. > > Question should be what alignments the functions are supposed to be able > to handle, not what they are optimized for. If byte and/or half word alignments > are expected to be supported, there is still architecture code which would > have to be fixed. Unaligned accesses are known to fail on hppa64/parisc64 > and on sh4, for example. If unaligned accesses are expected to be handled, > it would probably make sense to add a separate test case, though, to clarify > that the test fails due to alignment issues, not due to input parameters. It's network driver dependent. Most network drivers receive packets to the offset defined by NET_IP_ALIGN (which is normally 2) which has the effect of "mis-aligning" the ethernet header, but aligning the IP header. Whether drivers do that is up to drivers (and their capabilities). Some network drivers can not do this kind of alignment, so there are cases where the received packets aren't offset by two bytes, leading to the IP header being aligned to an odd 16-bit word rather than an even 16-bit word (and thus 32-bit aligned.) Then you have the possibility of other headers between the ethernet and IP header - not only things like VLANs, but also possibly DSA headers (for switches) and how big those are. There's a lot to be researched here! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!