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: Add a new guard for our custom resume_and_get() PM helper
Date: Sat, 16 May 2026 11:40:46 +1000	[thread overview]
Message-ID: <review-patch6-20260513-panthor-guard-refactor-v1-6-f2d8c15a97ce@collabora.com> (raw)
In-Reply-To: <20260513-panthor-guard-refactor-v1-6-f2d8c15a97ce@collabora.com>

Patch Review

This patch has the most concerning changes:

**API signature change:**
```c
-static inline int panthor_device_resume_and_get(struct panthor_device *ptdev)
+static inline int panthor_device_resume_and_get(struct device *dev)
```
The function now takes `struct device *` instead of `struct panthor_device *`, to match the signature expected by the `DEFINE_GUARD_COND` mechanism (which passes through the type from the base guard `pm_runtime_active_auto`, which operates on `struct device *`). This is the right call for making the guard work, but it changes the API for all callers. The patch does update the callsites accordingly.

**Guard definition:**
```c
DEFINE_GUARD_COND(pm_runtime_active_auto, _try_enabled_or_suspend,
          panthor_device_resume_and_get(_T), _RET == 0)
```
This overloads the existing `pm_runtime_active_auto` guard with a new `_try_enabled_or_suspend` variant. The new variant calls `panthor_device_resume_and_get()` instead of the standard `pm_runtime_resume_and_get()`. On exit, it calls `pm_runtime_put_autosuspend()` (inherited from the base guard).

**Concern: `pm_runtime_mark_last_busy()` is dropped:**
The original `tick_work()` called:
```c
pm_runtime_mark_last_busy(ptdev->base.dev);
pm_runtime_put_autosuspend(ptdev->base.dev);
```
The guard only calls `pm_runtime_put_autosuspend()` on cleanup. The `pm_runtime_mark_last_busy()` call is **removed and not replaced**. This means the autosuspend timer won't be reset when the tick completes, potentially causing earlier-than-expected device suspension. The same issue applies to `queue_run_job()`. **This is a behavioral change that could cause power management regressions** — the autosuspend delay effectively starts from the last `mark_last_busy` call, and without it, the timeout may expire sooner than intended.

The commit message says "Overload the already existing pm_runtime_active_auto_try_enabled guard" but it's actually creating a new variant (`_try_enabled_or_suspend`), not overloading an existing one. The name is also panthor-specific (referencing the "or suspend" recovery behavior), but it's defined via the generic pm_runtime guard infrastructure. **This is a panthor-specific function injected into a generic guard namespace**, which may not sit well with PM maintainers. Consider defining a separate `panthor_pm` guard instead.

**Verbosity of the ACQUIRE pattern:**
```c
ACQUIRE(pm_runtime_active_auto_try_enabled_or_suspend, pm_guard)(ptdev->base.dev);
ret = ACQUIRE_ERR(pm_runtime_active_auto_try_enabled_or_suspend, &pm_guard);
```
This is significantly less readable than the original `ret = panthor_device_resume_and_get(ptdev);`. The guard name is 46 characters long. While functionally correct, this is a readability regression at the callsites. A shorter alias or a panthor-specific guard would help.

**Typo in commit message:** "force the state to suspened" should be "suspended".

---
Generated by Claude Code Patch Reviewer

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

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 16:58 [PATCH 0/6] drm/panthor: Use guards Boris Brezillon
2026-05-13 16:58 ` [PATCH 1/6] drm/panthor: Driver-wide xxx_[un]lock -> [scoped_]guard replacement Boris Brezillon
2026-05-14 13:16   ` Steven Price
2026-05-14 17:09     ` Chia-I Wu
2026-05-16  1:40   ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 2/6] dma-resv: Define guards for context-less dma_resv locks Boris Brezillon
2026-05-14 18:23   ` Chia-I Wu
2026-05-16  1:40   ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 3/6] drm: Define a conditional guard for drm_dev_{enter,exit}() Boris Brezillon
2026-05-14 18:34   ` [PATCH 3/6] drm: Define a conditional guard for drm_dev_{enter, exit}() Chia-I Wu
2026-05-16  1:40   ` Claude review: drm: Define a conditional guard for drm_dev_{enter,exit}() Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 4/6] drm/panthor: Use guards for resv locking Boris Brezillon
2026-05-14 18:35   ` Chia-I Wu
2026-05-16  1:40   ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 5/6] drm/panthor: Use the drm_dev_access guard Boris Brezillon
2026-05-14 18:36   ` Chia-I Wu
2026-05-16  1:40   ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 6/6] drm/panthor: Add a new guard for our custom resume_and_get() PM helper Boris Brezillon
2026-05-14 18:39   ` Chia-I Wu
2026-05-16  1:40   ` Claude Code Review Bot [this message]
2026-05-16  1:40 ` Claude review: drm/panthor: Use guards 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-patch6-20260513-panthor-guard-refactor-v1-6-f2d8c15a97ce@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