From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/msm/snapshot: fix dumping of the unaligned regions
Date: Sat, 16 May 2026 08:44:41 +1000 [thread overview]
Message-ID: <review-patch1-20260516-msm-fix-dsi-dump-2-v1-1-43928094d25b@oss.qualcomm.com> (raw)
In-Reply-To: <20260516-msm-fix-dsi-dump-2-v1-1-43928094d25b@oss.qualcomm.com>
Patch Review
**Debug filter left in — NAK as-is**
At line 187-188 of the patched file:
```c
if (strcmp(fmt, "dsi%d_ctrl"))
return;
```
This is clearly debug scaffolding used during development to limit snapshot capture to only DSI controller blocks. `strcmp` returns non-zero (true) for any string that does NOT match `"dsi%d_ctrl"`, so this causes `msm_disp_snapshot_add_block()` to silently return without capturing any DPU, DP, or other display hardware blocks. This is a serious regression that must be removed.
**16x overallocation fix — correct**
The original code had:
```c
len_padded = aligned_len * REG_DUMP_ALIGN;
```
where `aligned_len` was already aligned to 16 bytes. This multiplied by 16 again, allocating 16x the needed memory. The fix correctly uses:
```c
len_padded = round_up(len, REG_DUMP_ALIGN);
```
**`DIV_ROUND_UP` for num_rows — correct**
Changing from `aligned_len / REG_DUMP_ALIGN` (which relied on pre-alignment) to `DIV_ROUND_UP(len, REG_DUMP_ALIGN)` correctly handles unaligned lengths by producing enough rows to cover the full region.
**`end_addr` tracking — correct**
Setting `end_addr = base_addr + len` (using the raw, unaligned length) ensures the per-register bounds checks in the dump loop:
```c
x0 = (addr < end_addr) ? readl_relaxed(addr + 0x0) : 0;
x4 = (addr + 0x4 < end_addr) ? readl_relaxed(addr + 0x4) : 0;
```
correctly avoid MMIO reads past the valid register region. This was already present in the pre-patch code but only works correctly now that `end_addr` uses the true length.
**Print tail handling — correct but minor style nit**
The new tail section in `msm_disp_state_print_regs` (lines 72-81):
```c
if (addr != end_addr) {
drm_printf(p, "0x%lx : %08x",
(unsigned long)(addr - base_addr),
dump_addr[i * 4]);
if (addr + 0x4 < end_addr)
drm_printf(p, " %08x", dump_addr[i * 4 + 1]);
if (addr + 0x8 < end_addr)
drm_printf(p, " %08x", dump_addr[i * 4 + 2]);
drm_printf(p, "\n");
}
```
The logic is correct: after printing full 4-register rows via `num_rows = len / REG_DUMP_ALIGN` (floor division), the tail handles the 1-3 remaining registers. The buffer accesses are safe because the dump function allocated `round_up(len, REG_DUMP_ALIGN)` bytes. One minor observation: the first register in the tail (`dump_addr[i * 4]`) is printed unconditionally — this is safe because the `addr != end_addr` guard ensures at least one register remains.
**Removing alignment from the caller — correct**
Changing `new_blk->size = ALIGN(len, REG_DUMP_ALIGN)` to `new_blk->size = len` moves alignment responsibility into the dump/print functions where it belongs. The raw length is needed to correctly bound MMIO reads and partial-row printing.
**Summary**: Remove the `strcmp(fmt, "dsi%d_ctrl")` debug filter and this patch is ready. The alignment fixes and tail-printing logic are sound.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-15 22:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 21:40 [PATCH] drm/msm/snapshot: fix dumping of the unaligned regions Dmitry Baryshkov
2026-05-15 22:44 ` Claude review: " Claude Code Review Bot
2026-05-15 22:44 ` Claude Code Review Bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-05-16 11:53 [PATCH v2] " Dmitry Baryshkov
2026-05-18 6:49 ` Claude review: " Claude Code Review Bot
2026-05-18 6:49 ` 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-20260516-msm-fix-dsi-dump-2-v1-1-43928094d25b@oss.qualcomm.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