From: Karolina Stolarek <karolina.stolarek@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: "Karolina Stolarek" <karolina.stolarek@intel.com>,
"Christian König" <christian.koenig@amd.com>,
"Andi Shyti" <andi.shyti@linux.intel.com>,
"Nirmoy Das" <nirmoy.das@intel.com>
Subject: [PATCH v7 0/8] Improve test coverage of TTM
Date: Fri, 17 Nov 2023 09:49:35 +0100 [thread overview]
Message-ID: <cover.1700207346.git.karolina.stolarek@intel.com> (raw)
Add tests for building blocks of the TTM subsystem, such as ttm_resource,
ttm_resource_manager, ttm_tt and ttm_buffer_object. This series covers
basic functions such as initialization, allocation and clean-up of each
struct. Testing of ttm_buffer_object also includes locking and unlocking
the object for validation, with special scenarios such as an interrupted
wait or deadlock.
Some of the test cases check the bulk move mechanism and how it interacts
with pinned buffers. This is to be seen if we want to add dedicated testing
for bulk move or not. The resource allocation subtests use ttm_sys_manager
for now. Resources that don't use system memory will be indirectly tested
via tests for ttm_bo_validate()/ttm_bo_init_validate(), using a mock
resource manager.
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, first enable CONFIG_KUNIT, and
then CONFIG_DRM_TTM_KUNIT_TEST.
Many thanks,
Karolina
v7:
- Drop size argument from ttm_place_kunit_init(), it's no longer needed
- Delete a TODO comment from ttm_bo_validate_tests.c
- First evict BOs before calling ttm_resource_manager_set_used() in
ttm_mock_manager_fini()
- Stop calling ttm_resource_manager_cleanup() as a part of the mock manager
fini sequence. It frees a move fence that is allocated via KUnit allocator,
which gets freed again as a part of the test cleanup
- Set use_tt to true in mock manager and stop passing in the flag for it
- Make ttm_dev_empty_funcs static
(drivers/gpu/drm/ttm/tests/ttm_tt_test.c:232:25: sparse: sparse:
symbol 'ttm_dev_empty_funcs' was not declared. Should it be static?)
- Cast bo->base.resv->fences to a generic pointer before it's checked by
KUnit (drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c:98:9:
sparse: sparse: incompatible types in comparison expression (different
base types))
- Clean up mock managers in ttm_bo_validate_move_fence_not_signaled subtest
v6:
- Include tests for ttm_bo_init_reserved() and ttm_bo_validate(), with
a mock resource manager (patches 6-8; no eviction testing)
- Add ttm_test_devices_all_init() helper to also init ttm_device instance
- Remove fpfn and lpfn from ttm_place_kunit_init() helper -- these fields
are neither used nor tested
v5:
- Actually use the page_flags parameter in ttm_tt_simple_create()
v4:
- First unreserve the object before calling ww_acquire_fini() in
ttm_bo_reserve_double_resv subtest
- Silence lockdep in ttm_bo_reserve_deadlock subtest (open to suggestions
how to fix it in a different way)
- Use a genuine GEM object in ttm_buffer_object instead of an empty one
v3:
- Instead of modifying the main TTM Makefile, use
EXPORT_SYMBOL_FOR_TESTS_ONLY() macro for symbols that are tested but
not widely exported. Thanks to this change, TTM tests can be built
as modules, even when non-exported functions are used
- Change the description of a patch that fixes ttm_pool_pre_populated()
v2:
- Remove Makefile for KUnit tests and move the definitions to the
TTM's one
- Switch on CONFIG_DRM_TTM_KUNIT_TEST=m so the tests and TTM module
are built as one. This allows building the tests as a module, even
if it uses functions that are not exported
- Fix ttm_pool_pre_populated(); a wrong flag was passed to
ttm_tt_kunit_init() function
Karolina Stolarek (8):
drm/ttm/tests: Add tests for ttm_resource and ttm_sys_man
drm/ttm/tests: Add tests for ttm_tt
drm/ttm/tests: Add tests for ttm_bo functions
drm/ttm/tests: Fix argument in ttm_tt_kunit_init()
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
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/ttm/tests/.kunitconfig | 1 +
drivers/gpu/drm/ttm/tests/Makefile | 5 +
drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 619 ++++++++++++++
.../gpu/drm/ttm/tests/ttm_bo_validate_test.c | 795 ++++++++++++++++++
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 109 ++-
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h | 7 +
drivers/gpu/drm/ttm/tests/ttm_mock_manager.c | 206 +++++
drivers/gpu/drm/ttm/tests/ttm_mock_manager.h | 31 +
drivers/gpu/drm/ttm/tests/ttm_pool_test.c | 3 +-
drivers/gpu/drm/ttm/tests/ttm_resource_test.c | 335 ++++++++
drivers/gpu/drm/ttm/tests/ttm_tt_test.c | 282 +++++++
drivers/gpu/drm/ttm/ttm_resource.c | 3 +
drivers/gpu/drm/ttm/ttm_tt.c | 3 +
14 files changed, 2397 insertions(+), 3 deletions(-)
create mode 100644 drivers/gpu/drm/ttm/tests/ttm_bo_test.c
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
create mode 100644 drivers/gpu/drm/ttm/tests/ttm_resource_test.c
create mode 100644 drivers/gpu/drm/ttm/tests/ttm_tt_test.c
--
2.25.1
next reply other threads:[~2023-11-17 8:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 8:49 Karolina Stolarek [this message]
2023-11-17 8:49 ` [PATCH v7 1/8] drm/ttm/tests: Add tests for ttm_resource and ttm_sys_man Karolina Stolarek
2023-11-21 9:25 ` Christian König
2023-11-17 8:49 ` [PATCH v7 2/8] drm/ttm/tests: Add tests for ttm_tt Karolina Stolarek
2023-11-17 8:49 ` [PATCH v7 3/8] drm/ttm/tests: Add tests for ttm_bo functions Karolina Stolarek
2023-11-21 14:29 ` Christian König
2023-11-22 10:39 ` Karolina Stolarek
2023-11-28 15:25 ` Andi Shyti
2023-11-17 8:49 ` [PATCH v7 4/8] drm/ttm/tests: Fix argument in ttm_tt_kunit_init() Karolina Stolarek
2023-11-17 11:54 ` [v7,4/8] " Dominik Karol Piatkowski
2023-11-21 15:09 ` [PATCH v7 4/8] " Christian König
2023-11-17 8:49 ` [PATCH v7 5/8] drm/ttm/tests: Use an init function from the helpers lib Karolina Stolarek
2023-11-17 8:49 ` [PATCH v7 6/8] drm/ttm/tests: Test simple BO creation and validation Karolina Stolarek
2023-11-17 18:54 ` kernel test robot
2023-11-17 18:54 ` kernel test robot
2023-11-21 15:55 ` Christian König
2023-11-17 8:49 ` [PATCH v7 7/8] drm/ttm/tests: Add tests with mock resource managers Karolina Stolarek
2023-11-22 13:48 ` Christian König
2023-11-17 8:49 ` [PATCH v7 8/8] drm/ttm/tests: Add test cases dependent on fence signaling Karolina Stolarek
2023-11-17 13:31 ` [PATCH v7 0/8] Improve test coverage of TTM Christian König
2023-11-18 13:32 ` Somalapuram, Amaranath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1700207346.git.karolina.stolarek@intel.com \
--to=karolina.stolarek@intel.com \
--cc=andi.shyti@linux.intel.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=nirmoy.das@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.