* [PATCH] drm/ttm/tests: fix lru_count ASSERT
@ 2026-04-09 11:10 Matthew Auld
2026-04-09 12:07 ` Knop, Ryszard
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Matthew Auld @ 2026-04-09 11:10 UTC (permalink / raw)
To: intel-xe; +Cc: dri-devel, Matthew Brost, Christian Koenig, Dave Airlie
On pool init we should expect the lru_count for each node to be zeroed
as per __list_lru_init -> init_one_lru, but here we are asserting the
opposite.
Currently our CI is blowing up with:
10:23:33] # ttm_device_init_pools: ASSERTION FAILED at drivers/gpu/drm/ttm/tests/ttm_device_test.c:178
[10:23:33] Expected !list_lru_count(&pt.pages) to be false, but is true
[10:23:33] [FAILED] DMA allocations, DMA32 required
[10:23:33] [PASSED] No DMA allocations, DMA32 required
[10:23:33] # ttm_device_init_pools: ASSERTION FAILED at drivers/gpu/drm/ttm/tests/ttm_device_test.c:178
[10:23:33] Expected !list_lru_count(&pt.pages) to be false, but is true
Fixes: 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/ttm/tests/ttm_device_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/tests/ttm_device_test.c b/drivers/gpu/drm/ttm/tests/ttm_device_test.c
index db4b4a09a73f..8bcac84e9846 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_device_test.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_device_test.c
@@ -176,7 +176,7 @@ static void ttm_device_init_pools(struct kunit *test)
if (ttm_pool_uses_dma_alloc(pool))
KUNIT_ASSERT_FALSE(test,
- !list_lru_count(&pt.pages));
+ list_lru_count(&pt.pages));
}
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: drm/ttm/tests: fix lru_count ASSERT
2026-04-09 11:10 [PATCH] drm/ttm/tests: fix lru_count ASSERT Matthew Auld
@ 2026-04-09 12:07 ` Knop, Ryszard
2026-04-09 12:18 ` [PATCH] " Christian König
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Knop, Ryszard @ 2026-04-09 12:07 UTC (permalink / raw)
To: intel-xe@lists.freedesktop.org, Auld, Matthew
Cc: dri-devel@lists.freedesktop.org, Brost, Matthew,
christian.koenig@amd.com, airlied@redhat.com
LGTM, verified locally this fixes 2 KUnit errors. A few missing
expected subtests still remain though.
Reviewed-by: Ryszard Knop <ryszard.knop@intel.com>
On Thu, 2026-04-09 at 12:10 +0100, Matthew Auld wrote:
> On pool init we should expect the lru_count for each node to be zeroed
> as per __list_lru_init -> init_one_lru, but here we are asserting the
> opposite.
>
> Currently our CI is blowing up with:
>
> 10:23:33] # ttm_device_init_pools: ASSERTION FAILED at drivers/gpu/drm/ttm/tests/ttm_device_test.c:178
> [10:23:33] Expected !list_lru_count(&pt.pages) to be false, but is true
> [10:23:33] [FAILED] DMA allocations, DMA32 required
> [10:23:33] [PASSED] No DMA allocations, DMA32 required
> [10:23:33] # ttm_device_init_pools: ASSERTION FAILED at drivers/gpu/drm/ttm/tests/ttm_device_test.c:178
> [10:23:33] Expected !list_lru_count(&pt.pages) to be false, but is true
>
> Fixes: 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Cc: Dave Airlie <airlied@redhat.com>
> ---
> drivers/gpu/drm/ttm/tests/ttm_device_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/tests/ttm_device_test.c b/drivers/gpu/drm/ttm/tests/ttm_device_test.c
> index db4b4a09a73f..8bcac84e9846 100644
> --- a/drivers/gpu/drm/ttm/tests/ttm_device_test.c
> +++ b/drivers/gpu/drm/ttm/tests/ttm_device_test.c
> @@ -176,7 +176,7 @@ static void ttm_device_init_pools(struct kunit *test)
>
> if (ttm_pool_uses_dma_alloc(pool))
> KUNIT_ASSERT_FALSE(test,
> - !list_lru_count(&pt.pages));
> + list_lru_count(&pt.pages));
> }
> }
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/ttm/tests: fix lru_count ASSERT
2026-04-09 11:10 [PATCH] drm/ttm/tests: fix lru_count ASSERT Matthew Auld
2026-04-09 12:07 ` Knop, Ryszard
@ 2026-04-09 12:18 ` Christian König
2026-04-12 1:28 ` Claude review: " Claude Code Review Bot
2026-04-12 1:28 ` Claude Code Review Bot
3 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2026-04-09 12:18 UTC (permalink / raw)
To: Matthew Auld, intel-xe; +Cc: dri-devel, Matthew Brost, Dave Airlie
On 4/9/26 13:10, Matthew Auld wrote:
> On pool init we should expect the lru_count for each node to be zeroed
> as per __list_lru_init -> init_one_lru, but here we are asserting the
> opposite.
>
> Currently our CI is blowing up with:
>
> 10:23:33] # ttm_device_init_pools: ASSERTION FAILED at drivers/gpu/drm/ttm/tests/ttm_device_test.c:178
> [10:23:33] Expected !list_lru_count(&pt.pages) to be false, but is true
> [10:23:33] [FAILED] DMA allocations, DMA32 required
> [10:23:33] [PASSED] No DMA allocations, DMA32 required
> [10:23:33] # ttm_device_init_pools: ASSERTION FAILED at drivers/gpu/drm/ttm/tests/ttm_device_test.c:178
> [10:23:33] Expected !list_lru_count(&pt.pages) to be false, but is true
>
> Fixes: 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Cc: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/ttm/tests/ttm_device_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/tests/ttm_device_test.c b/drivers/gpu/drm/ttm/tests/ttm_device_test.c
> index db4b4a09a73f..8bcac84e9846 100644
> --- a/drivers/gpu/drm/ttm/tests/ttm_device_test.c
> +++ b/drivers/gpu/drm/ttm/tests/ttm_device_test.c
> @@ -176,7 +176,7 @@ static void ttm_device_init_pools(struct kunit *test)
>
> if (ttm_pool_uses_dma_alloc(pool))
> KUNIT_ASSERT_FALSE(test,
> - !list_lru_count(&pt.pages));
> + list_lru_count(&pt.pages));
> }
> }
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm/ttm/tests: fix lru_count ASSERT
2026-04-09 11:10 [PATCH] drm/ttm/tests: fix lru_count ASSERT Matthew Auld
` (2 preceding siblings ...)
2026-04-12 1:28 ` Claude review: " Claude Code Review Bot
@ 2026-04-12 1:28 ` Claude Code Review Bot
3 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-12 1:28 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/ttm/tests: fix lru_count ASSERT
Author: Matthew Auld <matthew.auld@intel.com>
Patches: 2
Reviewed: 2026-04-12T11:28:14.294748
---
This is a single-patch fix for a logic bug in the TTM pool KUnit test. The fix is straightforward and correct: a double-negation in an assertion was causing the test to assert the opposite of what was intended. The commit message is clear, includes CI failure output demonstrating the problem, and has the appropriate `Fixes:` tag.
**Verdict: Looks good.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm/ttm/tests: fix lru_count ASSERT
2026-04-09 11:10 [PATCH] drm/ttm/tests: fix lru_count ASSERT Matthew Auld
2026-04-09 12:07 ` Knop, Ryszard
2026-04-09 12:18 ` [PATCH] " Christian König
@ 2026-04-12 1:28 ` Claude Code Review Bot
2026-04-12 1:28 ` Claude Code Review Bot
3 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-12 1:28 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**The bug:** After pool initialization via `__list_lru_init -> init_one_lru`, the LRU count for each node should be zero. The original assertion had a spurious `!` negation:
```c
KUNIT_ASSERT_FALSE(test,
!list_lru_count(&pt.pages));
```
`KUNIT_ASSERT_FALSE(test, !list_lru_count(...))` means "assert that `!count` is false", which is equivalent to "assert count is **non-zero**". That's the opposite of what the test intended — it should be verifying the LRU is empty after initialization.
**The fix:** Removing the `!` gives:
```c
KUNIT_ASSERT_FALSE(test,
list_lru_count(&pt.pages));
```
This correctly asserts that `list_lru_count(&pt.pages)` is zero (falsy), matching the expected post-init state.
I confirmed that the kernel tree at `drivers/gpu/drm/ttm/tests/ttm_device_test.c:178-179` already has the corrected version (without the `!`), consistent with this fix having been applied on drm-next.
**Minor style observation:** Using `KUNIT_ASSERT_EQ(test, list_lru_count(&pt.pages), 0)` would make the intent unambiguous and avoid future confusion with negation, but the existing form is fine and consistent with current test style.
**Reviewed-by worthy:** Yes. The fix is correct, minimal, and well-described. The `Fixes:` tag is appropriate (references `444e2a19d7fd` which ported ttm/pool to list_lru and introduced this test).
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-12 1:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 11:10 [PATCH] drm/ttm/tests: fix lru_count ASSERT Matthew Auld
2026-04-09 12:07 ` Knop, Ryszard
2026-04-09 12:18 ` [PATCH] " Christian König
2026-04-12 1:28 ` Claude review: " Claude Code Review Bot
2026-04-12 1:28 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox