"test_ip_fast_csum: ASSERTION FAILED at lib/checksum_kunit.c:589" at boot with CONFIG_CHECKSUM_KUNIT=y enabled on a Talos II, kernel 6.8-rc5

Christophe Leroy christophe.leroy at csgroup.eu
Fri Feb 23 17:58:14 AEDT 2024



Le 23/02/2024 à 07:12, Charlie Jenkins a écrit :
> On Fri, Feb 23, 2024 at 05:59:07AM +0000, Christophe Leroy wrote:
>> Hi Erhard, hi Charlie,
>>
>> Le 23/02/2024 à 02:26, Erhard Furtner a écrit :
>>> Greetings!
>>>
>>> Looks like my Talos II (running a BE kernel+system) fails some of the kernels internal unit tests. One of the failing tests is checksum_kunit, enabled via CONFIG_CHECKSUM_KUNIT=y:
>>>
>>> [...]
>>>      KTAP version 1
>>>       # Subtest: checksum
>>>       # module: checksum_kunit
>>>       1..5
>>> entry-flush: disabled on command line.
>>>       ok 1 test_csum_fixed_random_inputs
>>>       ok 2 test_csum_all_carry_inputs
>>>       ok 3 test_csum_no_carry_inputs
>>>       # test_ip_fast_csum: ASSERTION FAILED at lib/checksum_kunit.c:589
>>>       Expected ( u64)expected == ( u64)csum_result, but
>>>           ( u64)expected == 55939 (0xda83)
>>>           ( u64)csum_result == 33754 (0x83da)
>>>       not ok 4 test_ip_fast_csum
>>>       # test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:617
>>>       Expected ( u64)expected_csum_ipv6_magic[i] == ( u64)csum_ipv6_magic(saddr, daddr, len, proto, csum), but
>>>           ( u64)expected_csum_ipv6_magic[i] == 6356 (0x18d4)
>>>           ( u64)csum_ipv6_magic(saddr, daddr, len, proto, csum) == 43586 (0xaa42)
>>>       not ok 5 test_csum_ipv6_magic
>>> # checksum: pass:3 fail:2 skip:0 total:5
>>> # Totals: pass:3 fail:2 skip:0 total:5
>>> not ok 4 checksum
>>> [...]
>>>
>>> Full dmesg + kernel .config attached.
>>
>> Looks like the same problem as the one I fixed with commit b38460bc463c
>> ("kunit: Fix checksum tests on big endian CPUs")
>>
>> The new tests implemented through commit 6f4c45cbcb00 ("kunit: Add tests
>> for csum_ipv6_magic and ip_fast_csum") create a lot of type issues as
>> reported by sparse when built with C=2 (see below).
>>
>> Once those issues are fixed, it should work.
>>
>> Charlie, can you provide a fix ?
>>
>> Thanks,
>> Christophe
> 
> The "lib: checksum: Fix issues with checksum tests" patch should fix all of these issues [1].
> 
> [1] https://lore.kernel.org/all/20240221-fix_sparse_errors_checksum_tests-v9-1-bff4d73ab9d1@rivosinc.com/T/#m189783a9b2a7d12e3c34c4a412e65408658db2c9

It doesn't fix the issues, I still get the following with your patch 1/2 
applied:

[    6.893141] KTAP version 1
[    6.896118] 1..1
[    6.897764]     KTAP version 1
[    6.900800]     # Subtest: checksum
[    6.904518]     # module: checksum_kunit
[    6.904601]     1..5
[    7.139784]     ok 1 test_csum_fixed_random_inputs
[    7.590056]     ok 2 test_csum_all_carry_inputs
[    8.064415]     ok 3 test_csum_no_carry_inputs
[    8.070065]     # test_ip_fast_csum: ASSERTION FAILED at 
lib/checksum_kunit.c:589
[    8.070065]     Expected ( u64)expected == ( u64)csum_result, but
[    8.070065]         ( u64)expected == 55939 (0xda83)
[    8.070065]         ( u64)csum_result == 33754 (0x83da)
[    8.075836]     not ok 4 test_ip_fast_csum
[    8.101039]     # test_csum_ipv6_magic: ASSERTION FAILED at 
lib/checksum_kunit.c:617
[    8.101039]     Expected ( u64)( __sum16)expected_csum_ipv6_magic[i] 
== ( u64)csum_ipv6_magic(saddr, daddr, len, proto, ( __wsum)csum), but
[    8.101039]         ( u64)( __sum16)expected_csum_ipv6_magic[i] == 
6356 (0x18d4)
[    8.101039]         ( u64)csum_ipv6_magic(saddr, daddr, len, proto, ( 
__wsum)csum) == 43586 (0xaa42)
[    8.106446]     not ok 5 test_csum_ipv6_magic
[    8.143829] # checksum: pass:3 fail:2 skip:0 total:5
[    8.148334] # Totals: pass:3 fail:2 skip:0 total:5
[    8.153173] not ok 1 checksum

All your patch does is to hide the sparse warnings. But forcing a cast 
doesn't fix byte orders.

Please have a look at commit b38460bc463c ("kunit: Fix checksum tests on 
big endian CPUs"), there are helpers to put checksums in the correct 
byte order.

Christophe


More information about the Linuxppc-dev mailing list