Skip to content

DRM scheduler kunit tests

Tvrtko Ursulin amd-gfx dri-devel intel-xe 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Changes in v1 from the cover letter

* Rebased for drm_sched_init changes.
* Fixed modular build.
* Added some comments.
* Filename renames. (Philipp)

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5drm: Move some options to separate new Kconfig.debugdrivers/gpu/drm/Kconfig drivers/gpu/drm/Kconfig.debug+108 -1040 replies
2/5drm/scheduler: Add scheduler unit testing infrastructure and some basic testsdrivers/gpu/drm/Kconfig.debug drivers/gpu/drm/scheduler/.kunitconfig drivers/gpu/drm/scheduler/Makefile +4 more+762 -00 replies
3/5drm/scheduler: Add a simple timeout testdrivers/gpu/drm/scheduler/tests/mock_scheduler.c drivers/gpu/drm/scheduler/tests/sched_tests.h drivers/gpu/drm/scheduler/tests/tests_basic.c+77 -60 replies
4/5drm/scheduler: Add basic priority testsdrivers/gpu/drm/scheduler/tests/tests_basic.c+98 -10 replies
5/5drm/scheduler: Add a basic test for modifying entities scheduler listdrivers/gpu/drm/scheduler/tests/tests_basic.c+72 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] DRM scheduler kunit tests

There has repeatedly been quite a bit of apprehension when any change to the DRM scheduler is proposed, with two main reasons being code base is considered fragile, not well understood and not very well documented, and secondly the lack of systematic testing outside the vendor specific tests suites and/or test farms.

This series is an attempt to dislodge this status quo by adding some unit tests using the kunit framework.

General approach is that there is a mock "hardware" backend which can be controlled from tests, which in turn allows exercising various scheduler code paths.

Only some simple basic tests get added in the series and hopefully it is easy to understand what tests are doing.

An obligatory "screenshot" for reference:

[14:29:37] ============ drm_sched_basic_tests (3 subtests) ============ [14:29:38] [PASSED] drm_sched_basic_submit
[14:29:38] ================== drm_sched_basic_test =================== [14:29:38] [PASSED] A queue of jobs in a single entity
[14:29:38] [PASSED] A chain of dependent jobs across multiple entities [14:29:38] [PASSED] Multiple independent job queues
[14:29:38] [PASSED] Multiple inter-dependent job queues
[14:29:38] ============== [PASSED] drm_sched_basic_test =============== [14:29:38] [PASSED] drm_sched_basic_entity_cleanup
[14:29:38] ============== [PASSED] drm_sched_basic_tests ============== [14:29:38] ======== drm_sched_basic_timeout_tests (1 subtest) ========= [14:29:40] [PASSED] drm_sched_basic_timeout
[14:29:40] ========== [PASSED] drm_sched_basic_timeout_tests ========== [14:29:40] ======= drm_sched_basic_priority_tests (2 subtests) ======== [14:29:42] [PASSED] drm_sched_priorities
[14:29:42] [PASSED] drm_sched_change_priority
[14:29:42] ========= [PASSED] drm_sched_basic_priority_tests ========== [14:29:42] ====== drm_sched_basic_modify_sched_tests (1 subtest) ====== [14:29:43] [PASSED] drm_sched_test_modify_sched
[14:29:43] ======= [PASSED] drm_sched_basic_modify_sched_tests ======== [14:29:43] ============================================================ [14:29:43] Testing complete. Ran 10 tests: passed: 10
[14:29:43] Elapsed time: 13.330s total, 0.001s configuring, 4.005s building, 9.276s running

v2:
* Parameterize a bunch of similar tests.
* Improve test commentary.
* Rename TDR test to timeout. (Christian)
* Improve quality and consistency of naming. (Philipp)

RFC v2 -> series v1:
* Rebased for drm_sched_init changes.
* Fixed modular build.
* Added some comments.
* Filename renames. (Philipp)

Cc Christian König <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Philipp Stanner <[email protected]>

Tvrtko Ursulin (5):
drm: Move some options to separate new Kconfig.debug drm/scheduler: Add scheduler unit testing infrastructure and some
basic tests
drm/scheduler: Add a simple timeout test
drm/scheduler: Add basic priority tests
drm/scheduler: Add a basic test for modifying entities scheduler list

 drivers/gpu/drm/Kconfig                       | 109 +----
 drivers/gpu/drm/Kconfig.debug                 | 115 +++++
 drivers/gpu/drm/scheduler/.kunitconfig        |  12 +
 drivers/gpu/drm/scheduler/Makefile            |   2 +
 drivers/gpu/drm/scheduler/tests/Makefile      |   6 +
 .../gpu/drm/scheduler/tests/mock_scheduler.c  | 323 +++++++++++++
 drivers/gpu/drm/scheduler/tests/sched_tests.h | 222 +++++++++
 drivers/gpu/drm/scheduler/tests/tests_basic.c | 424 ++++++++++++++++++
 8 files changed, 1109 insertions(+), 104 deletions(-)
 create mode 100644 drivers/gpu/drm/Kconfig.debug
 create mode 100644 drivers/gpu/drm/scheduler/.kunitconfig
 create mode 100644 drivers/gpu/drm/scheduler/tests/Makefile
 create mode 100644 drivers/gpu/drm/scheduler/tests/mock_scheduler.c
 create mode 100644 drivers/gpu/drm/scheduler/tests/sched_tests.h
 create mode 100644 drivers/gpu/drm/scheduler/tests/tests_basic.c
Signature · 1 line
2.48.0