linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Charlie Jenkins <charlie@rivosinc.com>,
	Guenter Roeck <linux@roeck-us.net>,
	David Laight <David.Laight@aculab.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Parisc List <linux-parisc@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Palmer Dabbelt <palmer@rivosinc.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v10] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests
Date: Mon, 26 Feb 2024 12:03:47 +0000	[thread overview]
Message-ID: <Zdx+I3V9ka3EbaHq@shell.armlinux.org.uk> (raw)
In-Reply-To: <96b3fcfd-6932-4987-9831-5abdad8d445c@csgroup.eu>

On Mon, Feb 26, 2024 at 11:57:24AM +0000, Christophe Leroy wrote:
> 
> 
> Le 26/02/2024 à 12:47, Russell King (Oracle) a écrit :
> > On Mon, Feb 26, 2024 at 11:34:51AM +0000, 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.
> > 
> > No, these functions are explicitly *not* designed to be used with any
> > alignment. They are for 16-bit alignment only.
> > 
> > I'm not sure where the idea that "any alignment" has come from, but it's
> > never been the case AFAIK that we've supported that - or if we do now,
> > that's something which has crept in under the radar.
> > 
> 
> Ok, 16-bit is fine for me, then there is no need to require a (14 + 
> NET_IP_ALIGN) ie a 16-bytes (128-bit) alignment as this patch is doing.

Looking again at these two functions, I'm mistaken - this was written for
optimal use with 32-bit alignment, not 16-bit. However, the entire IP
layer is written with the assumption that for maximum performance, the IP
header will be 32-bit aligned.

However, that may not always be the case for incoming packets, and what
saves 32-bit Arm is the ability to do unaligned loads in later revisions
of the architecture, or the alignment fault handler (slow) on older
revisions.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-02-26 12:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240223-fix_sparse_errors_checksum_tests-v10-1-b6a45914b7d8@rivosinc.com>
2024-02-26 11:34 ` [PATCH v10] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Christophe Leroy
2024-02-26 11:47   ` Russell King (Oracle)
2024-02-26 11:57     ` Christophe Leroy
2024-02-26 12:03       ` Russell King (Oracle) [this message]
2024-02-26 16:44   ` Guenter Roeck
2024-02-26 17:50     ` Russell King (Oracle)
2024-02-26 18:35       ` Charlie Jenkins
2024-02-26 19:06         ` Russell King (Oracle)
2024-02-26 19:19           ` Charlie Jenkins
2024-02-26 22:33           ` David Laight
2024-02-26 23:17             ` Charlie Jenkins
2024-02-26 23:48               ` Guenter Roeck
2024-02-27  6:47                 ` Christophe Leroy
2024-02-27 10:28                   ` Russell King (Oracle)
2024-02-27 11:32                     ` Christophe Leroy
2024-02-27 17:54                       ` Charlie Jenkins
2024-02-27 18:11                         ` Christophe Leroy
2024-02-27 18:21                           ` Charlie Jenkins
2024-02-27 18:35                             ` Christophe Leroy
2024-02-27 19:04                               ` Charlie Jenkins
2024-02-27 19:31                         ` Guenter Roeck
2024-02-27 22:44                           ` David Laight
2024-02-28  5:19                             ` Guenter Roeck
2024-02-28  0:24                           ` Charlie Jenkins
2024-02-28  0:21                     ` Charlie Jenkins
2024-02-28  7:25                       ` Christophe Leroy
2024-02-28  7:59                         ` Guenter Roeck
2024-02-28 10:15                           ` Geert Uytterhoeven
2024-02-28 15:40                             ` Guenter Roeck
2024-02-29  8:07                               ` David Gow
2024-02-29 19:38                               ` Charlie Jenkins
2024-02-29 20:22                                 ` Guenter Roeck
2024-03-01  7:00                           ` Christophe Leroy
2024-03-01  6:46     ` Christophe Leroy
2024-03-01 16:24       ` Guenter Roeck
2024-03-01 20:47         ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zdx+I3V9ka3EbaHq@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=David.Laight@aculab.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=charlie@rivosinc.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=deller@gmx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=palmer@dabbelt.com \
    --cc=palmer@rivosinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).