Currently ttm_pool_fini_basic() checks if page count of pool-type's lru
list is zero after tearing down its pre-populated pool.

After commit 5ffdc8f83613 ("ttm/pool: Don't leak LRU list on shutdown")
this check causes NULL dereference because page's lru list is destroyed
during pool's teardown which leads to KUnit's crash:

[20:08:24] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ==========
[20:08:24] [PASSED] ttm_pool_alloc_order_caching_match
[20:08:24] [PASSED] ttm_pool_alloc_caching_mismatch
[20:08:24] [PASSED] ttm_pool_alloc_order_mismatch
[20:08:24] [PASSED] ttm_pool_free_dma_alloc
[20:08:24] [PASSED] ttm_pool_free_no_dma_alloc
[20:08:25] [ERROR] Test: ttm_pool: missing expected subtest!
[20:08:25]
[20:08:25] Pid: 80, comm: kunit_try_catch Tainted: G        W        N  
7.4.0-rc4-g401a3e7b64d1
[20:08:25] RIP: 0033:list_lru_count_node+0xe/0x20
[20:08:25] RSP: 00000000a08dbef8  EFLAGS: 00010246
[20:08:25] RAX: 0000000000000001 RBX: 00000000a0803c70 RCX: 0000000000000020
[20:08:25] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000060853030
[20:08:25] RBP: 0000000060853000 R08: 00000000a08dbe98 R09: 00000000601246ac
[20:08:25] R10: 000000009f227d00 R11: 0000000000000000 R12: 0000000060124640
[20:08:25] R13: 0000000060853030 R14: 000000006047c950 R15: 00000000604c6488
[20:08:25] Kernel panic - not syncing: Segfault with no mm
[20:08:25] [CRASHED]
[20:08:25] [ERROR] Test: ttm_pool: missing subtest result line!
[20:08:25] # module: ttm_pool_test
[20:08:25] ==================== [CRASHED] ttm_pool ====================
[20:08:25] [ERROR] Test: main: missing expected subtest!
[20:08:25] [CRASHED]
[20:08:25] [ERROR] Test: main: missing expected subtest!
[20:08:25] [CRASHED]
[20:08:25] [ERROR] Test: main: missing expected subtest!
[20:08:25] [CRASHED]
[20:08:25] [ERROR] Test: main: missing expected subtest!
[20:08:25] [CRASHED]
[20:08:25] ============================================================
[20:08:25] Testing complete. Ran 28 tests: passed: 23, crashed: 5, errors: 6

The crash in turn prevents Xe CI from running IGT.

Drop the post-teardown assertion.

Fixes: 5ffdc8f83613 ("ttm/pool: Don't leak LRU list on shutdown")
Cc: Ian Forbes <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Michał Grzelak <[email protected]>
---
 drivers/gpu/drm/ttm/tests/ttm_pool_test.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/tests/ttm_pool_test.c 
b/drivers/gpu/drm/ttm/tests/ttm_pool_test.c
index be75c8abf3883..dab03dd6c9dd7 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_pool_test.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_pool_test.c
@@ -401,8 +401,6 @@ static void ttm_pool_fini_basic(struct kunit *test)
        KUNIT_ASSERT_FALSE(test, !list_lru_count(&pt->pages));
 
        ttm_pool_fini(pool);
-
-       KUNIT_ASSERT_TRUE(test, !list_lru_count(&pt->pages));
 }
 
 static struct kunit_case ttm_pool_test_cases[] = {
-- 
2.45.2

Reply via email to