]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/ttm: fix locking in test ttm_bo_validate_no_placement_signaled
authorChristian König <christian.koenig@amd.com>
Thu, 10 Jul 2025 13:45:20 +0000 (15:45 +0200)
committerChristian König <christian.koenig@amd.com>
Wed, 16 Jul 2025 09:17:18 +0000 (11:17 +0200)
The test works even without it, but lockdep starts screaming when it is
activated.

Trivially fix it by acquiring the lock before we try to allocate
something.

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-1-christian.koenig@amd.com
drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c

index 3148f5d3dbd664f0d602e4d6be8c741b171ff9fc..38f4767873026469c0f46e639d2c9a780fa318e6 100644 (file)
@@ -542,14 +542,15 @@ static void ttm_bo_validate_no_placement_signaled(struct kunit *test)
                bo->ttm = old_tt;
        }
 
-       err = ttm_resource_alloc(bo, place, &bo->resource, NULL);
-       KUNIT_EXPECT_EQ(test, err, 0);
-       KUNIT_ASSERT_EQ(test, man->usage, size);
-
        placement = kunit_kzalloc(test, sizeof(*placement), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, placement);
 
        ttm_bo_reserve(bo, false, false, NULL);
+
+       err = ttm_resource_alloc(bo, place, &bo->resource, NULL);
+       KUNIT_EXPECT_EQ(test, err, 0);
+       KUNIT_ASSERT_EQ(test, man->usage, size);
+
        err = ttm_bo_validate(bo, placement, &ctx);
        ttm_bo_unreserve(bo);