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/virtio: Add support for saving and restoring virtio_gpu_objects
Date: Wed, 27 May 2026 14:17:08 +1000	[thread overview]
Message-ID: <review-patch2-20260526192814.179673-3-dongwon.kim@intel.com> (raw)
In-Reply-To: <20260526192814.179673-3-dongwon.kim@intel.com>

Patch Review

**Overall:** The restore-list tracking approach is sensible. Objects are tracked at creation and removed before free, with proper mutex protection. The restore path correctly differentiates between blob, non-blob, and imported dmabuf objects.

**Issue 1 — VRAM objects silently excluded from restoration:**

`virtio_gpu_vram_create()` initializes the restore_node but never adds the object to the restore list:

```c
INIT_LIST_HEAD(&vram->base.restore_node);
// ... no call to virtio_gpu_add_object_to_restore_list()
```

Yet `virtio_gpu_vram_free()` calls `virtio_gpu_remove_from_restore_list(bo)`. The `list_del_init` on a self-referencing node is safe, so this won't crash, but VRAM objects won't survive hibernation. If this is intentional (VRAM objects are typically host-visible blobs that may require special handling), it should be documented in the commit message or with a comment.

**Issue 2 — Uninitialized `ents` on non-blob/non-attached path (not a bug):**

In `virtio_gpu_object_restore_all()`:

```c
if (bo->params.blob || bo->attached) {
    ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents);
    if (ret)
        break;
}

if (bo->params.blob) {
    virtio_gpu_cmd_resource_create_blob(vgdev, bo, &bo->params,
                                        ents, nents);
} else {
    virtio_gpu_cmd_create_resource(vgdev, bo, &bo->params,
                                   NULL, NULL);
    if (bo->attached) {
        bo->attached = false;
        virtio_gpu_object_attach(vgdev, bo, ents, nents);
    }
}
```

If `!bo->params.blob && !bo->attached`, `ents`/`nents` are never initialized, but they're also never used — the else-branch calls `virtio_gpu_cmd_create_resource` with `NULL, NULL` and skips attach. This is correct but could confuse a reader. An explicit `ents = NULL; nents = 0;` initialization at declaration would help.

**Issue 3 — virtgpu_dma_buf_obj_resubmit always uses DMA addresses:**

The resubmit path unconditionally uses `sg_dma_address`/`sg_dma_len`:

```c
for_each_sgtable_dma_sg(bo->sgt, sl, i) {
    ents[i].addr = cpu_to_le64(sg_dma_address(sl));
    ents[i].length = cpu_to_le32(sg_dma_len(sl));
```

This is correct for imported dmabufs (which always come through `dma_buf_map_attachment` and use DMA-mapped addresses), but differs from `virtio_gpu_object_shmem_init` which has a `use_dma_api` split for non-imported objects. Just confirming this is intentional — and it is, since imported objects always go through the DMA API path.

**Nit — Extra blank line after `virtgpu_dma_buf_obj_resubmit()`:**

```c
	return 0;
}


static const struct drm_gem_object_funcs virtgpu_gem_dma_buf_funcs = {
```

Double blank line should be single.

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-27  4:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 19:28 [PATCH v9 0/3] Virtio-GPU S4 support dongwon.kim
2026-05-26 19:28 ` [PATCH v9 1/3] drm/virtio: Freeze and restore hooks to support suspend and resume dongwon.kim
2026-05-27  4:17   ` Claude review: " Claude Code Review Bot
2026-05-26 19:28 ` [PATCH v9 2/3] drm/virtio: Add support for saving and restoring virtio_gpu_objects dongwon.kim
2026-05-27  4:17   ` Claude Code Review Bot [this message]
2026-05-26 19:28 ` [PATCH v9 3/3] drm/virtio: Add PM notifier to restore objects after hibernation dongwon.kim
2026-05-27  4:17   ` Claude review: " Claude Code Review Bot
2026-05-27  4:17 ` Claude review: Virtio-GPU S4 support Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-29 20:47 [PATCH v8 0/3] Virtio-GPU S4 (hibernation) support dongwon.kim
2026-04-29 20:47 ` [PATCH v8 2/3] drm/virtio: Add support for saving and restoring virtio_gpu_objects dongwon.kim
2026-05-05  1:00   ` 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-patch2-20260526192814.179673-3-dongwon.kim@intel.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