[PATCH v11 00/10] Improve test coverage of TTM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

v11:
  - Delete CONFIG_DRM_KUNIT_TEST_HELPERS from .kunitconfig file, as it gets
    automatically selected when TTM KUnit tests are enabled
  - Call ttm_bo_put() in ttm_bo_validate_pinned() test case (Matt)
  - Fix a copy-paste mistake in ttm_mem_type_cases definition (Matt)
  - Update mock_move definition to do a hop on VRAM -> sysmem move and
    delete a dummy multihop domain. Fix the eviction tests accordingly (Matt)
  - Update ttm_bo_validate_swapout() to use TT domain instead of VRAM
  - Update eviction test cases to create TT domain, so they can perform multihop
  - Update TODO file, as it got outdated already

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)

Karolina Stolarek (10):
  drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk
  drm/ttm/tests: Delete unnecessary config option
  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

 drivers/gpu/drm/Kconfig                       |    1 +
 drivers/gpu/drm/ttm/tests/.kunitconfig        |    2 +-
 drivers/gpu/drm/ttm/tests/Makefile            |    2 +
 drivers/gpu/drm/ttm/tests/TODO                |   25 +
 drivers/gpu/drm/ttm/tests/ttm_bo_test.c       |    3 +
 .../gpu/drm/ttm/tests/ttm_bo_validate_test.c  | 1225 +++++++++++++++++
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c |  171 ++-
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h |   10 +
 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, 1820 insertions(+), 24 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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux