mbox series

[v14,00/12] Improve test coverage of TTM

Message ID cover.1718192625.git.karolina.stolarek@intel.com (mailing list archive)
Headers show
Series Improve test coverage of TTM | expand

Message

Karolina Stolarek June 12, 2024, 12:02 p.m. UTC
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

v14:
  - Merge checks for system <-> TT move into one (Thomas)

v13 (all suggestions by Thomas):
  - Drop CONFIG_DRM_BUDDY=y from .kunitconfig
  - Remove ttm_bo_wait_ctx(bo, ctx) call from the mock move, it's not needed
  - Update MODULE_LICENSE descriptions (also respectively, 11/12)
  - Use u32 and u64 types instead uint(32|64)_t (also respectively, 12/12)
  - Update TODO to describe how the mock manager can be rewritten

v12:
  - Rewrite "drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk" patch to
    extend ttm_bo_kunit_init() helper to accept a dma_resv object and update
    calls to that helper (Christian)
  - Update drm_buddy_free_list() calls with an extra argument


Karolina Stolarek (12):
  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
  drm/ttm/tests: Correct modules' licenses
  drm/ttm/tests: Use u32 and u64 over uint*_t types

 drivers/gpu/drm/Kconfig                       |    1 +
 drivers/gpu/drm/ttm/tests/.kunitconfig        |    1 -
 drivers/gpu/drm/ttm/tests/Makefile            |    2 +
 drivers/gpu/drm/ttm/tests/TODO                |   27 +
 drivers/gpu/drm/ttm/tests/ttm_bo_test.c       |   54 +-
 .../gpu/drm/ttm/tests/ttm_bo_validate_test.c  | 1224 +++++++++++++++++
 drivers/gpu/drm/ttm/tests/ttm_device_test.c   |    2 +-
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c |  175 ++-
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h |   17 +-
 drivers/gpu/drm/ttm/tests/ttm_mock_manager.c  |  233 ++++
 drivers/gpu/drm/ttm/tests/ttm_mock_manager.h  |   30 +
 drivers/gpu/drm/ttm/tests/ttm_pool_test.c     |    8 +-
 drivers/gpu/drm/ttm/tests/ttm_resource_test.c |   20 +-
 drivers/gpu/drm/ttm/tests/ttm_tt_test.c       |  168 ++-
 drivers/gpu/drm/ttm/ttm_tt.c                  |    3 +
 15 files changed, 1877 insertions(+), 88 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

Comments

Karolina Stolarek June 20, 2024, 9:08 a.m. UTC | #1
Hi Christian and Amaranath,

On 12.06.2024 14:02, Karolina Stolarek wrote:
> 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

I collected r-bs for all patches in the series, they apply cleanly on 
the top of drm-misc and drm-tip and all the tests pass[1]. Would it be 
possible to merge them?

In other news, we enabled TTM KUnit tests in CI for Xe driver, the 
results can be seen on patchwork. For example:

https://patchwork.freedesktop.org/series/134956/

(see CI.KUnit step)

All the best,
Karolina

--------------------------------------------------------------
[1]:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/ttm/tests
[10:49:50] Configuring KUnit Kernel ...
[10:49:50] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=8
[10:49:53] Starting KUnit Kernel (1/1)...
[10:49:53] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[10:49:53] ================= ttm_device (5 subtests) ==================
[10:49:53] [PASSED] ttm_device_init_basic
[10:49:53] [PASSED] ttm_device_init_multiple
[10:49:53] [PASSED] ttm_device_fini_basic
[10:49:53] [PASSED] ttm_device_init_no_vma_man
[10:49:53] ================== ttm_device_init_pools  ==================
[10:49:53] [PASSED] No DMA allocations, no DMA32 required
[10:49:53] [PASSED] DMA allocations, DMA32 required
[10:49:53] [PASSED] No DMA allocations, DMA32 required
[10:49:53] [PASSED] DMA allocations, no DMA32 required
[10:49:53] ============== [PASSED] ttm_device_init_pools ==============
[10:49:53] =================== [PASSED] ttm_device ====================
[10:49:53] ================== ttm_pool (8 subtests) ===================
[10:49:53] ================== ttm_pool_alloc_basic  ===================
[10:49:53] [PASSED] One page
[10:49:53] [PASSED] More than one page
[10:49:53] [PASSED] Above the allocation limit
[10:49:53] [PASSED] One page, with coherent DMA mappings enabled
[10:49:53] [PASSED] Above the allocation limit, with coherent DMA 
mappings enabled
[10:49:53] ============== [PASSED] ttm_pool_alloc_basic ===============
[10:49:53] ============== ttm_pool_alloc_basic_dma_addr  ==============
[10:49:53] [PASSED] One page
[10:49:53] [PASSED] More than one page
[10:49:53] [PASSED] Above the allocation limit
[10:49:53] [PASSED] One page, with coherent DMA mappings enabled
[10:49:53] [PASSED] Above the allocation limit, with coherent DMA 
mappings enabled
[10:49:53] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ==========
[10:49:53] [PASSED] ttm_pool_alloc_order_caching_match
[10:49:53] [PASSED] ttm_pool_alloc_caching_mismatch
[10:49:53] [PASSED] ttm_pool_alloc_order_mismatch
[10:49:53] [PASSED] ttm_pool_free_dma_alloc
[10:49:53] [PASSED] ttm_pool_free_no_dma_alloc
[10:49:53] [PASSED] ttm_pool_fini_basic
[10:49:53] ==================== [PASSED] ttm_pool =====================
[10:49:53] ================ ttm_resource (8 subtests) =================
[10:49:53] ================= ttm_resource_init_basic  =================
[10:49:53] [PASSED] Init resource in TTM_PL_SYSTEM
[10:49:53] [PASSED] Init resource in TTM_PL_VRAM
[10:49:53] [PASSED] Init resource in a private placement
[10:49:53] [PASSED] Init resource in TTM_PL_SYSTEM, set placement flags
[10:49:53] ============= [PASSED] ttm_resource_init_basic =============
[10:49:53] [PASSED] ttm_resource_init_pinned
[10:49:53] [PASSED] ttm_resource_fini_basic
[10:49:53] [PASSED] ttm_resource_manager_init_basic
[10:49:53] [PASSED] ttm_resource_manager_usage_basic
[10:49:53] [PASSED] ttm_resource_manager_set_used_basic
[10:49:53] [PASSED] ttm_sys_man_alloc_basic
[10:49:53] [PASSED] ttm_sys_man_free_basic
[10:49:53] ================== [PASSED] ttm_resource ===================
[10:49:53] =================== ttm_tt (15 subtests) ===================
[10:49:53] ==================== ttm_tt_init_basic  ====================
[10:49:53] [PASSED] Page-aligned size
[10:49:53] [PASSED] Extra pages requested
[10:49:53] ================ [PASSED] ttm_tt_init_basic ================
[10:49:53] [PASSED] ttm_tt_init_misaligned
[10:49:53] [PASSED] ttm_tt_fini_basic
[10:49:53] [PASSED] ttm_tt_fini_sg
[10:49:53] [PASSED] ttm_tt_fini_shmem
[10:49:53] [PASSED] ttm_tt_create_basic
[10:49:53] [PASSED] ttm_tt_create_invalid_bo_type
[10:49:53] [PASSED] ttm_tt_create_ttm_exists
[10:49:53] [PASSED] ttm_tt_create_failed
[10:49:53] [PASSED] ttm_tt_destroy_basic
[10:49:53] [PASSED] ttm_tt_populate_null_ttm
[10:49:53] [PASSED] ttm_tt_populate_populated_ttm
[10:49:53] [PASSED] ttm_tt_unpopulate_basic
[10:49:53] [PASSED] ttm_tt_unpopulate_empty_ttm
[10:49:53] [PASSED] ttm_tt_swapin_basic
[10:49:53] ===================== [PASSED] ttm_tt ======================
[10:49:53] =================== ttm_bo (14 subtests) ===================
[10:49:53] =========== ttm_bo_reserve_optimistic_no_ticket  ===========
[10:49:53] [PASSED] Cannot be interrupted and sleeps
[10:49:53] [PASSED] Cannot be interrupted, locks straight away
[10:49:53] [PASSED] Can be interrupted, sleeps
[10:49:53] ======= [PASSED] ttm_bo_reserve_optimistic_no_ticket =======
[10:49:53] [PASSED] ttm_bo_reserve_locked_no_sleep
[10:49:53] [PASSED] ttm_bo_reserve_no_wait_ticket
[10:49:53] [PASSED] ttm_bo_reserve_double_resv
[10:49:53] [PASSED] ttm_bo_reserve_interrupted
[10:49:53] [PASSED] ttm_bo_reserve_deadlock
[10:49:53] [PASSED] ttm_bo_unreserve_basic
[10:49:53] [PASSED] ttm_bo_unreserve_pinned
[10:49:53] [PASSED] ttm_bo_unreserve_bulk
[10:49:53] [PASSED] ttm_bo_put_basic
[10:49:53] [PASSED] ttm_bo_put_shared_resv
[10:49:53] [PASSED] ttm_bo_pin_basic
[10:49:53] [PASSED] ttm_bo_pin_unpin_resource
[10:49:53] [PASSED] ttm_bo_multiple_pin_one_unpin
[10:49:53] ===================== [PASSED] ttm_bo ======================
[10:49:53] ============== ttm_bo_validate (22 subtests) ===============
[10:49:53] ============== ttm_bo_init_reserved_sys_man  ===============
[10:49:53] [PASSED] Buffer object for userspace
[10:49:53] [PASSED] Kernel buffer object
[10:49:53] [PASSED] Shared buffer object
[10:49:53] ========== [PASSED] ttm_bo_init_reserved_sys_man ===========
[10:49:53] ============== ttm_bo_init_reserved_mock_man  ==============
[10:49:53] [PASSED] Buffer object for userspace
[10:49:53] [PASSED] Kernel buffer object
[10:49:53] [PASSED] Shared buffer object
[10:49:53] ========== [PASSED] ttm_bo_init_reserved_mock_man ==========
[10:49:53] [PASSED] ttm_bo_init_reserved_resv
[10:49:53] ================== ttm_bo_validate_basic  ==================
[10:49:53] [PASSED] Buffer object for userspace
[10:49:53] [PASSED] Kernel buffer object
[10:49:53] [PASSED] Shared buffer object
[10:49:53] ============== [PASSED] ttm_bo_validate_basic ==============
[10:49:53] [PASSED] ttm_bo_validate_invalid_placement
[10:49:53] ============= ttm_bo_validate_same_placement  ==============
[10:49:53] [PASSED] System manager
[10:49:53] [PASSED] VRAM manager
[10:49:53] ========= [PASSED] ttm_bo_validate_same_placement ==========
[10:49:53] [PASSED] ttm_bo_validate_failed_alloc
[10:49:53] [PASSED] ttm_bo_validate_pinned
[10:49:53] [PASSED] ttm_bo_validate_busy_placement
[10:49:53] ================ ttm_bo_validate_multihop  =================
[10:49:53] [PASSED] Buffer object for userspace
[10:49:53] [PASSED] Kernel buffer object
[10:49:53] [PASSED] Shared buffer object
[10:49:53] ============ [PASSED] ttm_bo_validate_multihop =============
[10:49:53] ========== ttm_bo_validate_no_placement_signaled  ==========
[10:49:53] [PASSED] Buffer object in system domain, no page vector
[10:49:53] [PASSED] Buffer object in system domain with an existing page 
vector
[10:49:53] ====== [PASSED] ttm_bo_validate_no_placement_signaled ======
[10:49:53] ======== ttm_bo_validate_no_placement_not_signaled  ========
[10:49:53] [PASSED] Buffer object for userspace
[10:49:53] [PASSED] Kernel buffer object
[10:49:53] [PASSED] Shared buffer object
[10:49:53] ==== [PASSED] ttm_bo_validate_no_placement_not_signaled ====
[10:49:53] [PASSED] ttm_bo_validate_move_fence_signaled
[10:49:53] ========= ttm_bo_validate_move_fence_not_signaled  =========
[10:49:53] [PASSED] Waits for GPU
[10:49:53] [PASSED] Tries to lock straight away
[10:49:53] ===== [PASSED] ttm_bo_validate_move_fence_not_signaled =====
[10:49:53] [PASSED] ttm_bo_validate_swapout
[10:49:53] [PASSED] ttm_bo_validate_happy_evict
[10:49:53] [PASSED] ttm_bo_validate_all_pinned_evict
[10:49:53] [PASSED] ttm_bo_validate_allowed_only_evict
[10:49:53] [PASSED] ttm_bo_validate_deleted_evict
[10:49:53] [PASSED] ttm_bo_validate_busy_domain_evict
[10:49:53] [PASSED] ttm_bo_validate_evict_gutting
[10:49:53] [PASSED] ttm_bo_validate_recrusive_evict
[10:49:53] ================= [PASSED] ttm_bo_validate =================
[10:49:53] ============================================================
[10:49:53] Testing complete. Ran 102 tests: passed: 102
[10:49:53] Elapsed time: 3.305s total, 0.002s configuring, 2.635s 
building, 0.572s running
Somalapuram, Amaranath June 21, 2024, 6:11 a.m. UTC | #2
Hi Arun,

I still don't have commit permission. Can you please help to push this 
patches.

Regards,
S.Amarnath

On 6/20/2024 2:38 PM, Karolina Stolarek wrote:
> Hi Christian and Amaranath,
>
> On 12.06.2024 14:02, Karolina Stolarek wrote:
>> 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
>
> I collected r-bs for all patches in the series, they apply cleanly on 
> the top of drm-misc and drm-tip and all the tests pass[1]. Would it be 
> possible to merge them?
>
> In other news, we enabled TTM KUnit tests in CI for Xe driver, the 
> results can be seen on patchwork. For example:
>
> https://patchwork.freedesktop.org/series/134956/
>
> (see CI.KUnit step)
>
> All the best,
> Karolina
>
> --------------------------------------------------------------
> [1]:
> $ ./tools/testing/kunit/kunit.py run 
> --kunitconfig=drivers/gpu/drm/ttm/tests
> [10:49:50] Configuring KUnit Kernel ...
> [10:49:50] Building KUnit Kernel ...
> Populating config with:
> $ make ARCH=um O=.kunit olddefconfig
> Building with:
> $ make ARCH=um O=.kunit --jobs=8
> [10:49:53] Starting KUnit Kernel (1/1)...
> [10:49:53] ============================================================
> Running tests with:
> $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
> [10:49:53] ================= ttm_device (5 subtests) ==================
> [10:49:53] [PASSED] ttm_device_init_basic
> [10:49:53] [PASSED] ttm_device_init_multiple
> [10:49:53] [PASSED] ttm_device_fini_basic
> [10:49:53] [PASSED] ttm_device_init_no_vma_man
> [10:49:53] ================== ttm_device_init_pools ==================
> [10:49:53] [PASSED] No DMA allocations, no DMA32 required
> [10:49:53] [PASSED] DMA allocations, DMA32 required
> [10:49:53] [PASSED] No DMA allocations, DMA32 required
> [10:49:53] [PASSED] DMA allocations, no DMA32 required
> [10:49:53] ============== [PASSED] ttm_device_init_pools ==============
> [10:49:53] =================== [PASSED] ttm_device ====================
> [10:49:53] ================== ttm_pool (8 subtests) ===================
> [10:49:53] ================== ttm_pool_alloc_basic ===================
> [10:49:53] [PASSED] One page
> [10:49:53] [PASSED] More than one page
> [10:49:53] [PASSED] Above the allocation limit
> [10:49:53] [PASSED] One page, with coherent DMA mappings enabled
> [10:49:53] [PASSED] Above the allocation limit, with coherent DMA 
> mappings enabled
> [10:49:53] ============== [PASSED] ttm_pool_alloc_basic ===============
> [10:49:53] ============== ttm_pool_alloc_basic_dma_addr ==============
> [10:49:53] [PASSED] One page
> [10:49:53] [PASSED] More than one page
> [10:49:53] [PASSED] Above the allocation limit
> [10:49:53] [PASSED] One page, with coherent DMA mappings enabled
> [10:49:53] [PASSED] Above the allocation limit, with coherent DMA 
> mappings enabled
> [10:49:53] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ==========
> [10:49:53] [PASSED] ttm_pool_alloc_order_caching_match
> [10:49:53] [PASSED] ttm_pool_alloc_caching_mismatch
> [10:49:53] [PASSED] ttm_pool_alloc_order_mismatch
> [10:49:53] [PASSED] ttm_pool_free_dma_alloc
> [10:49:53] [PASSED] ttm_pool_free_no_dma_alloc
> [10:49:53] [PASSED] ttm_pool_fini_basic
> [10:49:53] ==================== [PASSED] ttm_pool =====================
> [10:49:53] ================ ttm_resource (8 subtests) =================
> [10:49:53] ================= ttm_resource_init_basic =================
> [10:49:53] [PASSED] Init resource in TTM_PL_SYSTEM
> [10:49:53] [PASSED] Init resource in TTM_PL_VRAM
> [10:49:53] [PASSED] Init resource in a private placement
> [10:49:53] [PASSED] Init resource in TTM_PL_SYSTEM, set placement flags
> [10:49:53] ============= [PASSED] ttm_resource_init_basic =============
> [10:49:53] [PASSED] ttm_resource_init_pinned
> [10:49:53] [PASSED] ttm_resource_fini_basic
> [10:49:53] [PASSED] ttm_resource_manager_init_basic
> [10:49:53] [PASSED] ttm_resource_manager_usage_basic
> [10:49:53] [PASSED] ttm_resource_manager_set_used_basic
> [10:49:53] [PASSED] ttm_sys_man_alloc_basic
> [10:49:53] [PASSED] ttm_sys_man_free_basic
> [10:49:53] ================== [PASSED] ttm_resource ===================
> [10:49:53] =================== ttm_tt (15 subtests) ===================
> [10:49:53] ==================== ttm_tt_init_basic ====================
> [10:49:53] [PASSED] Page-aligned size
> [10:49:53] [PASSED] Extra pages requested
> [10:49:53] ================ [PASSED] ttm_tt_init_basic ================
> [10:49:53] [PASSED] ttm_tt_init_misaligned
> [10:49:53] [PASSED] ttm_tt_fini_basic
> [10:49:53] [PASSED] ttm_tt_fini_sg
> [10:49:53] [PASSED] ttm_tt_fini_shmem
> [10:49:53] [PASSED] ttm_tt_create_basic
> [10:49:53] [PASSED] ttm_tt_create_invalid_bo_type
> [10:49:53] [PASSED] ttm_tt_create_ttm_exists
> [10:49:53] [PASSED] ttm_tt_create_failed
> [10:49:53] [PASSED] ttm_tt_destroy_basic
> [10:49:53] [PASSED] ttm_tt_populate_null_ttm
> [10:49:53] [PASSED] ttm_tt_populate_populated_ttm
> [10:49:53] [PASSED] ttm_tt_unpopulate_basic
> [10:49:53] [PASSED] ttm_tt_unpopulate_empty_ttm
> [10:49:53] [PASSED] ttm_tt_swapin_basic
> [10:49:53] ===================== [PASSED] ttm_tt ======================
> [10:49:53] =================== ttm_bo (14 subtests) ===================
> [10:49:53] =========== ttm_bo_reserve_optimistic_no_ticket ===========
> [10:49:53] [PASSED] Cannot be interrupted and sleeps
> [10:49:53] [PASSED] Cannot be interrupted, locks straight away
> [10:49:53] [PASSED] Can be interrupted, sleeps
> [10:49:53] ======= [PASSED] ttm_bo_reserve_optimistic_no_ticket =======
> [10:49:53] [PASSED] ttm_bo_reserve_locked_no_sleep
> [10:49:53] [PASSED] ttm_bo_reserve_no_wait_ticket
> [10:49:53] [PASSED] ttm_bo_reserve_double_resv
> [10:49:53] [PASSED] ttm_bo_reserve_interrupted
> [10:49:53] [PASSED] ttm_bo_reserve_deadlock
> [10:49:53] [PASSED] ttm_bo_unreserve_basic
> [10:49:53] [PASSED] ttm_bo_unreserve_pinned
> [10:49:53] [PASSED] ttm_bo_unreserve_bulk
> [10:49:53] [PASSED] ttm_bo_put_basic
> [10:49:53] [PASSED] ttm_bo_put_shared_resv
> [10:49:53] [PASSED] ttm_bo_pin_basic
> [10:49:53] [PASSED] ttm_bo_pin_unpin_resource
> [10:49:53] [PASSED] ttm_bo_multiple_pin_one_unpin
> [10:49:53] ===================== [PASSED] ttm_bo ======================
> [10:49:53] ============== ttm_bo_validate (22 subtests) ===============
> [10:49:53] ============== ttm_bo_init_reserved_sys_man ===============
> [10:49:53] [PASSED] Buffer object for userspace
> [10:49:53] [PASSED] Kernel buffer object
> [10:49:53] [PASSED] Shared buffer object
> [10:49:53] ========== [PASSED] ttm_bo_init_reserved_sys_man ===========
> [10:49:53] ============== ttm_bo_init_reserved_mock_man ==============
> [10:49:53] [PASSED] Buffer object for userspace
> [10:49:53] [PASSED] Kernel buffer object
> [10:49:53] [PASSED] Shared buffer object
> [10:49:53] ========== [PASSED] ttm_bo_init_reserved_mock_man ==========
> [10:49:53] [PASSED] ttm_bo_init_reserved_resv
> [10:49:53] ================== ttm_bo_validate_basic ==================
> [10:49:53] [PASSED] Buffer object for userspace
> [10:49:53] [PASSED] Kernel buffer object
> [10:49:53] [PASSED] Shared buffer object
> [10:49:53] ============== [PASSED] ttm_bo_validate_basic ==============
> [10:49:53] [PASSED] ttm_bo_validate_invalid_placement
> [10:49:53] ============= ttm_bo_validate_same_placement ==============
> [10:49:53] [PASSED] System manager
> [10:49:53] [PASSED] VRAM manager
> [10:49:53] ========= [PASSED] ttm_bo_validate_same_placement ==========
> [10:49:53] [PASSED] ttm_bo_validate_failed_alloc
> [10:49:53] [PASSED] ttm_bo_validate_pinned
> [10:49:53] [PASSED] ttm_bo_validate_busy_placement
> [10:49:53] ================ ttm_bo_validate_multihop =================
> [10:49:53] [PASSED] Buffer object for userspace
> [10:49:53] [PASSED] Kernel buffer object
> [10:49:53] [PASSED] Shared buffer object
> [10:49:53] ============ [PASSED] ttm_bo_validate_multihop =============
> [10:49:53] ========== ttm_bo_validate_no_placement_signaled ==========
> [10:49:53] [PASSED] Buffer object in system domain, no page vector
> [10:49:53] [PASSED] Buffer object in system domain with an existing 
> page vector
> [10:49:53] ====== [PASSED] ttm_bo_validate_no_placement_signaled ======
> [10:49:53] ======== ttm_bo_validate_no_placement_not_signaled ========
> [10:49:53] [PASSED] Buffer object for userspace
> [10:49:53] [PASSED] Kernel buffer object
> [10:49:53] [PASSED] Shared buffer object
> [10:49:53] ==== [PASSED] ttm_bo_validate_no_placement_not_signaled ====
> [10:49:53] [PASSED] ttm_bo_validate_move_fence_signaled
> [10:49:53] ========= ttm_bo_validate_move_fence_not_signaled =========
> [10:49:53] [PASSED] Waits for GPU
> [10:49:53] [PASSED] Tries to lock straight away
> [10:49:53] ===== [PASSED] ttm_bo_validate_move_fence_not_signaled =====
> [10:49:53] [PASSED] ttm_bo_validate_swapout
> [10:49:53] [PASSED] ttm_bo_validate_happy_evict
> [10:49:53] [PASSED] ttm_bo_validate_all_pinned_evict
> [10:49:53] [PASSED] ttm_bo_validate_allowed_only_evict
> [10:49:53] [PASSED] ttm_bo_validate_deleted_evict
> [10:49:53] [PASSED] ttm_bo_validate_busy_domain_evict
> [10:49:53] [PASSED] ttm_bo_validate_evict_gutting
> [10:49:53] [PASSED] ttm_bo_validate_recrusive_evict
> [10:49:53] ================= [PASSED] ttm_bo_validate =================
> [10:49:53] ============================================================
> [10:49:53] Testing complete. Ran 102 tests: passed: 102
> [10:49:53] Elapsed time: 3.305s total, 0.002s configuring, 2.635s 
> building, 0.572s running
Paneer Selvam, Arunpravin June 24, 2024, 10:37 a.m. UTC | #3
Hi Amar,

