From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/v3d: Flush MMU TLB and cache during runtime resume
Date: Thu, 04 Jun 2026 15:23:15 +1000 [thread overview]
Message-ID: <review-patch2-20260530-v3d-fix-rpi4-freezes-v1-2-c2c8307da6ce@igalia.com> (raw)
In-Reply-To: <20260530-v3d-fix-rpi4-freezes-v1-2-c2c8307da6ce@igalia.com>
Patch Review
**Purpose:** `v3d_mmu_set_page_table()` called `v3d_mmu_flush_all()`, which is gated by `pm_runtime_get_if_active()`. During runtime resume (`v3d_power_resume()`), the PM status is `RPM_RESUMING`, not `RPM_ACTIVE`, so the flush was silently skipped — leaving stale TLB entries across power cycles.
**Solution:** Extract the actual flush sequence into a static `v3d_mmu_flush_all_locked()` helper that does the writes unconditionally, and have `v3d_mmu_set_page_table()` call it directly instead of going through the PM-gated wrapper.
**Analysis of `v3d_mmu.c` changes:**
The refactoring is clean:
1. `v3d_mmu_flush_all_locked()` (lines 45-68) contains the bare flush logic — MMUC flush + TLB clear, with error reporting. No PM reference management.
2. `v3d_mmu_flush_all()` (lines 70-82) becomes a thin wrapper: PM guard, call locked helper, put PM reference. The `goto pm_put` is removed in favor of early return from the locked helper, which simplifies the control flow.
3. `v3d_mmu_set_page_table()` (line 101) now calls `v3d_mmu_flush_all_locked()` directly.
**Caller analysis:**
- `v3d_mmu_set_page_table()` is called from `v3d_power_resume()` and `v3d_reset()`. In both cases V3D is known reachable (resume has just re-enabled the clock; reset holds a PM ref). So the unconditional flush is correct in both paths.
- `v3d_mmu_insert_ptes()` and `v3d_mmu_remove_ptes()` still use the PM-gated `v3d_mmu_flush_all()`, which is correct — those are called from BO create/destroy paths where the device may or may not be active.
- `v3d_irq.c:79` also uses the PM-gated wrapper, which is fine since the IRQ handler runs while the device is active (and the PM-get confirms it).
**Verdict: This is the key fix in the series. The analysis is sound and the implementation is correct.**
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 5:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 18:37 [PATCH 0/4] drm/v3d: Fix RPi 4 system hangs from stale cache and MMU state Maíra Canal
2026-05-30 18:37 ` [PATCH 1/4] drm/v3d: Wait for pending L2T flush before cleaning caches Maíra Canal
2026-06-04 5:23 ` Claude review: " Claude Code Review Bot
2026-05-30 18:37 ` [PATCH 2/4] drm/v3d: Flush MMU TLB and cache during runtime resume Maíra Canal
2026-06-04 5:23 ` Claude Code Review Bot [this message]
2026-05-30 18:37 ` [PATCH 3/4] drm/v3d: Clean caches before runtime suspend Maíra Canal
2026-06-04 5:23 ` Claude review: " Claude Code Review Bot
2026-05-30 18:37 ` [PATCH 4/4] drm/v3d: Reduce PM runtime autosuspend delay Maíra Canal
2026-06-04 5:23 ` Claude review: " Claude Code Review Bot
2026-06-04 5:23 ` Claude review: drm/v3d: Fix RPi 4 system hangs from stale cache and MMU state 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-patch2-20260530-v3d-fix-rpi4-freezes-v1-2-c2c8307da6ce@igalia.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