Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1602706rbb; Mon, 26 Feb 2024 15:17:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0Xn2/wJnigEb4mCmyZWwiOPmSUP/JA5/CDrP9ZTxI4vHj5BBA2SXeIjEhVzlfDcCAJNrEAhK7q77O/r00f2ngTZi25zYfsw9/5O4VPw== X-Google-Smtp-Source: AGHT+IHEd4EUYs0sxv9yMq175blaISeTQDKGEAJAzLc7HrTZYr+7SU14/PvesnDY5jYEBFo5hOoB X-Received: by 2002:a17:90a:bd0a:b0:299:3ebf:d180 with SMTP id y10-20020a17090abd0a00b002993ebfd180mr6730022pjr.6.1708989437813; Mon, 26 Feb 2024 15:17:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708989437; cv=pass; d=google.com; s=arc-20160816; b=aMscuzVg2gaDvZYT1eK0czAHDf4g/5mOk7EZGqX2XKsaDKfFIqpAqRDxMrMiswNrHW 8X1Rn1kanK1sW+3Zk7ghObP0tlAr+Ii0DbH2BF2kAcJ6uRmpHiZzY763VSTaKgiPJFC6 RJUQKO/XvD+tveL6oOr6aCr19G1OgSAUva1fpxKClvrIvtW5iWJMW3LmzpYDV5EFD05A y1GBh8/yF41PzxM8ddV5cG/wRjln/UWzmeBAZ74d0BAaUIOukTBOXlSeMMGozwqBlUA4 k6xtGlJ8rvqeX2rck/uReF0oXLpbhjTaLgN84ABfwMRaMtnBn4dStbL04Mb3AaSbPkY7 W2tw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eYuGQ7XfN8pbZjALsZ8f3cB3Gxf+yNkm9MR0bR+0+ps=; fh=RXJR+1zhbKLwS0ZvFP5MQU95qP1TBWHHTmOI5ZulfXA=; b=E6sFudKlXQkqHQ3z7kd4UZCl0Ip9DviYUsMpatg9yCd+M/EXv0FIUW7U8zUovXLB4z PPkvoY5ELHKzZtpogjcVbwSWypz1IG8CcwVSrpq3Ap99vi0UwksGD1T3R3enc5gUa42E 63Rc6w2sdozmiZte/56c83L3zp6nEXpcncrTeesIMmGphVhY8+SyT6KQKoTrxGN+N9KB HBKvM0Qg8y/EUG2tEw4i4X29gGODVUdZ2O2iEOg0Jl8UQquh8eExR3rVSJjE+voSOUEJ HIlcLA0TE7+tCEnXLB9T4bx5WikIySiqh4J+VgajY51Lq5VbPYElYdQiZWHKkANWIuHo fQvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=XhE7ozGm; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-82436-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82436-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x23-20020a17090a8a9700b00299738570a7si6166110pjn.89.2024.02.26.15.17.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 15:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82436-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=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=XhE7ozGm; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-82436-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82436-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5AF69285A7C for ; Mon, 26 Feb 2024 23:17:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D59A1350CF; Mon, 26 Feb 2024 23:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="XhE7ozGm" Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 2C02B133285 for ; Mon, 26 Feb 2024 23:17:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708989431; cv=none; b=UTbY4haBp7hnzlqryq32wNj7evUbms//EV8xI6aazJYPKFBJPPmsFEd0jT9jhp0f6znPwUj9gAlsYCckXhMpNyqR5fGUO55KnjGS8UZcqnZFY0nQdGwd4t6iVKI8+6NXCud9YOgSOF+w2YpinCv3bQ07amvIt97doP/E58IdIyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708989431; c=relaxed/simple; bh=qOuAEHrf8q5fX3cChhCFW8ymfxwHQRMOJI5lw870U9Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UkNuNaNe/VhWGLx+Y9IhBOZ7XUUEcg3Cwf4pb5F+d8DsGv+MK/aQYS6VgFtCe6M6kQTq72TEXuJsc2DcaxmeZglmwmY+bI8qqIwWGS6BVKUJwB6ZYoxVocTyXot3aZQGFC6j0JKbPrXNvlttH4HtoS1v+ivfeDAcpBKQKlvHRhs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=XhE7ozGm; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-299e4b352cdso2736626a91.0 for ; Mon, 26 Feb 2024 15:17:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1708989428; x=1709594228; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eYuGQ7XfN8pbZjALsZ8f3cB3Gxf+yNkm9MR0bR+0+ps=; b=XhE7ozGmwgq4SsoKlUkPgQeU4OlwwzJeDxtRLHJIeTkjqsSTZR8X8oWsjoxZGYR2EP lxevk7gdSVPVj443CIFp4e7GtL7fmxGcx0ryBFJTqGyPZDbTgW5MURwhI/VfTzMnYsPY RxosxKuAiHQG2hwoLtKKN/9aGls70OKXBnBFe7M5B4laF8m5ADMDc7c1Vr9lEJmwVLaE W2ump7RJsVdiqwoR0Tw3ZUZ0qE6IYUyn0AusAMewe44czOqKH6XuQFTLouBPsjAYGakt vG68RLwcQfcO06IywyM5rlzXogIDCGxASCHpyKagNVWer+uIDHcqbqRDfYm1zOx9B/v3 QQfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708989428; x=1709594228; h=in-reply-to: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=eYuGQ7XfN8pbZjALsZ8f3cB3Gxf+yNkm9MR0bR+0+ps=; b=cAkkW9miZ6V9O9GjDyK0e/A29w0Kq19qWUqPTAdDX7ZYLYxvVffZQPx66kzoFHPWDS ZSTNH9bOCCHYPXVw/IHH4usuj1ooOHtBQlhPbvLhVkNh6H0QSNEJIz3C/b6rkxh8KUQG MiVEsmsfHE9wl5sghYbdvul1wZd6/ll6v3yb/BAypkK91BzmBbY0f/F9Z8wQHu8GlHoL Y01NorZF8m6+zmqSrwEcb6zcJ7y56gSRmeoYNAdlTopCR4MQVzsVnQo9Q9xMrKvTVl2B D4CEFP5jvE+HTL9OI6qqu81/jhDHYKfzL5JAVD+imARvLAceghpBAgKqh0QQIDsPQWnz sHFw== X-Forwarded-Encrypted: i=1; AJvYcCVYxYQOA9gT9IdIJrsKCJkJDXLOzXKnl3QU1Ev3e1exRusbSArx/Z6zLZUh2D54+j4S5q106uXzzHVpa7oUOpKhMBBby0gGpWKV97OX X-Gm-Message-State: AOJu0Yw1OLClHF8ujjEcVKmH2sRI2L1QjCzPbKp8+sZ1H6XE8QDVjuEP 9hPqBIqxSyLCOsDb46QEDMwUxffFfsU6Hren7o7AYR/0Wzpp6KwBfxGYbS5suiM= X-Received: by 2002:a17:90a:68c8:b0:299:42d1:91df with SMTP id q8-20020a17090a68c800b0029942d191dfmr7094179pjj.14.1708989428406; Mon, 26 Feb 2024 15:17:08 -0800 (PST) Received: from ghost ([50.213.54.97]) by smtp.gmail.com with ESMTPSA id qa2-20020a17090b4fc200b0029ad1df1661sm1671155pjb.52.2024.02.26.15.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 15:17:07 -0800 (PST) Date: Mon, 26 Feb 2024 15:17:05 -0800 From: Charlie Jenkins To: David Laight Cc: 'Russell King' , Guenter Roeck , Christophe Leroy , 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=us-ascii Content-Disposition: inline In-Reply-To: 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 proven 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' :-) > > David > > - > 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. - Charlie