Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp120846rdb; Wed, 14 Feb 2024 15:03:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUTw3wfNU8AYfJCxIIZ/v7FIEU2Klvg6PBEirgLFFIXtapuOYzKH6n4UXVDHNR/E0eYT46jbg5M4BJkMGhDfF3sG58LNo+7bKlPojaiLA== X-Google-Smtp-Source: AGHT+IG74mzjJfp3BLYhQPwKxfC0/LZS56j18nSE6Bo5UFq0/oaMc2303jj0wdFP/eDl7tgw8MAb X-Received: by 2002:aa7:db4c:0:b0:55e:b942:aaab with SMTP id n12-20020aa7db4c000000b0055eb942aaabmr37048edt.23.1707951803040; Wed, 14 Feb 2024 15:03:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707951803; cv=pass; d=google.com; s=arc-20160816; b=U2KOaMyKEIQI44RyoAf4O1h3JkmMpPSjQwOk3zSYFdZA1csY8f6fFIH6vMXsFzvpHd uL+GhJByl450svcl3Ww/Pryk0Cfqe2tUDxropyM/5K2vX/CfI21b7gjZHJIMtxaDmurg hU4GTGiNfVNRDX2TQXc6xWwx45g45PD9h9M3L/gkz0tFXRGMtsxtNA2zeHcmsOOh/RJs +/tYlFpf4dz8594MftEDDykbZomKsOgufZLJythbh25GacjR0AFJOepHQ1aBQW5dCzdT N/fNl1/QcQ5juv6YrXy0ggK49zZPtNOcCCo9WtWKGQBv7/mLOKx1WMnX3VsblrfnoXS3 layQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=IULViN1YE3jnUbW2nwCagZ5usHptjYJ+ObRYjMrSkZQ=; fh=Bp0OOkEYSbpj4JhiLyIKb1JZvm2obR4kI2QGQtUUhKs=; b=qOClSN+fW5EWE0ETCeS/CjPjhPmGC2qG/+yRa1iY3cCImgRlzvoHdabu4sKxztrbkt Lh6Jsv/5AdiYaXJMJjexKIsSDibdiUrH46ZjSWRTOSfuIJY/LEXXzT1PGWE4cc/mi2lr EovnqhRhPULNWVrNuNAOJGY4ppLDONB78EHqYnYHx3lu0GVQZE8nR/718bekvRxcO0n9 qPxKq47Af838EfWPncPdWLS7K85jxZdzWzCJhulom+KJuHdAiZ2tgvBYEVbeCYewncEv 97C+Ag9LAe+onymYANBHgZ8TNm45QbUa0/0dfbnX8fpcD7yr+kZPS95YjcbjgJW8b5e+ biag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gHvL7Eje; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-66097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66097-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCV4ls6zQNwT1TOvIMrcvYwN2PK44dtj+7dZFL9vtYt8uPbYPxTNxd4NGaBXIeneEgxbsMrojQ/e93XY3OJEb9V/4KmRzfAukjwM0UzM4g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cm16-20020a0564020c9000b005639fec4f5asi256389edb.579.2024.02.14.15.03.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 15:03:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gHvL7Eje; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-66097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66097-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9299C1F22FF3 for ; Wed, 14 Feb 2024 23:03:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2516213F006; Wed, 14 Feb 2024 23:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gHvL7Eje" Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B09B128388; Wed, 14 Feb 2024 23:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707951792; cv=none; b=lG/edtT2Y+8QmeypVZBZ7SJvqN4fUcvmT+cqpNq1w2r1xju/DVVIPpKAtkhjDrB6VJKjMdj1HpQ3Ctt6r+kxG6mhrQkyKjFgC8UjdWeY0N452Xrs+pm8ufn2zrbyDQMAv5ufaXOz5Uq+oEKOpjCasN+gf/XnFaD6N28Kq6EK+/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707951792; c=relaxed/simple; bh=ykirw4cmA2+9ydHbNedf3+zryWiqyI2UNN0bE/4GBw0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ihr/24bsmw19gxnpm570nDMbBLntSqW0Q4/L8UF8XHpQ0mce4o7ijZeREJjzln/uQZLkTShRNyku3zFu6GLllU92fS3fd2oVJ2lh+SvaVLwQnRL5KnOgm4JKnGKuktSMtpduJrjL4mu9dI7FjzdlHe7M1toF4uTtYIGhtVsthzU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gHvL7Eje; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5d8b70b39efso267059a12.0; Wed, 14 Feb 2024 15:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707951790; x=1708556590; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=IULViN1YE3jnUbW2nwCagZ5usHptjYJ+ObRYjMrSkZQ=; b=gHvL7EjeOt+ADDdTMRlLJg8PDKz9ygoScwZtAyB3PtAX/HVDOTmFTDv6jKit3cVgcR VIZmOgkd0UrBRom6mPdT0tBVMgrNQYqaeUlYhqCe8kwkOXs5Dki/if4yodMUyZAsJfMQ 9kBo+TNK9ilKuS/PX39cUueaQtKUBTLqQHRJ7DkfKiE8asgSB4ANCDK7BmM0PwImcQ70 KyFXqDq2yQXyg+eHbIPdwNO/2UUkCaXqM/QOATjE61VexNC0u3KKVvszbMq6xs5GeXuN estpOy4nI6fNcqj/8Q5pNpD51KKKl/fN+9UpJe/k44+BxM7X8cIrwYz1ADdDUU7qK46p xOkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707951790; x=1708556590; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IULViN1YE3jnUbW2nwCagZ5usHptjYJ+ObRYjMrSkZQ=; b=rw22FGa7VenTVvdcXArifCfvm08TjK+dxOC1j6IVvXzedVCzkgMNZQb2V8EqKfPCYI H+tErTEkkgiQdp40BB9V+0xkHsEZwYKNLpNVBwhhBfgdJ7oH3IfnhzfEWB9LIFiYoRUP LYW+h8pXRWq9f7kR6jsSzETrAsCOI1Fd9z+dil7QZ4Ft6YY3b+3AyVrtMkJke96ItpcO 99+SfRutzFnYRiungZOYGhrFT85C7/XLbG95AHROli+nGkaNH7PJX8m/pkfrBRPs9xJF SpaCSAeACiyCcwMV+YlOMu2SCYOk1YjErLzDS96YLXg9FToX6YhUCaEqLcYzwDaxv/2V e/Ww== X-Forwarded-Encrypted: i=1; AJvYcCVreuo1CZqrPJi7JaF9i+2dKCUR5IXFVw9QrZ+SQM5k1OnEjDhl6iQkOFfAQzGQbDe+X39FdIRhTBsLvR/Z0DxxT4IO24M/60P3JLhf X-Gm-Message-State: AOJu0YykbjJGjS1RbE1em5G3gOeEoqH/C6QnY68A5QzDlB5B6ojIyhvN Une/Q0C/mQegMkx94BbLT0xSuFMgimZiCzhSdRup5KkF/81RxUsf X-Received: by 2002:a05:6a20:d38f:b0:1a0:6856:d1a9 with SMTP id iq15-20020a056a20d38f00b001a06856d1a9mr369641pzb.10.1707951789540; Wed, 14 Feb 2024 15:03:09 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUtFgpjvamH4s9HGKND8D1df2bUnh8D3uLtTDbl4NTB2QmoGQDv4jXjFAKFDUGI86nFBstfodeOVZsMO5ssIsnXDy1TRBUxGfXYNlL0a52DMYF45x0J701+nBtT5EvjCOILDfGLaqEz9zmYS2DgzY/9PCkb7BFPHAQB+iG7Yjq86oFIStFSziFLF9YfzQb/z6wAkgo71Q9SLzdWRkzzgtlgXitgvv2RACgIL7zRgKVXbysJLfQZ6VEvegu4KzrFdgFYyru3Tjxh1lH56sNKX3M2xE9Xk3/cwCMSheYI3q3vMdoVpw== Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id fd23-20020a056a002e9700b006e03cce3f4asm9914588pfb.25.2024.02.14.15.03.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 15:03:09 -0800 (PST) Sender: Guenter Roeck Message-ID: <2ec91b11-23c7-4beb-8cef-c68367c8f029@roeck-us.net> Date: Wed, 14 Feb 2024 15:03:07 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 2/2] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Content-Language: en-US To: Charlie Jenkins , David Laight , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Al Viro Cc: linux-kernel@vger.kernel.org References: <20240214-fix_sparse_errors_checksum_tests-v8-0-36b60e673593@rivosinc.com> <20240214-fix_sparse_errors_checksum_tests-v8-2-36b60e673593@rivosinc.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB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4PnbrVhjq861it/zRQW cFpWQszZyWRwNPWUUz7ejmm9lAwPbr8xWT4qMSA43VKQ7ZCeTQJ4TC8kjqtcbw41SjkjrcTG wF52zFO4bOWyovVAPncvV9eGA/vtnd3xEZXQiSt91kBSqK28yjxAqK/c3G6i7IX2rg6pzgqh hiH3/1qM2M/LSuqAv0Rwrt/k+pZXE+B4Ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <20240214-fix_sparse_errors_checksum_tests-v8-2-36b60e673593@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/14/24 13:41, Charlie Jenkins wrote: > The test cases for ip_fast_csum and csum_ipv6_magic were failing on a > variety of architectures that are big endian or do not support > misalgined accesses. Both of these test cases are changed to support big > and little endian architectures. > > The test for ip_fast_csum is changed to align the data along (14 + > NET_IP_ALIGN) bytes which is the alignment of an IP header. The test for > csum_ipv6_magic aligns the data using a struct. An extra padding field > is added to the struct to ensure that the size of the struct is the same > on all architectures (44 bytes). > > The test for csum_ipv6_magic somewhat arbitrarily aligned saddr and > daddr. This would fail on parisc64 due to the following code snippet in > arch/parisc/include/asm/checksum.h: > > add %4, %0, %0\n" > ldd,ma 8(%1), %6\n" > ldd,ma 8(%2), %7\n" > add,dc %5, %0, %0\n" > > The second add is expecting carry flags from the first add. Normally, > a double word load (ldd) does not modify the carry flags. However, > because saddr and daddr may be misaligned, ldd triggers a misalignment > trap that gets handled in arch/parisc/kernel/unaligned.c. This causes > many additional instructions to be executed between the two adds. This > can be easily solved by adding the carry into %0 before executing the > ldd. > I really think this is a bug either in the trap handler or in the hppa64 qemu emulation. Only unaligned ldd instructions affect (actually, unconditionally set) the carry flag. That doesn't happen with unaligned ldw instructions. It would be worthwhile tracking this down since there are lots of unaligned data accesses (8-byte accesses on 4-byte aligned addresses) when running the kernel in 64-bit mode. On the other side, I guess this is a different problem. Not sure though if that should even be mentioned here since that makes it sound as if it would be expected that such accesses impact the carry flag. > However, that is not necessary since ipv6 headers should always be > aligned on a 16-byte boundary on parisc since NET_IP_ALIGN is set to 2 > and the ethernet header size is 14. > > Architectures that set NET_IP_ALIGN to 0 must support misaligned saddr > and daddr, but that is not tested here. > > Fixes: 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum") > Signed-off-by: Charlie Jenkins I'll run this through my test system and let you know how it goes. It should be done in a couple of hours. Thanks, Guenter