public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnd Bergmann' <arnd@arndb.de>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Guenter Roeck <linux@roeck-us.net>,
	"Russell King" <linux@armlinux.org.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	Charlie Jenkins <charlie@rivosinc.com>,
	"James E . J . Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>,
	Palmer Dabbelt <palmer@rivosinc.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Parisc List" <linux-parisc@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH v11] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests
Date: Tue, 5 Mar 2024 09:27:22 +0000	[thread overview]
Message-ID: <55a6df07d26849e89c839f80ca5996b9@AcuMS.aculab.com> (raw)
In-Reply-To: <a254a52c-340d-47ba-9a69-b5144dc75e4e@app.fastmail.com>

From: Arnd Bergmann
> Sent: 04 March 2024 13:40
...
> > If not, then the test has to be fixed to only use word-aligned IPv6
> > addresses.
> 
> Because of the gcc issue I mentioned, net/ipv6/ip6_checksum.c
> and anything else that accesses misaligned ipv6 headers may need
> to be changed as well. Marking in6_addr as '__packed __aligned(2)'
> should be sufficient for that. This will prevent gcc from issuing
> ldm or ldrd on ARMv6+ as well as making optimization based on
> the two lower bits of the address being zero on x86 and others.

Eh? x86 pretty much doesn't care unless you are using AVX.

> The downside is that it forces 16-bit loads and stores to be
> used on architectures that don't have efficient unaligned
> access (armv5, alpha, mips, sparc and xtensa among others)
> even when the IP headers are fully aligned.

Aren't the later accesses to the header also going to fault?
IIRC there is an skb_pull() call to ensure all the IP header
is in the linear skb fragment?
Perhaps there should be an skb_pull_aligned() that will ensure
the data is 32bit aligned on systems where the misaligned accesses
fault?

There might still need to be something to stop gcc generating
ldm/ldrd which can fault on systems where a normal register
read wouldn't.

Do any recent arm cpu have the strongarm 'feature' than ldm
always took 16 clocks?

	David
 

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      reply	other threads:[~2024-03-05  9:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 22:46 [PATCH v11] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Charlie Jenkins
2024-03-01  7:17 ` Christophe Leroy
2024-03-01 17:09   ` Charlie Jenkins
2024-03-01 17:24     ` David Laight
2024-03-01 17:30       ` Charlie Jenkins
2024-03-01 18:32 ` Guenter Roeck
2024-03-01 18:58   ` Charlie Jenkins
2024-03-11 15:34     ` Christophe Leroy
2024-03-03 10:20   ` Christophe Leroy
2024-03-03 15:26     ` Guenter Roeck
2024-03-04 11:39       ` Christophe Leroy
2024-03-04 13:39         ` Arnd Bergmann
2024-03-05  9:27           ` David Laight [this message]

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=55a6df07d26849e89c839f80ca5996b9@AcuMS.aculab.com \
    --to=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=geert@linux-m68k.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --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