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: Sat, 16 May 2026 14:26:31 +1000	[thread overview]
Message-ID: <review-patch3-20260512002752.2826685-4-maaz.mombasawala@broadcom.com> (raw)
In-Reply-To: <20260512002752.2826685-4-maaz.mombasawala@broadcom.com>

Patch Review

**vmw_bo_free fix is correct.** Looking at `vmw_resource_mob_detach`, it calls `dma_resv_assert_held(gbo->tbo.base.resv)`, which requires the TTM BO reservation lock to be held. `vmw_resource_reserve` does NOT acquire the BO reservation lock — it only takes the resource off the LRU list and optionally allocates a guest memory buffer. So the added `ttm_bo_reserve`/`ttm_bo_unreserve` around `vmw_resource_mob_detach` in `vmw_bo_free` is necessary:

```c
			(void)vmw_resource_reserve(res, false, true);
+			ttm_bo_reserve(bo, false, false, NULL);
			vmw_resource_mob_detach(res);
+			ttm_bo_unreserve(bo);
```

However, the return value of `ttm_bo_reserve` is not checked. It's called with `interruptible=false` and `no_wait=false`, so it should only fail if the BO is being destroyed — but since we're *in* the BO's free callback, this is the BO being destroyed. This is a potential concern: can you successfully reserve a BO that is in the process of being freed (refcount == 0, as asserted at line 45)? The `vmw_resource_release` path does `BUG_ON(ret)` for the same call, so at minimum the error should not be silently ignored.

**vkms crc_generate_worker fix — goto skips vmw_surface_unreference.** The error path jumps to `done:` which falls through to `vmw_surface_unreference(&surf)`, so the surface reference is properly released. However, the blank line after `done:` is unnecessary style-wise:

```c
+done:
+
 		vmw_surface_unreference(&surf);
```

**The reservation scope is wider than necessary in vkms.** The lock is held across the entire `compute_crc` call. This is functionally correct (the BO must be reserved during access), but worth noting if `compute_crc` is expensive.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-16  4:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  0:27 [PATCH v2 0/5] Fix some issues from igt runs Maaz Mombasawala
2026-05-12  0:27 ` [PATCH v2 1/5] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-16  4:26   ` Claude review: " Claude Code Review Bot
2026-05-12  0:27 ` [PATCH v2 2/5] drm/vmwgfx: Check vrefresh in drm_mode_setcrtc Maaz Mombasawala
2026-05-16  4:26   ` Claude review: " Claude Code Review Bot
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 Code Review Bot [this message]
2026-05-12  0:27 ` [PATCH v2 4/5] drm/vmwgfx: Change ttm refs for dumb buffers Maaz Mombasawala
2026-05-16  4:26   ` Claude review: " Claude Code Review Bot
2026-05-12  0:27 ` [PATCH v2 5/5] drm/vmwgfx: Remove duplicates in vmwgfx_bo.h Maaz Mombasawala
2026-05-16  4:26   ` Claude review: " Claude Code Review Bot
2026-05-16  4:26 ` 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

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-20260512002752.2826685-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