Re: [RFC v2 0/3] Introduce KUnit tests for TTM subsystem

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

 



Sorry for the delayed response, AMD had some mail server issues and I simply missed this through the web access interface.

Going to take a look at this now,
Christian.

Am 27.06.23 um 10:32 schrieb Karolina Stolarek:
This series introduces KUnit[1] tests for TTM (Translation Table Manager)
subsystem, a memory manager used by graphics drivers to create and manage
memory buffers across different memory domains, such as system memory
or VRAM.

Unit tests implemented here cover two data structures:
   - ttm_device -- referred as a buffer object device, which stores
     resource managers and page pools
   - ttm_pool -- a struct of pools (ttm_pool_type) of different page
     orders and caching attributes, with pages that can be reused on
     the next buffer allocation

Use kunit_tool script to manually run the tests:

$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/ttm/tests

The kunit tool might not work with older python versions. To fix that,
apply [2] patch.

To build a kernel with TTM KUnit tests, enable CONFIG_DRM_TTM_KUNIT_TEST
symbol.

As for now, tests are architecture-agnostic (i.e. KUnit runner uses UML
kernel), which means that we have limited coverage in some places. For
example, we can't fully test the initialization of global page pools,
such as global_write_combined. It is to be decided if we want to stick
to UML or use CONFIG_X86 (at least to some extent).

These patches are just a beginning of the work to improve the test
coverage of TTM. Feel free to suggest changes, test cases or priorities.

Many thanks,
Karolina

v2:
   - Add missing symbol exports in ttm_kunit_helpers.c
   - Update helpers include to fix compilation issues (didn't catch it as
     KUnit tests weren't enabled in the kernel I tested, an oversight
     on my part)
   - Add checks for ttm_pool fields in ttm_pool_alloc_basic(), including the
     one for NUMA node id
   - Rebase the changes on the top of drm-tip

--------------------------------
[1] - https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html
[2] - https://lore.kernel.org/lkml/20230610175618.82271-1-sj@xxxxxxxxxx/T/

Karolina Stolarek (3):
   drm/ttm: Introduce KUnit tests
   drm/ttm/tests: Add tests for ttm_device
   drm/ttm/tests: Add tests for ttm_pool

  drivers/gpu/drm/Kconfig                       |  15 +
  drivers/gpu/drm/ttm/Makefile                  |   1 +
  drivers/gpu/drm/ttm/tests/.kunitconfig        |   4 +
  drivers/gpu/drm/ttm/tests/Makefile            |   6 +
  drivers/gpu/drm/ttm/tests/ttm_device_test.c   | 213 +++++++++
  drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c |  88 ++++
  drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h |  34 ++
  drivers/gpu/drm/ttm/tests/ttm_pool_test.c     | 406 ++++++++++++++++++
  8 files changed, 767 insertions(+)
  create mode 100644 drivers/gpu/drm/ttm/tests/.kunitconfig
  create mode 100644 drivers/gpu/drm/ttm/tests/Makefile
  create mode 100644 drivers/gpu/drm/ttm/tests/ttm_device_test.c
  create mode 100644 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
  create mode 100644 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
  create mode 100644 drivers/gpu/drm/ttm/tests/ttm_pool_test.c





[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