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/amdgpu: add VRAM migration infrastructure for drm_pagemap Date: Sat, 16 May 2026 12:15:37 +1000 Message-ID: In-Reply-To: <20260513095734.69598-2-Junhua.Shen@amd.com> References: <20260513095734.69598-1-Junhua.Shen@amd.com> <20260513095734.69598-2-Junhua.Shen@amd.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 **SPDX comment style:** The `.c` file uses `/* SPDX-License-Identifier: GPL= -2.0 OR MIT */` which is the comment style for header files. C source files= should use `// SPDX-License-Identifier: GPL-2.0 OR MIT`. **`drm_pagemap_init` error path leaks resources:** ```c if (drm_pagemap_init(&svm_dm->dpagemap, pgmap, adev_to_drm(adev), &amdgpu_svm_drm_pagemap_ops)) { dev_err(adev->dev, "SVM: failed to init drm_pagemap\n"); return -EINVAL; } ``` If `drm_pagemap_init()` fails, the `devm_memremap_pages()` registration is = not unwound. While devres will eventually clean it up at device teardown, t= he function has already registered ZONE_DEVICE pages that will have no func= tional `drm_pagemap` backing =E2=80=94 this is a window for use-after-free = if the SVM paths try to use them. The error path should call `devm_memunmap= _pages()` or equivalent, similar to the `IS_ERR(r)` path above it. **Alignment in `drm_pagemap_init` call:** ```c if (drm_pagemap_init(&svm_dm->dpagemap, pgmap, adev_to_drm(adev), &amdgpu_svm_drm_pagemap_ops)) { ``` The continuation line has excessive indentation (tabs to column ~40). Align= to the opening parenthesis or use a single extra tab. **`amdgpu_amdkfd.h` include removed but no explanation:** The diff removes = `#include "amdgpu_amdkfd.h"` from the includes. Patch 2 replaces the includ= e list entirely, so this is fine functionally, but it's an artifact of the = patch split =E2=80=94 patch 1 adds the file, patch 2 rewrites the includes.= The original file in patch 1 never needed this include in the first place = (nothing from amdkfd is used), so this is just slightly messy. **`amdgpu_svm_page_to_apagemap` is defined but unused in this patch.** It's= used later in patch 2. This is minor but could trigger a compiler warning = depending on config. **Double blank line** at line 291 (between `amdgpu_svm_page_to_apagemap` an= d `amdgpu_svm_drm_pagemap_ops`). --- Generated by Claude Code Patch Reviewer