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/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe
Date: Tue, 28 Apr 2026 14:52:59 +1000	[thread overview]
Message-ID: <review-patch1-20260427075856.85208-2-clamor95@gmail.com> (raw)
In-Reply-To: <20260427075856.85208-2-clamor95@gmail.com>

Patch Review

**Issue: Wrong ordering of pm_runtime calls (moderate)**

In both gr2d and gr3d, the patch adds:

```c
pm_runtime_enable(dev);
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, 500);
```

The standard kernel pattern is the reverse — configure autosuspend *before* enabling runtime PM:

```c
pm_runtime_set_autosuspend_delay(dev, 500);
pm_runtime_use_autosuspend(dev);
pm_runtime_enable(dev);
```

Once `pm_runtime_enable()` is called, the runtime PM subsystem is live and can immediately attempt to suspend the device. If autosuspend isn't configured yet, there's a window where a `pm_runtime_put()` could trigger an immediate suspend rather than the intended 500ms delayed autosuspend. The delay should be set first, then autosuspend enabled, then finally runtime PM enabled.

This ordering issue existed in the original `runtime_resume` code too, but there it was less consequential since the device was already actively resuming. In `probe()`, with PM freshly enabled, it matters more.

**Observation: Placement relative to host1x_client_register (minor)**

The `pm_runtime_enable()` is placed after `host1x_client_register()`. If the host1x framework synchronously invokes `gr*d_init()` during registration, and that callback (or anything it triggers) does `pm_runtime_get_sync()`, the resume callback won't fire because runtime PM isn't enabled yet. In practice this is likely safe because `host1x_client_register` just adds the client to a list, but it's worth considering whether enabling PM before registration would be more robust. That would require adding `pm_runtime_disable()` to the error path for `host1x_client_register()` failure though.

**Observation: Missing Fixes tag**

If this addresses a real bug (runtime PM never properly enabled on first boot without a sleep/resume cycle), a `Fixes:` tag referencing the commit that originally placed `pm_runtime_enable` inside `runtime_resume` would help stable backport triage.

**Style nit: gr3d uses `&pdev->dev` vs gr2d uses `dev`**

In `gr2d_probe`, there's a local `struct device *dev = &pdev->dev;`, so the patch correctly uses `dev`. In `gr3d_probe`, there's no such local variable, so `&pdev->dev` is used. This is consistent with the existing code in each file — no issue, just noting the difference.

**Summary**: The change is correct in principle and fixes a real bug. Please reorder the three calls so `pm_runtime_enable()` comes last (after configuring autosuspend), and consider adding a `Fixes:` tag.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-04-28  4:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  7:58 [PATCH v1 0/1] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe Svyatoslav Ryhel
2026-04-27  7:58 ` [PATCH v1 1/1] " Svyatoslav Ryhel
2026-04-28  1:52   ` Mikko Perttunen
2026-04-28  4:52   ` Claude Code Review Bot [this message]
2026-04-28  4:52 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-03 16:38 [PATCH v2 0/2] " Svyatoslav Ryhel
2026-05-04 22:41 ` Claude review: " 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-20260427075856.85208-2-clamor95@gmail.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