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/vmwgfx: Reserve ttm object before resv usage
Date: Thu, 04 Jun 2026 13:30:07 +1000	[thread overview]
Message-ID: <review-patch3-20260602004203.102901-4-maaz.mombasawala@broadcom.com> (raw)
In-Reply-To: <20260602004203.102901-4-maaz.mombasawala@broadcom.com>

Patch Review

**Status: Has issues in error handling**

The intent is correct — `vmw_resource_mob_detach()` calls `dma_resv_assert_held()`, so the buffer object's reservation must be held.

**Issue in `vmw_bo_free` (vmwgfx_bo.c)**: If `ttm_bo_reserve()` fails, the code warns but continues to call both `vmw_resource_mob_detach(res)` and `ttm_bo_unreserve(bo)`:
```c
ret = ttm_bo_reserve(bo, false, false, NULL);
if (ret != 0)
    drm_warn(&res->dev_priv->drm,
             "%s: failed reserve\n", __func__);
vmw_resource_mob_detach(res);   /* asserts lock held — will fire */
ttm_bo_unreserve(bo);           /* unreserves without holding reservation */
```

If the reserve fails:
1. `vmw_resource_mob_detach` will hit the `dma_resv_assert_held` assertion — the very thing this patch is meant to fix.
2. `ttm_bo_unreserve` on a non-reserved BO is undefined behavior (likely corrupts the ww_mutex state).

In practice, `ttm_bo_reserve(bo, false, false, NULL)` (non-interruptible, blocking) should essentially never fail, but since v5 explicitly added this check per review feedback, the error path should be correct. A simple approach would be to gate the unreserve:
```c
ret = ttm_bo_reserve(bo, false, false, NULL);
if (ret != 0)
    drm_warn(...);
vmw_resource_mob_detach(res);
if (ret == 0)
    ttm_bo_unreserve(bo);
```
Or skip the detach on failure if that's safe for the destroy path.

**The `crc_generate_worker` change (vmwgfx_vkms.c)** looks correct — the `goto done` properly skips `compute_crc` and falls through to `vmw_surface_unreference(&surf)`.

**Missing tags**: This patch is also missing `Fixes:` and `Cc: stable` tags despite fixing lockdep/dma_resv assertion warnings.

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04  3:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  0:41 [PATCH v5 0/4] Fix some issues from igt runs Maaz Mombasawala
2026-06-02  0:42 ` [PATCH v5 1/4] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-06-04  3:30   ` Claude review: " Claude Code Review Bot
2026-06-02  0:42 ` [PATCH v5 2/4] drm/vmwgfx: Check vrefresh in drm_mode_setcrtc Maaz Mombasawala
2026-06-04  3:30   ` Claude review: " Claude Code Review Bot
2026-06-02  0:42 ` [PATCH v5 3/4] drm/vmwgfx: Reserve ttm object before resv usage Maaz Mombasawala
2026-06-04  3:30   ` Claude Code Review Bot [this message]
2026-06-02  0:42 ` [PATCH v5 4/4] drm/vmwgfx: Change ttm refs for dumb buffers Maaz Mombasawala
2026-06-04  3:30   ` Claude review: " Claude Code Review Bot
2026-06-04  3:30 ` Claude review: Fix some issues from igt runs Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-21 22:37 [PATCH v4 0/4] " Maaz Mombasawala
2026-05-21 22:37 ` [PATCH v4 3/4] drm/vmwgfx: Reserve ttm object before resv usage Maaz Mombasawala
2026-05-25  9:32   ` Claude review: " Claude Code Review Bot
2026-05-14 22:48 [PATCH v3 0/5] Fix some issues from igt runs Maaz Mombasawala
2026-05-14 22:48 ` [PATCH v3 3/5] drm/vmwgfx: Reserve ttm object before resv usage Maaz Mombasawala
2026-05-16  0:17   ` Claude review: " Claude Code Review Bot
2026-05-12  0:27 [PATCH v2 0/5] Fix some issues from igt runs Maaz Mombasawala
2026-05-12  0:27 ` [PATCH v2 3/5] drm/vmwgfx: Reserve ttm object before resv usage Maaz Mombasawala
2026-05-16  4:26   ` 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-patch3-20260602004203.102901-4-maaz.mombasawala@broadcom.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