From: Karolina Stolarek <karolina.stolarek@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Mauro Carvalho Chehab" <mauro.chehab@linux.intel.com>,
"Karolina Stolarek" <karolina.stolarek@intel.com>,
"Andi Shyti" <andi.shyti@linux.intel.com>,
"Shuah Khan" <shuah@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"Nirmoy Das" <nirmoy.das@intel.com>
Subject: [RFC v2 0/3] Introduce KUnit tests for TTM subsystem
Date: Tue, 27 Jun 2023 10:32:07 +0200 [thread overview]
Message-ID: <cover.1687779215.git.karolina.stolarek@intel.com> (raw)
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@kernel.org/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
--
2.25.1
next reply other threads:[~2023-06-27 8:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 8:32 Karolina Stolarek [this message]
2023-06-27 8:32 ` [RFC v2 1/3] drm/ttm: Introduce KUnit tests Karolina Stolarek
2023-06-29 7:50 ` Christian König
2023-06-29 10:05 ` Karolina Stolarek
2023-06-30 11:09 ` Karolina Stolarek
2023-06-30 11:18 ` Christian König
2023-06-30 12:35 ` Karolina Stolarek
2023-06-27 8:32 ` [RFC v2 2/3] drm/ttm/tests: Add tests for ttm_device Karolina Stolarek
2023-06-29 9:14 ` Christian König
2023-06-29 10:09 ` Karolina Stolarek
2023-06-27 8:32 ` [RFC v2 3/3] drm/ttm/tests: Add tests for ttm_pool Karolina Stolarek
2023-06-29 9:17 ` Christian König
2023-06-29 10:19 ` Karolina Stolarek
2023-06-29 7:39 ` [RFC v2 0/3] Introduce KUnit tests for TTM subsystem Christian König
2023-06-29 7:42 ` Karolina Stolarek
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.1687779215.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=mauro.chehab@linux.intel.com \
--cc=nirmoy.das@intel.com \
--cc=shuah@kernel.org \
--cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox