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: Mon, 25 May 2026 19:32:33 +1000	[thread overview]
Message-ID: <review-patch3-20260521223756.627311-4-maaz.mombasawala@broadcom.com> (raw)
In-Reply-To: <20260521223756.627311-4-maaz.mombasawala@broadcom.com>

Patch Review

**Purpose:** Fix `dma_resv_assert_held` warnings by reserving the TTM buffer object before operations that require the reservation to be held.

**Issues:**

1. **`ttm_bo_reserve` in `vmw_bo_free` — potential deadlock concern:** In `vmw_bo_free`, the buffer object is being freed (refcount is 0, per the `WARN_ON` at line 45). Calling `ttm_bo_reserve(bo, false, false, NULL)` on a BO whose refcount is already 0 is unusual. The reservation is typically held by something with a live reference. Since this is a teardown path and no other thread should hold a reference, the reservation should succeed immediately, but this pattern is fragile. If anything else tries to acquire the reservation concurrently (which shouldn't happen given refcount==0), it could deadlock with `interruptible=false, no_wait=false`.

```c
ttm_bo_reserve(bo, false, false, NULL);
vmw_resource_mob_detach(res);
ttm_bo_unreserve(bo);
```

Consider whether `dma_resv_lock` directly (without going through `ttm_bo_reserve`) would be more appropriate here, or whether the callers already guarantee the reservation is held and the real fix should be elsewhere.

2. **Missing Fixes tag:** No `Fixes:` tag on this patch, despite addressing concrete warnings.

3. **VKMS CRC worker — `goto done` skips `compute_crc` but still unreferences:** The error handling in `crc_generate_worker` looks correct — on reserve failure, it jumps to `done:` which calls `vmw_surface_unreference`, which is the right cleanup. However, the blank line after `done:` is unnecessary:

```c
done:

	vmw_surface_unreference(&surf);
```

4. **VKMS reserve — is `guest_memory_bo` guaranteed non-NULL?** The code does:
```c
ret = ttm_bo_reserve(&surf->res.guest_memory_bo->tbo, false, false, NULL);
```
If `surf->res.guest_memory_bo` could be NULL, this would oops. Looking at the flow, `vmw_surface_sync` succeeded so the surface should have a valid backing BO, but a NULL check or assertion might be prudent.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-25  9:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 22:37 [PATCH v4 0/4] Fix some issues from igt runs Maaz Mombasawala
2026-05-21 22:37 ` [PATCH v4 1/4] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-25  9:32   ` Claude review: " Claude Code Review Bot
2026-05-21 22:37 ` [PATCH v4 2/4] drm/vmwgfx: Check vrefresh in drm_mode_setcrtc Maaz Mombasawala
2026-05-25  9:32   ` Claude review: " Claude Code Review Bot
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 Code Review Bot [this message]
2026-05-21 22:37 ` [PATCH v4 4/4] drm/vmwgfx: Change ttm refs for dumb buffers Maaz Mombasawala
2026-05-25  9:32   ` Claude review: " Claude Code Review Bot
2026-05-25  9:32 ` Claude review: Fix some issues from igt runs Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-14 22:48 [PATCH v3 0/5] " 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-20260521223756.627311-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