I pushed all the patches into drm-misc-next.

Regards,
Arun.

On 6/21/2024 11:41 AM, Somalapuram, Amaranath wrote:
>
> Hi Arun,
>
> I still don't have commit permission. Can you please help to push this 
> patches.
>
> Regards,
> S.Amarnath
> On 6/20/2024 2:38 PM, Karolina Stolarek wrote:
>> Hi Christian and Amaranath,
>>
>> On 12.06.2024 14:02, Karolina Stolarek wrote:
>>> 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
>>
>> I collected r-bs for all patches in the series, they apply cleanly on 
>> the top of drm-misc and drm-tip and all the tests pass[1]. Would it 
>> be possible to merge them?
>>
>> In other news, we enabled TTM KUnit tests in CI for Xe driver, the 
>> results can be seen on patchwork. For example:
>>
>> https://patchwork.freedesktop.org/series/134956/
>>
>> (see CI.KUnit step)
>>
>> All the best,
>> Karolina
>>
>> --------------------------------------------------------------
>> [1]:
>> $ ./tools/testing/kunit/kunit.py run 
>> --kunitconfig=drivers/gpu/drm/ttm/tests
>> [10:49:50] Configuring KUnit Kernel ...
>> [10:49:50] Building KUnit Kernel ...
>> Populating config with:
>> $ make ARCH=um O=.kunit olddefconfig
>> Building with:
>> $ make ARCH=um O=.kunit --jobs=8
>> [10:49:53] Starting KUnit Kernel (1/1)...
>> [10:49:53] ============================================================
>> Running tests with:
>> $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
>> [10:49:53] ================= ttm_device (5 subtests) ==================
>> [10:49:53] [PASSED] ttm_device_init_basic
>> [10:49:53] [PASSED] ttm_device_init_multiple
>> [10:49:53] [PASSED] ttm_device_fini_basic
>> [10:49:53] [PASSED] ttm_device_init_no_vma_man
>> [10:49:53] ================== ttm_device_init_pools ==================
>> [10:49:53] [PASSED] No DMA allocations, no DMA32 required
>> [10:49:53] [PASSED] DMA allocations, DMA32 required
>> [10:49:53] [PASSED] No DMA allocations, DMA32 required
>> [10:49:53] [PASSED] DMA allocations, no DMA32 required
>> [10:49:53] ============== [PASSED] ttm_device_init_pools ==============
>> [10:49:53] =================== [PASSED] ttm_device ====================
>> [10:49:53] ================== ttm_pool (8 subtests) ===================
>> [10:49:53] ================== ttm_pool_alloc_basic ===================
>> [10:49:53] [PASSED] One page
>> [10:49:53] [PASSED] More than one page
>> [10:49:53] [PASSED] Above the allocation limit
>> [10:49:53] [PASSED] One page, with coherent DMA mappings enabled
>> [10:49:53] [PASSED] Above the allocation limit, with coherent DMA 
>> mappings enabled
>> [10:49:53] ============== [PASSED] ttm_pool_alloc_basic ===============
>> [10:49:53] ============== ttm_pool_alloc_basic_dma_addr ==============
>> [10:49:53] [PASSED] One page
>> [10:49:53] [PASSED] More than one page
>> [10:49:53] [PASSED] Above the allocation limit
>> [10:49:53] [PASSED] One page, with coherent DMA mappings enabled
>> [10:49:53] [PASSED] Above the allocation limit, with coherent DMA 
>> mappings enabled
>> [10:49:53] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ==========
>> [10:49:53] [PASSED] ttm_pool_alloc_order_caching_match
>> [10:49:53] [PASSED] ttm_pool_alloc_caching_mismatch
>> [10:49:53] [PASSED] ttm_pool_alloc_order_mismatch
>> [10:49:53] [PASSED] ttm_pool_free_dma_alloc
>> [10:49:53] [PASSED] ttm_pool_free_no_dma_alloc
>> [10:49:53] [PASSED] ttm_pool_fini_basic
>> [10:49:53] ==================== [PASSED] ttm_pool =====================
>> [10:49:53] ================ ttm_resource (8 subtests) =================
>> [10:49:53] ================= ttm_resource_init_basic =================
>> [10:49:53] [PASSED] Init resource in TTM_PL_SYSTEM
>> [10:49:53] [PASSED] Init resource in TTM_PL_VRAM
>> [10:49:53] [PASSED] Init resource in a private placement
>> [10:49:53] [PASSED] Init resource in TTM_PL_SYSTEM, set placement flags
>> [10:49:53] ============= [PASSED] ttm_resource_init_basic =============
>> [10:49:53] [PASSED] ttm_resource_init_pinned
>> [10:49:53] [PASSED] ttm_resource_fini_basic
>> [10:49:53] [PASSED] ttm_resource_manager_init_basic
>> [10:49:53] [PASSED] ttm_resource_manager_usage_basic
>> [10:49:53] [PASSED] ttm_resource_manager_set_used_basic
>> [10:49:53] [PASSED] ttm_sys_man_alloc_basic
>> [10:49:53] [PASSED] ttm_sys_man_free_basic
>> [10:49:53] ================== [PASSED] ttm_resource ===================
>> [10:49:53] =================== ttm_tt (15 subtests) ===================
>> [10:49:53] ==================== ttm_tt_init_basic ====================
>> [10:49:53] [PASSED] Page-aligned size
>> [10:49:53] [PASSED] Extra pages requested
>> [10:49:53] ================ [PASSED] ttm_tt_init_basic ================
>> [10:49:53] [PASSED] ttm_tt_init_misaligned
>> [10:49:53] [PASSED] ttm_tt_fini_basic
>> [10:49:53] [PASSED] ttm_tt_fini_sg
>> [10:49:53] [PASSED] ttm_tt_fini_shmem
>> [10:49:53] [PASSED] ttm_tt_create_basic
>> [10:49:53] [PASSED] ttm_tt_create_invalid_bo_type
>> [10:49:53] [PASSED] ttm_tt_create_ttm_exists
>> [10:49:53] [PASSED] ttm_tt_create_failed
>> [10:49:53] [PASSED] ttm_tt_destroy_basic
>> [10:49:53] [PASSED] ttm_tt_populate_null_ttm
>> [10:49:53] [PASSED] ttm_tt_populate_populated_ttm
>> [10:49:53] [PASSED] ttm_tt_unpopulate_basic
>> [10:49:53] [PASSED] ttm_tt_unpopulate_empty_ttm
>> [10:49:53] [PASSED] ttm_tt_swapin_basic
>> [10:49:53] ===================== [PASSED] ttm_tt ======================
>> [10:49:53] =================== ttm_bo (14 subtests) ===================
>> [10:49:53] =========== ttm_bo_reserve_optimistic_no_ticket ===========
>> [10:49:53] [PASSED] Cannot be interrupted and sleeps
>> [10:49:53] [PASSED] Cannot be interrupted, locks straight away
>> [10:49:53] [PASSED] Can be interrupted, sleeps
>> [10:49:53] ======= [PASSED] ttm_bo_reserve_optimistic_no_ticket =======
>> [10:49:53] [PASSED] ttm_bo_reserve_locked_no_sleep
>> [10:49:53] [PASSED] ttm_bo_reserve_no_wait_ticket
>> [10:49:53] [PASSED] ttm_bo_reserve_double_resv
>> [10:49:53] [PASSED] ttm_bo_reserve_interrupted
>> [10:49:53] [PASSED] ttm_bo_reserve_deadlock
>> [10:49:53] [PASSED] ttm_bo_unreserve_basic
>> [10:49:53] [PASSED] ttm_bo_unreserve_pinned
>> [10:49:53] [PASSED] ttm_bo_unreserve_bulk
>> [10:49:53] [PASSED] ttm_bo_put_basic
>> [10:49:53] [PASSED] ttm_bo_put_shared_resv
>> [10:49:53] [PASSED] ttm_bo_pin_basic
>> [10:49:53] [PASSED] ttm_bo_pin_unpin_resource
>> [10:49:53] [PASSED] ttm_bo_multiple_pin_one_unpin
>> [10:49:53] ===================== [PASSED] ttm_bo ======================
>> [10:49:53] ============== ttm_bo_validate (22 subtests) ===============
>> [10:49:53] ============== ttm_bo_init_reserved_sys_man ===============
>> [10:49:53] [PASSED] Buffer object for userspace
>> [10:49:53] [PASSED] Kernel buffer object
>> [10:49:53] [PASSED] Shared buffer object
>> [10:49:53] ========== [PASSED] ttm_bo_init_reserved_sys_man ===========
>> [10:49:53] ============== ttm_bo_init_reserved_mock_man ==============
>> [10:49:53] [PASSED] Buffer object for userspace
>> [10:49:53] [PASSED] Kernel buffer object
>> [10:49:53] [PASSED] Shared buffer object
>> [10:49:53] ========== [PASSED] ttm_bo_init_reserved_mock_man ==========
>> [10:49:53] [PASSED] ttm_bo_init_reserved_resv
>> [10:49:53] ================== ttm_bo_validate_basic ==================
>> [10:49:53] [PASSED] Buffer object for userspace
>> [10:49:53] [PASSED] Kernel buffer object
>> [10:49:53] [PASSED] Shared buffer object
>> [10:49:53] ============== [PASSED] ttm_bo_validate_basic ==============
>> [10:49:53] [PASSED] ttm_bo_validate_invalid_placement
>> [10:49:53] ============= ttm_bo_validate_same_placement ==============
>> [10:49:53] [PASSED] System manager
>> [10:49:53] [PASSED] VRAM manager
>> [10:49:53] ========= [PASSED] ttm_bo_validate_same_placement ==========
>> [10:49:53] [PASSED] ttm_bo_validate_failed_alloc
>> [10:49:53] [PASSED] ttm_bo_validate_pinned
>> [10:49:53] [PASSED] ttm_bo_validate_busy_placement
>> [10:49:53] ================ ttm_bo_validate_multihop =================
>> [10:49:53] [PASSED] Buffer object for userspace
>> [10:49:53] [PASSED] Kernel buffer object
>> [10:49:53] [PASSED] Shared buffer object
>> [10:49:53] ============ [PASSED] ttm_bo_validate_multihop =============
>> [10:49:53] ========== ttm_bo_validate_no_placement_signaled ==========
>> [10:49:53] [PASSED] Buffer object in system domain, no page vector
>> [10:49:53] [PASSED] Buffer object in system domain with an existing 
>> page vector
>> [10:49:53] ====== [PASSED] ttm_bo_validate_no_placement_signaled ======
>> [10:49:53] ======== ttm_bo_validate_no_placement_not_signaled ========
>> [10:49:53] [PASSED] Buffer object for userspace
>> [10:49:53] [PASSED] Kernel buffer object
>> [10:49:53] [PASSED] Shared buffer object
>> [10:49:53] ==== [PASSED] ttm_bo_validate_no_placement_not_signaled ====
>> [10:49:53] [PASSED] ttm_bo_validate_move_fence_signaled
>> [10:49:53] ========= ttm_bo_validate_move_fence_not_signaled =========
>> [10:49:53] [PASSED] Waits for GPU
>> [10:49:53] [PASSED] Tries to lock straight away
>> [10:49:53] ===== [PASSED] ttm_bo_validate_move_fence_not_signaled =====
>> [10:49:53] [PASSED] ttm_bo_validate_swapout
>> [10:49:53] [PASSED] ttm_bo_validate_happy_evict
>> [10:49:53] [PASSED] ttm_bo_validate_all_pinned_evict
>> [10:49:53] [PASSED] ttm_bo_validate_allowed_only_evict
>> [10:49:53] [PASSED] ttm_bo_validate_deleted_evict
>> [10:49:53] [PASSED] ttm_bo_validate_busy_domain_evict
>> [10:49:53] [PASSED] ttm_bo_validate_evict_gutting
>> [10:49:53] [PASSED] ttm_bo_validate_recrusive_evict
>> [10:49:53] ================= [PASSED] ttm_bo_validate =================
>> [10:49:53] ============================================================
>> [10:49:53] Testing complete. Ran 102 tests: passed: 102
>> [10:49:53] Elapsed time: 3.305s total, 0.002s configuring, 2.635s 
>> building, 0.572s running