public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/ttm: Support 52-bit PAs in ttm_place
Date: Sat, 16 May 2026 11:53:55 +1000	[thread overview]
Message-ID: <review-patch1-20260513141253.20410-1-felix.kuehling@amd.com> (raw)
In-Reply-To: <20260513141253.20410-1-felix.kuehling@amd.com>

Patch Review

**Commit message vs. code mismatch:**

The commit message says:
> Grow these to **unsigned long** to support larger physical addresses.

But the actual diff changes the type to `uint64_t`, not `unsigned long`:

```c
-	unsigned	fpfn;
-	unsigned	lpfn;
+	uint64_t	fpfn;
+	uint64_t	lpfn;
```

The code change (`uint64_t`) is actually the better choice — `unsigned long` would only be 32 bits on 32-bit architectures, which wouldn't achieve the stated goal. The commit message should be updated to say `uint64_t` to match the code.

**Title says "52-bit" but no justification:**

The subject line says "52-bit PAs" but neither the commit message nor the code explains why 52 bits specifically. With `uint64_t` page numbers and 4KB pages, the theoretical limit is 64+12 = 76-bit addressing. The title should either say "larger PAs" generically or explain why 52-bit is the relevant target (likely ARM64's 52-bit PA extension or x86's 5-level paging).

**Missing driver-side audit:**

The patch only changes the struct definition but doesn't audit the 21+ driver files that use `fpfn`/`lpfn`. Potential issues include:

1. **Truncation on assignment:** Drivers that assign `fpfn`/`lpfn` from 32-bit variables are fine (implicit widening), but any driver storing the result of these fields back into a 32-bit variable could truncate silently.

2. **Format strings:** Any `printk`/`drm_dbg` calls that print fpfn/lpfn with `%u` or `%x` will now produce warnings or incorrect output — they need `%llu` or `PRIu64`.

3. **`struct ttm_resource.start`** is `unsigned long`, which is 32-bit on 32-bit platforms. If fpfn/lpfn values >32 bits flow into `start`, there's a truncation path. On 64-bit platforms `unsigned long` is 64-bit so this isn't an issue in practice, but it's worth noting.

4. **Structure size change:** `struct ttm_place` grows from 16 bytes to 24 bytes (with padding). Since placements are typically small static/stack arrays, this shouldn't be a performance concern, but it's worth noting for any driver that allocates large arrays of `ttm_place`.

**Verdict:**

The code change itself is correct and desirable — `uint64_t` is the right type for page frame numbers that need to exceed 32-bit range. However:

- Fix the commit message to say `uint64_t` instead of `unsigned long`.
- Consider explaining *why* 52-bit in the subject, or generalize the title.
- An audit of callers for truncation and format string issues would strengthen this patch (or could be a follow-up).

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-16  1:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 14:12 [PATCH v2] drm/ttm: Support 52-bit PAs in ttm_place Felix Kuehling
2026-05-13 14:19 ` Christian König
2026-05-13 14:27   ` Kuehling, Felix
2026-05-13 14:50     ` Arunpravin Paneer Selvam
2026-05-13 14:50 ` Tvrtko Ursulin
2026-05-13 15:32   ` Christian König
2026-05-16  1:53 ` Claude review: " Claude Code Review Bot
2026-05-16  1:53 ` Claude Code Review Bot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-05-12 22:31 [PATCH] " Felix Kuehling
2026-05-16  2:38 ` Claude review: " Claude Code Review Bot
2026-05-16  2:39 ` 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-20260513141253.20410-1-felix.kuehling@amd.com \
    --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