Re: [PATCH v11] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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@xxxxxxxxxxxx>
> > Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > Acked-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
> > ---
> > 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


[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux