public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: 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>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Arnd Bergmann <arnd@arndb.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-kernel@vger.kernel.org,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: Re: [PATCH v11] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests
Date: Fri, 1 Mar 2024 10:58:11 -0800	[thread overview]
Message-ID: <ZeIlQ+suWjH3f3UZ@ghost> (raw)
In-Reply-To: <62b69aaf-7633-4bd8-aefe-5ba47147dba7@roeck-us.net>

On Fri, Mar 01, 2024 at 10:32:36AM -0800, Guenter Roeck wrote:
> On 2/29/24 14:46, Charlie Jenkins wrote:
> > 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.
> > 
> > Furthermore, all architectures except the m68k pad "struct
> > csum_ipv6_magic_data" to 44 bytes. To make compatible with the m68k,
> > manually pad this structure to 44 bytes.
> > 
> > Fixes: 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum")
> > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
> > ---
> > The ip_fast_csum and csum_ipv6_magic tests did not work on all
> > architectures due to differences in misaligned access support.
> > Fix those issues by changing endianness of data and aligning the data.
> > 
> > This patch relies upon a patch from Christophe:
> > 
> > [PATCH net] kunit: Fix again checksum tests on big endian CPUs
> > 
> 
> Various test results:
> 
> On v6.8-rc6-120-g87adedeba51a (current mainline), without this patch
> 
> - mps2-an385:mps2_defconfig crashes in IPv6 checksum tests
> - ipv6 checksum tests fail on parisc, parisc64, sh, and sheb.
> 
> The previously seen problems on big endian systems are still seen with
> v6.8-rc6, but are gone after commit 3d6423ef8d51 ("kunit: Fix again
> checksum tests on big endian CPUs") has been applied upstream. This includes
> the test failures seen with m68k.
> 
> The parisc/parisc64 test failures are independent of this patch. Fixes are
> available in linux-next and pending in qemu. The sh/sheb failures are due
> to upstream commit cadc4e1a2b4 and are no longer seen after reverting that
> patch.
> 
> This leaves the mps2-an385:mps2_defconfig crash, which is avoided by this patch.
> My understanding, which may be wrong, is that arm images with thumb instructions
> do not support unaligned accesses (maybe I should say do not support unaligned
> accesses with the mps2-an385 qemu emulation; I did not test with real hardware,
> after all).
> 
> Given all that, the continued discussion around the subject, and the lack
> of agreement if unaligned accesses should be tested or not, I don't really
> see a path forward for this patch. The remaining known problem is arm with
> thumb instructions. I don't think that is going to be fixed. I suspect that
> no one but me even tries to run that code (or any arm:nommu images, for that
> matter). I'd suggest to drop this patch, and I'll stop testing IP checksum
> generation for mps2-an385:mps2_defconfig.
> 
> Sorry for all the noise this has generated.
> 
> Thanks,
> Guenter

If that's what people want. I still don't understand why there is any
problem with relying on NET_IP_ALIGN as that seems like that macro was
defined to create an expected alignment.

It would be nice to use the struct csum_ipv6_magic_data instead of doing
manual alignment and restricting len to 16 bits. I can send a patch that
only covers that if people are interested.

This was my first foray into writing generic test cases and it drew a
significant amount of criticism. I appreciate Guenter's efforts to make
the tests have more expected behavior across all supported platforms,
but the community obviously doesn't agree that is a reasonable goal.
Makes my life easier though, because then I can just not upstream test
cases and focus on feature work...

- Charlie

> 

  reply	other threads:[~2024-03-01 18:58 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 [this message]
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

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=ZeIlQ+suWjH3f3UZ@ghost \
    --to=charlie@rivosinc.com \
    --cc=David.Laight@aculab.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.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