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/panthor: Don't use the racy drm_gem_lru_remove() helper
Date: Thu, 07 May 2026 13:31:56 +1000	[thread overview]
Message-ID: <review-patch1-20260506-panthor-shrinker-fixes-v1-1-e7721526de96@collabora.com> (raw)
In-Reply-To: <20260506-panthor-shrinker-fixes-v1-1-e7721526de96@collabora.com>

Patch Review

**Approach:** Instead of calling `drm_gem_lru_remove()` when a BO becomes unreclaimable (which is racy), add a new `unreclaimable` LRU list and move BOs there instead. All BOs start in this list at creation time.

This is the right fix for the panthor side. The key change in `panthor_gem_update_reclaim_state_locked()`:

```c
case PANTHOR_GEM_UNRECLAIMABLE:
-	drm_gem_lru_remove(&bo->base);
+	drm_gem_lru_move_tail(&ptdev->reclaim.unreclaimable, &bo->base);
```

`drm_gem_lru_move_tail()` acquires the lock internally and is safe because it doesn't read `obj->lru` before acquiring the lock — it takes the target LRU's lock directly.

The addition in `panthor_gem_create()` is correct:

```c
+	drm_gem_lru_move_tail(&ptdev->reclaim.unreclaimable, &bo->base);
	return bo;
```

This ensures every BO is in a real (heap-allocated, long-lived) LRU from creation. Without this, a BO created but never explicitly placed in an LRU would have `obj->lru == NULL`, and `drm_gem_object_release()` (after patch 3) would skip removal — that's fine, but having them tracked in a list is cleaner and consistent.

The init ordering in `panthor_gem_shrinker_init()` is correct — the `unreclaimable` LRU is initialized before the others, and all share the same `ptdev->reclaim.lock` mutex.

No issues found. Patch looks correct.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-07  3:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 12:16 [PATCH 0/3] drm/panthor: Fix a race in the shrinker logic Boris Brezillon
2026-05-06 12:16 ` [PATCH 1/3] drm/panthor: Don't use the racy drm_gem_lru_remove() helper Boris Brezillon
2026-05-06 15:40   ` Steven Price
2026-05-06 16:25     ` Boris Brezillon
2026-05-07  3:31   ` Claude Code Review Bot [this message]
2026-05-06 12:16 ` [PATCH 2/3] drm/gem: Fix a race between drm_gem_lru_scan() and drm_gem_object_release() Boris Brezillon
2026-05-06 13:21   ` Rob Clark
2026-05-06 14:33     ` Boris Brezillon
2026-05-07  3:31   ` Claude review: " Claude Code Review Bot
2026-05-06 12:16 ` [PATCH 3/3] drm/gem: Stop exposing the racy/unsafe drm_gem_lru_remove() helper Boris Brezillon
2026-05-06 15:40   ` Steven Price
2026-05-07  3:31   ` Claude review: " Claude Code Review Bot
2026-05-07  3:31 ` Claude review: drm/panthor: Fix a race in the shrinker logic 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-20260506-panthor-shrinker-fixes-v1-1-e7721526de96@collabora.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