All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] cxl: Add KUnit tests and documentation
@ 2026-10-14  4:17 Alison Schofield
  2026-10-14  4:17 ` [PATCH 1/4] Documentation/driver-api/cxl: Add a testing page Alison Schofield
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alison Schofield @ 2026-10-14  4:17 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Li Ming, Richard Cheng
  Cc: linux-cxl

The CXL subsystem has no KUnit tests. Its automated test coverage comes
from cxl_test and the ndctl suite, which exercise the driver stack through
an emulated CXL topology. KUnit complements that coverage by testing self-
contained logic and error paths in isolation.

This series introduces CXL KUnit infrastructure and documentation describing
how it complements the existing cxl_test coverage.

The first KUnit suite, a collection of related test cases, exercises the HDM
decoder interleave encoding helpers, providing a starting point for testing
self-contained CXL logic. The second suite exercises mailbox command handling,
including error paths that are difficult to reach through cxl_test.

The mailbox tests also demonstrate the value of regression coverage. An
unknown device return code can cause an out-of-bounds read and allow a failed
command to be reported as successful. The series corrects that behavior, then
adds tests that reproduce the failure without the correction. With KASAN enabled,
the tests also expose the out-of-bounds read.

Together, the two suites establish a pattern for adding KUnit coverage
to CXL, both for existing functionality and for bugs as they are found.



Alison Schofield (3):
  Documentation/driver-api/cxl: Add a testing page
  cxl: Add KUnit tests for HDM decoder encoding helpers
  cxl/mbox: Add KUnit tests for cxl_internal_send_cmd()

Gaobin Huang (1):
  cxl/mbox: Treat unknown device return codes as errors

 Documentation/driver-api/cxl/index.rst   |   1 +
 Documentation/driver-api/cxl/testing.rst | 120 +++++++++++
 drivers/cxl/.kunitconfig                 |   4 +
 drivers/cxl/Kconfig                      |  16 ++
 drivers/cxl/Makefile                     |   1 +
 drivers/cxl/core/Makefile                |   1 +
 drivers/cxl/core/tests/Makefile          |   5 +
 drivers/cxl/core/tests/mbox_kunit.c      | 249 +++++++++++++++++++++++
 drivers/cxl/cxlmem.h                     |   6 +
 drivers/cxl/tests/Makefile               |   5 +
 drivers/cxl/tests/hdm_encoding_kunit.c   | 156 ++++++++++++++
 11 files changed, 564 insertions(+)
 create mode 100644 Documentation/driver-api/cxl/testing.rst
 create mode 100644 drivers/cxl/.kunitconfig
 create mode 100644 drivers/cxl/core/tests/Makefile
 create mode 100644 drivers/cxl/core/tests/mbox_kunit.c
 create mode 100644 drivers/cxl/tests/Makefile
 create mode 100644 drivers/cxl/tests/hdm_encoding_kunit.c

-- 
2.37.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-14  4:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14  4:17 [PATCH 0/4] cxl: Add KUnit tests and documentation Alison Schofield
2026-10-14  4:17 ` [PATCH 1/4] Documentation/driver-api/cxl: Add a testing page Alison Schofield
2026-10-14  4:17 ` [PATCH 2/4] cxl: Add KUnit tests for HDM decoder encoding helpers Alison Schofield
2026-10-14  4:17 ` [PATCH 3/4] cxl/mbox: Treat unknown device return codes as errors Alison Schofield
2026-10-14  4:17 ` [PATCH 4/4] cxl/mbox: Add KUnit tests for cxl_internal_send_cmd() Alison Schofield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.