Skip to contentSkip to conversation

lib-tests-add-kunit-tests-for-errseq.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Oct 7

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: lib/tests: add KUnit tests for errseq
has been removed from the -mm tree. Its filename was
lib-tests-add-kunit-tests-for-errseq.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Thomas Maarseveen <[email protected]>
Subject: lib/tests: add KUnit tests for errseq
Date: Wed, 12 Aug 2026 20:55:33 +0200

The errseq_t infrastructure (lib/errseq.c) underpins writeback error reporting but has no regression tests. Its semantics are subtle enough to have needed fixing before: commit b4678df184b3 ("errseq: Always report a writeback error once") changed how unseen errors reach new samplers.

Add a KUnit suite covering the documented single-threaded semantics:

- a zeroed errseq_t is the "no error yet" epoch
- errors are recorded, overwrite one another, and both ends of the valid errno range round-trip exactly
- an error nobody has seen samples as zero, so a check against a fresh sample still reports it
- errseq_check_and_advance() reports a given error exactly once per cursor and leaves the cursor in place when nothing has changed
- once an error has been seen, a fresh sample is current and a check against it reports nothing
- the same error recorded again after being seen is reported again, even to a cursor that consumed the first occurrence while another cursor marked the repeat as seen
- independent cursors each observe each error

The lockless behaviour of errseq_t under concurrent updates and the WARN path for invalid error values are deliberately out of scope.

Tested with ./tools/testing/kunit/kunit.py run, with a kunitconfig enabling CONFIG_KUNIT=y and CONFIG_ERRSEQ_KUNIT_TEST=y; all 13 tests pass under ARCH=um.

---

 MAINTAINERS              |    1 
 lib/Kconfig.debug        |   15 ++
 lib/tests/Makefile       |    1 
 lib/tests/errseq_kunit.c |  237 +++++++++++++++++++++++++++++++++++++
 4 files changed, 254 insertions(+)
lib/Kconfig.debug renamed from lib/Kconfig.debug~lib-tests-add-kunit-tests-for-errseq +15 -0
@@ -2797,6 +2797,21 @@ config SYSCTL_KUNIT_TEST
 
 	  If unsure, say N.
 
+config ERRSEQ_KUNIT_TEST
+	tristate "KUnit test for errseq" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  This builds the errseq KUnit test suite.
+	  It tests the documented semantics of the errseq_t error-tracking
+	  infrastructure (lib/errseq.c), which underpins writeback error
+	  reporting.
+
+	  For more information on KUnit and unit tests in general please refer
+	  to the KUnit documentation in Documentation/dev-tools/kunit/.
+
+	  If unsure, say N.
+
 config KFIFO_KUNIT_TEST
 	tristate "KUnit Test for the generic kernel FIFO implementation" if !KUNIT_ALL_TESTS
 	depends on KUNIT
lib/tests/errseq_kunit.c new file +237 -0

237 lines not on this page · raw message

lib/tests/Makefile renamed from lib/tests/Makefile~lib-tests-add-kunit-tests-for-errseq +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_BLACKHOLE_DEV_KUNIT_TEST) +
 obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o
 obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o
 obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o
+obj-$(CONFIG_ERRSEQ_KUNIT_TEST) += errseq_kunit.o
 obj-$(CONFIG_FFS_KUNIT_TEST) += ffs_kunit.o
 CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced)
 CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread)
MAINTAINERS renamed from MAINTAINERS~lib-tests-add-kunit-tests-for-errseq +1 -0
@@ -9701,6 +9701,7 @@ M:	Jeff Layton <[email protected]>
 S:	Maintained
 F:	include/linux/errseq.h
 F:	lib/errseq.c
+F:	lib/tests/errseq_kunit.c
 
 ESD CAN NETWORK DRIVERS
 M:	Stefan Mätje <[email protected]>

_

Patches currently in -mm which might be from [email protected] are