[PATCH v10 0/9] Improve test coverage of TTM
Karolina Stolarek
karolina.stolarek at intel.com
Fri Mar 22 14:29:49 UTC 2024
Introduce tests for ttm_bo_validate()/ttm_bo_init_validate() that exercise
simple BO placement as well as eviction (including the case where the evict
domain also requires eviction to fit the incoming buffer). Prepare KUnit
helpers to handle such scenarios and add a mock VRAM manager. This series also
includes some updates to the helpers and more definitions used to define
"special" memory domains (e.g., one that can't allocate resources or is busy),
as well as drive-by fixes for the tests.
There are a couple of areas in which this test suite can be improved.
Suggestions for future work can be found in the TODO file.
Use kunit_tool script to manually run all the tests:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/ttm/tests
To build a kernel with TTM KUnit tests, use a UML configuration,
enable CONFIG_KUNIT, and then select CONFIG_DRM_TTM_KUNIT_TEST.
Many thanks,
Karolina
v10:
Many things have happened over the course of three months, so the series
had to be slightly reworked and expanded to accommodate these changes:
- Set DMA coherent mapping mask in the KUnit device so ttm_pool_alloc
tests can be executed
- Update ttm_bo_validate_invalid_placement() test case to check against
the right return error. It's no longer -EINVAL (which only is returned
for pinned buffers), but -ENOMEM. The behaviour has changed in
commit cc941c70df39 ("drm/ttm: improve idle/busy handling v5")
- Rework ttm_placement_kunit_init() to accept only one array of places
and update the tests that use that helper
- Set fallback flags in eviction domains defined in TTM KUnit helpers
- Fix a warning raised by ttm_bo_unreserve_bulk() test case
- Scrap all r-bs and tested-by, as many things were updated and should
be checked again
v9:
- Drop tests with basic test cases, they are merged now
- Add three final patches -- tests for ttm_tt_(un)populate, eviction testing
and a TODO file, with suggestions on how to improve these tests
- Delete the initialization of spinlock in
ttm_bo_validate_move_fence_signaled(), it not used at all (Andi)
- Just return the error code threaded_fence_signal(), don't save it to a
local variable (Andi)
- Use ttm_bo_unreserve() in tests checking different move fence states (Andi)
v8:
- Add Tested-by tags to commits that introduce tests
- Improve the comment for ttm_bo_reserve_deadlock() subtest (Andi)
- Actually clean up the resource when "error_free_blocks" is hit in
ttm_mock_manager_alloc(). Without that change, we hit
DEBUG_LOCKS_WARN_ON(lock->magic != lock) warning when cleaning up
the resource manager because we try clean up an incomplete, orphaned
resource. That's not good, and this could bite us back in the future.
Karolina Stolarek (9):
drm/ttm/tests: Set DMA mask in KUnit device
drm/ttm/tests: Use an init function from the helpers lib
drm/ttm/tests: Test simple BO creation and validation
drm/ttm/tests: Add tests with mock resource managers
drm/ttm/tests: Add test cases dependent on fence signaling
drm/ttm/tests: Add eviction testing
drm/ttm/tests: Add tests for ttm_tt_populate
drm/ttm/tests: Add TODO file
drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/ttm/tests/.kunitconfig | 1 +
drivers/gpu/drm/ttm/tests/Makefile | 2 +
drivers/gpu/drm/ttm/tests/TODO | 24 +
drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 3 +
.../gpu/drm/ttm/tests/ttm_bo_validate_test.c | 1213 +++++++++++++++++
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 173 ++-
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h | 11 +
drivers/gpu/drm/ttm/tests/ttm_mock_manager.c | 235 ++++
drivers/gpu/drm/ttm/tests/ttm_mock_manager.h | 33 +
drivers/gpu/drm/ttm/tests/ttm_tt_test.c | 134 +-
drivers/gpu/drm/ttm/ttm_tt.c | 3 +
12 files changed, 1810 insertions(+), 23 deletions(-)
create mode 100644 drivers/gpu/drm/ttm/tests/TODO
create mode 100644 drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
create mode 100644 drivers/gpu/drm/ttm/tests/ttm_mock_manager.c
create mode 100644 drivers/gpu/drm/ttm/tests/ttm_mock_manager.h
--
2.34.1
More information about the dri-devel
mailing list