Skip to content

Commit 76689eb

Browse files
drm/ttm: remove ttm_bo_validate_swapout test
The test is quite fragile since it tries to allocate halve available system memory + 1 page. If the system has either not enough memory to make the allocation work with other things running in parallel or to much memory so the allocation fails as to large/invalid the test will fail. Completely remove the test. We already validate swapout on the device level and that test seems to be stable. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250710144129.1803-2-christian.koenig@amd.com
1 parent 8b824e9 commit 76689eb

1 file changed

Lines changed: 0 additions & 51 deletions

File tree

drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -758,56 +758,6 @@ static void ttm_bo_validate_move_fence_not_signaled(struct kunit *test)
758758
ttm_mock_manager_fini(priv->ttm_dev, snd_mem);
759759
}
760760

761-
static void ttm_bo_validate_swapout(struct kunit *test)
762-
{
763-
unsigned long size_big, size = ALIGN(BO_SIZE, PAGE_SIZE);
764-
enum ttm_bo_type bo_type = ttm_bo_type_device;
765-
struct ttm_buffer_object *bo_small, *bo_big;
766-
struct ttm_test_devices *priv = test->priv;
767-
struct ttm_operation_ctx ctx = { };
768-
struct ttm_placement *placement;
769-
u32 mem_type = TTM_PL_TT;
770-
struct ttm_place *place;
771-
struct sysinfo si;
772-
int err;
773-
774-
si_meminfo(&si);
775-
size_big = ALIGN(((u64)si.totalram * si.mem_unit / 2), PAGE_SIZE);
776-
777-
ttm_mock_manager_init(priv->ttm_dev, mem_type, size_big + size);
778-
779-
place = ttm_place_kunit_init(test, mem_type, 0);
780-
placement = ttm_placement_kunit_init(test, place, 1);
781-
782-
bo_small = kunit_kzalloc(test, sizeof(*bo_small), GFP_KERNEL);
783-
KUNIT_ASSERT_NOT_NULL(test, bo_small);
784-
785-
drm_gem_private_object_init(priv->drm, &bo_small->base, size);
786-
787-
err = ttm_bo_init_reserved(priv->ttm_dev, bo_small, bo_type, placement,
788-
PAGE_SIZE, &ctx, NULL, NULL,
789-
&dummy_ttm_bo_destroy);
790-
KUNIT_EXPECT_EQ(test, err, 0);
791-
dma_resv_unlock(bo_small->base.resv);
792-
793-
bo_big = ttm_bo_kunit_init(test, priv, size_big, NULL);
794-
795-
dma_resv_lock(bo_big->base.resv, NULL);
796-
err = ttm_bo_validate(bo_big, placement, &ctx);
797-
dma_resv_unlock(bo_big->base.resv);
798-
799-
KUNIT_EXPECT_EQ(test, err, 0);
800-
KUNIT_EXPECT_NOT_NULL(test, bo_big->resource);
801-
KUNIT_EXPECT_EQ(test, bo_big->resource->mem_type, mem_type);
802-
KUNIT_EXPECT_EQ(test, bo_small->resource->mem_type, TTM_PL_SYSTEM);
803-
KUNIT_EXPECT_TRUE(test, bo_small->ttm->page_flags & TTM_TT_FLAG_SWAPPED);
804-
805-
ttm_bo_put(bo_big);
806-
ttm_bo_put(bo_small);
807-
808-
ttm_mock_manager_fini(priv->ttm_dev, mem_type);
809-
}
810-
811761
static void ttm_bo_validate_happy_evict(struct kunit *test)
812762
{
813763
u32 mem_type = TTM_PL_VRAM, mem_multihop = TTM_PL_TT,
@@ -1202,7 +1152,6 @@ static struct kunit_case ttm_bo_validate_test_cases[] = {
12021152
KUNIT_CASE(ttm_bo_validate_move_fence_signaled),
12031153
KUNIT_CASE_PARAM(ttm_bo_validate_move_fence_not_signaled,
12041154
ttm_bo_validate_wait_gen_params),
1205-
KUNIT_CASE(ttm_bo_validate_swapout),
12061155
KUNIT_CASE(ttm_bo_validate_happy_evict),
12071156
KUNIT_CASE(ttm_bo_validate_all_pinned_evict),
12081157
KUNIT_CASE(ttm_bo_validate_allowed_only_evict),

0 commit comments

Comments
 (0)