From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/ttm/tests: Remove checks from ttm_pool_free_no_dma_alloc
Date: Sun, 12 Apr 2026 11:03:53 +1000 [thread overview]
Message-ID: <review-patch1-20260409142658.1511941-2-dev@lankhorst.se> (raw)
In-Reply-To: <20260409142658.1511941-2-dev@lankhorst.se>
Patch Review
**Correctness: Good.** The removed assertions were fundamentally wrong for this test case. Looking at `ttm_pool_select_type()` (`ttm_pool.c:401`):
```c
static struct ttm_pool_type *ttm_pool_select_type(struct ttm_pool *pool,
enum ttm_caching caching,
unsigned int order)
{
if (ttm_pool_uses_dma_alloc(pool))
return &pool->caching[caching].orders[order];
#ifdef CONFIG_X86
switch (caching) {
case ttm_write_combined:
...
return &global_write_combined[order];
case ttm_uncached:
...
return &global_uncached[order];
```
When `alloc_flags=0` (no DMA alloc), `ttm_pool_init()` skips `ttm_pool_type_init()` for `pool->caching[caching].orders[order]` because `ttm_pool_select_type()` returns either a global pool (x86) or NULL (!x86) — never the pool's own entry. The test was accessing an uninitialized `list_lru`, which is undefined behavior on any architecture.
Note that the sibling test `ttm_pool_free_dma_alloc` (which passes `TTM_ALLOCATION_POOL_USE_DMA_ALLOC`) correctly accesses `pool->caching[caching].orders[order]` because `ttm_pool_select_type()` *does* return the per-pool entry in that case, and `ttm_pool_type_init()` initializes it.
**Minor nits:**
1. **Commit message grammar:** "I'm not sure how that it was supposed to work previously" — the word "that" appears extraneous. Should be "I'm not sure how it was supposed to work previously."
2. **Duplicate Cc:** Christian König is Cc'd twice (once with the ö, once as "Koenig"). This is harmless but unnecessary.
3. **Test value:** After this patch, the test performs `ttm_pool_alloc` + `ttm_pool_free` + `ttm_pool_fini` with no assertions beyond the initial setup checks. It still has value as a crash/leak regression test, but it might be worth adding a TODO comment or a follow-up to add meaningful assertions — e.g., verifying pages were returned to the global pool (on x86) or freed to the system (on !x86). The commit message says "reverting for now" which implies this is intended as temporary, but in practice such things tend to persist.
4. **Pre-existing issue in the original test:** Even before the `list_lru` rewrite, the original test's assertions were conceptually wrong — they were checking the pool's own `ttm_pool_type` entry, but without DMA alloc, pages never go through that entry. On x86 they go to `global_uncached[order]`, and on !x86 they're freed directly. This suggests the original test (from the `list_lru` port commit `444e2a19d7fd`) had a latent bug that was masked by the old `list_head`-based pool implementation. This is consistent with the commit message's observation.
Overall this is a straightforward and correct CI fix. No functional concerns.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-04-12 1:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 14:26 [PATCH] drm/ttm/tests: Remove checks from ttm_pool_free_no_dma_alloc Maarten Lankhorst
2026-04-12 1:03 ` Claude Code Review Bot [this message]
2026-04-12 1:03 ` Claude review: " Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=review-patch1-20260409142658.1511941-2-dev@lankhorst.se \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox