From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/virtio: Add support for saving and restoring virtio_gpu_objects Date: Tue, 05 May 2026 11:00:35 +1000 Message-ID: In-Reply-To: <20260429204729.993669-3-dongwon.kim@intel.com> References: <20260429204729.993669-1-dongwon.kim@intel.com> <20260429204729.993669-3-dongwon.kim@intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review This patch adds the object tracking infrastructure: a per-device restore li= st protected by a mutex, and logic to re-create objects on the host after h= ibernation. **Issue 1 (minor): VRAM objects initialized but never tracked** In `virtgpu_vram.c`: ```c INIT_LIST_HEAD(&vram->base.restore_node); ``` VRAM objects get their `restore_node` initialized but are never added to th= e restore list. The `virtio_gpu_remove_from_restore_list()` call in `virtio= _gpu_vram_free()` would be a harmless no-op on an initialized-but-not-linke= d list node. If VRAM objects are intentionally excluded from restoration (l= ike virgl objects), a brief comment explaining why would be helpful, as the= restore_node removal in the free path suggests they might have been intend= ed for tracking. **Issue 2 (minor): Misleading error code in `virtgpu_dma_buf_obj_resubmit()= `** ```c if (!bo->sgt) { DRM_ERROR("no sgt bound to virtio_gpu_object\n"); return -ENOMEM; } ``` `-ENOMEM` doesn't describe "no sgt bound". `-EINVAL` or `-ENOENT` would be = more accurate. **Issue 3 (nit): Inconsistent allocation macro** `virtgpu_dma_buf_obj_resubmit()` uses `kvmalloc_array()` directly: ```c ents =3D kvmalloc_array(bo->sgt->nents, sizeof(struct virtio_gpu_mem_entry), GFP_KERNEL); ``` while `virtio_gpu_object_shmem_init()` uses the `kvmalloc_objs` macro for t= he same type. Minor inconsistency. **Issue 4 (nit): Extra blank line** After `virtgpu_dma_buf_obj_resubmit()` there are two blank lines before `st= atic const struct drm_gem_object_funcs`. Should be one. **Observation: Restore logic correctness** The `virtio_gpu_object_restore_all()` logic correctly handles three cases: 1. Imported dma-buf objects =E2=86=92 `virtgpu_dma_buf_obj_resubmit()` 2. Blob objects =E2=86=92 `shmem_init` + `cmd_resource_create_blob()` 3. Regular (non-blob, non-virgl) objects =E2=86=92 `shmem_init` + `cmd_crea= te_resource()` + `object_attach()` The conditional `if (bo->params.blob || bo->attached)` before `shmem_init` = correctly gates the ents/nents initialization to paths that use them. Howev= er, `ents` and `nents` are uninitialized at declaration =E2=80=94 adding `= =3D NULL` / `=3D 0` would silence potential compiler warnings and improve c= larity. --- --- Generated by Claude Code Patch Reviewer