Skip to content

Silence spurious warnings and crashes from kunit test suites

Jia He linux-fsdevel linux-kselftest linux-mm linux-perf-users lkml sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7init/initramfs_test: wait_for_initramfs() before runninginit/initramfs_test.c+16 -12 replies
2/7kfence: kunit: skip when no pool is availablemm/kfence/kfence_test.c+4 -21 reply
3/7lib/math/int_log: drop WARN_ON for value == 0lib/math/int_log.c+2 -60 replies
4/7kunit: platform: catch duplicate (name, id) in kunit_platform_device_add()lib/kunit/platform.c+31 -00 replies
5/7misc: reject duplicate names in misc_register()drivers/char/misc.c+22 -02 replies
6/7hw_breakpoint_test: fix test_many_cpus failure on large systemskernel/events/hw_breakpoint_test.c+3 -01 reply
7/7lib/tests: test_ratelimit: fix stress test thread lifecycle and leaklib/tests/test_ratelimit.c+26 -81 reply

Reviews trailers per patch

3 of 7 patches have a Reviewed-by or Acked-by.

PatchDavid DisseldorpMarco Elver
1/7R-b
2/7A-b
3/7
4/7
5/7
6/7R-b
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] Silence spurious warnings and crashes from kunit test suites

Running the full kunit suite on arm64 (128-core Neoverse N2) with 7.1-rc3+ produces a handful of backtraces that are not real kernel bugs but rather test-infrastructure issues: races with boot-time code, missing bounds checks, resource leaks, and sysfs duplicate-name splats.

This series fixes them one by one so that a clean kunit run no longer leaves noise in dmesg:

1. init/initramfs_test races with the async rootfs unpacker; add wait_for_initramfs() in suite .init.
2. kfence kunit cases fail outright when the pool is unavailable; skip them instead.
3. intlog2(0) / intlog10(0) hit a WARN_ON that is harmless; remove it.
4. kunit_platform_device_add() triggers sysfs_warn_dup() on the duplicate-registration test; catch duplicates early in the kunit helper (best-effort; final protection remains in driver core/sysfs).
5. misc_register() likewise hits sysfs_warn_dup(); reject duplicate names explicitly. misc->name is never NULL at this point since the existing code already dereferences it unconditionally.
6. hw_breakpoint test_many_cpus overflows its array on machines with many cores; bail out at the limit.
7. test_ratelimit stress test checks the wrong variable for kthread creation, leaks memory, and races on doneflag. Use goto-based cleanup to guarantee all started threads are stopped on failure.

All patches are independent and can be applied/reviewed separately. Tested on arm64 Neoverse N2 (128-core arm64) with CONFIG_KUNIT=y and CONFIG_KUNIT_ALL_TESTS=y.

Jia He (7):
init/initramfs_test: wait_for_initramfs() before running
kfence: kunit: skip when no pool is available lib/math/int_log: drop WARN_ON for value == 0
kunit: platform: catch duplicate (name, id) in kunit_platform_device_add()
misc: reject duplicate names in misc_register()
hw_breakpoint_test: fix test_many_cpus failure on large systems lib/tests: test_ratelimit: fix stress test thread lifecycle and leak

 drivers/char/misc.c                |  22 ++++++++++++++++++
 init/initramfs_test.c              |  17 +++++++++++++-
 kernel/events/hw_breakpoint_test.c |  12 ++++++++++
 lib/kunit/platform.c               |  36 +++++++++++++++++++++++++++++
 lib/math/int_log.c                 |   8 ++-----
 lib/tests/test_ratelimit.c         |  26 ++++++++++++++++-----
 mm/kfence/kfence_test.c            |   6 +++--
 7 files changed, 115 insertions(+), 12 deletions(-)