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 won't 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.koe...@amd.com>
---
 .../gpu/drm/ttm/tests/ttm_bo_validate_test.c  | 51 -------------------
 1 file changed, 51 deletions(-)

diff --git a/drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c 
b/drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
index 38f476787302..1bcc67977f48 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
@@ -758,56 +758,6 @@ static void ttm_bo_validate_move_fence_not_signaled(struct 
kunit *test)
        ttm_mock_manager_fini(priv->ttm_dev, snd_mem);
 }
 
-static void ttm_bo_validate_swapout(struct kunit *test)
-{
-       unsigned long size_big, size = ALIGN(BO_SIZE, PAGE_SIZE);
-       enum ttm_bo_type bo_type = ttm_bo_type_device;
-       struct ttm_buffer_object *bo_small, *bo_big;
-       struct ttm_test_devices *priv = test->priv;
-       struct ttm_operation_ctx ctx = { };
-       struct ttm_placement *placement;
-       u32 mem_type = TTM_PL_TT;
-       struct ttm_place *place;
-       struct sysinfo si;
-       int err;
-
-       si_meminfo(&si);
-       size_big = ALIGN(((u64)si.totalram * si.mem_unit / 2), PAGE_SIZE);
-
-       ttm_mock_manager_init(priv->ttm_dev, mem_type, size_big + size);
-
-       place = ttm_place_kunit_init(test, mem_type, 0);
-       placement = ttm_placement_kunit_init(test, place, 1);
-
-       bo_small = kunit_kzalloc(test, sizeof(*bo_small), GFP_KERNEL);
-       KUNIT_ASSERT_NOT_NULL(test, bo_small);
-
-       drm_gem_private_object_init(priv->drm, &bo_small->base, size);
-
-       err = ttm_bo_init_reserved(priv->ttm_dev, bo_small, bo_type, placement,
-                                  PAGE_SIZE, &ctx, NULL, NULL,
-                                  &dummy_ttm_bo_destroy);
-       KUNIT_EXPECT_EQ(test, err, 0);
-       dma_resv_unlock(bo_small->base.resv);
-
-       bo_big = ttm_bo_kunit_init(test, priv, size_big, NULL);
-
-       dma_resv_lock(bo_big->base.resv, NULL);
-       err = ttm_bo_validate(bo_big, placement, &ctx);
-       dma_resv_unlock(bo_big->base.resv);
-
-       KUNIT_EXPECT_EQ(test, err, 0);
-       KUNIT_EXPECT_NOT_NULL(test, bo_big->resource);
-       KUNIT_EXPECT_EQ(test, bo_big->resource->mem_type, mem_type);
-       KUNIT_EXPECT_EQ(test, bo_small->resource->mem_type, TTM_PL_SYSTEM);
-       KUNIT_EXPECT_TRUE(test, bo_small->ttm->page_flags & 
TTM_TT_FLAG_SWAPPED);
-
-       ttm_bo_put(bo_big);
-       ttm_bo_put(bo_small);
-
-       ttm_mock_manager_fini(priv->ttm_dev, mem_type);
-}
-
 static void ttm_bo_validate_happy_evict(struct kunit *test)
 {
        u32 mem_type = TTM_PL_VRAM, mem_multihop = TTM_PL_TT,
@@ -1202,7 +1152,6 @@ static struct kunit_case ttm_bo_validate_test_cases[] = {
        KUNIT_CASE(ttm_bo_validate_move_fence_signaled),
        KUNIT_CASE_PARAM(ttm_bo_validate_move_fence_not_signaled,
                         ttm_bo_validate_wait_gen_params),
-       KUNIT_CASE(ttm_bo_validate_swapout),
        KUNIT_CASE(ttm_bo_validate_happy_evict),
        KUNIT_CASE(ttm_bo_validate_all_pinned_evict),
        KUNIT_CASE(ttm_bo_validate_allowed_only_evict),
-- 
2.34.1

Reply via email to