tools/testing/cxl: Prevent cxl_test from confusing production modules
authorDan Williams <dan.j.williams@intel.com>
Tue, 13 Dec 2022 16:44:24 +0000 (08:44 -0800)
committerDan Williams <dan.j.williams@intel.com>
Thu, 5 Jan 2023 23:01:45 +0000 (15:01 -0800)
commit8c149eb011be23679b3320d3939f4e3c8271969c
tree97dc644232f49ba3a64c893eeddabe42a55075c5
parente520d52d7cabf6817b2c56d2681e9618bc5540ae
tools/testing/cxl: Prevent cxl_test from confusing production modules

The cxl_test machinery builds modified versions of the modules in
drivers/cxl/ and intercepts some of their calls to allow cxl_test to
inject mock CXL topologies for test.

However, if cxl_test attempts the same with production modules,
fireworks ensue as Luis discovered [1]. Prevent that scenario by
arranging for cxl_test to check for a "watermark" symbol in each of the
modules it expects to be modified before the test can run. This turns
undefined runtime behavior or crashes into a safer failure to load the
cxl_test module.

Link: http://lore.kernel.org/r/20221209062919.1096779-1-mcgrof@kernel.org
Reported-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
tools/testing/cxl/Kbuild
tools/testing/cxl/cxl_acpi_test.c [new file with mode: 0644]
tools/testing/cxl/cxl_core_test.c [new file with mode: 0644]
tools/testing/cxl/cxl_mem_test.c [new file with mode: 0644]
tools/testing/cxl/cxl_pmem_test.c [new file with mode: 0644]
tools/testing/cxl/cxl_port_test.c [new file with mode: 0644]
tools/testing/cxl/test/cxl.c
tools/testing/cxl/watermark.h [new file with mode: 0644]