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: integrate VRAM migration into SVM range map and fault paths Date: Sat, 16 May 2026 12:15:39 +1000 Message-ID: In-Reply-To: <20260513095734.69598-7-Junhua.Shen@amd.com> References: <20260513095734.69598-1-Junhua.Shen@amd.com> <20260513095734.69598-7-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 **Migration failure silently ignored in fault path:** ```c if (need_vram_migration) amdgpu_svm_range_migrate_range(svm, &range->base, AMDGPU_SVM_MIGRATE_TO_VRAM); ``` The return value is discarded. If migration fails, execution continues and = `amdgpu_svm_range_get_pages()` will map system RAM pages instead. This is r= easonable as a fallback, but: 1. If `devmem_only` is true in `map_ctx`, the subsequent `get_pages` may fa= il because it expects VRAM pages 2. No logging means silent performance degradation is invisible 3. If migration fails due to VRAM pressure, the GPU will keep faulting on t= he same pages =E2=80=94 potential infinite retry loop At minimum, log the failure. Consider also clearing `map_ctx.devmem_only` a= fter migration failure. **Same issue in the prefetch path:** ```c if (need_vram_migration) { AMDGPU_SVM_RANGE_DEBUG(range, "PREFETCH - MIGRATION PAGES"); amdgpu_svm_range_migrate_range(svm, &range->base, AMDGPU_SVM_MIGRATE_TO_VRAM); } ``` Return value ignored again. **`devmem_possible =3D false` TODO removal is the right cleanup**, but the = declaration-after-statement pattern (`bool devmem_possible =3D ...; bool ne= ed_vram_migration =3D ...; struct drm_gpusvm_ctx map_ctx =3D { ... };`) mix= ing declarations and assigned variables should work fine with modern C stan= dards but worth noting that some kernel subsystems still prefer C89-style d= eclarations. The amdgpu driver generally allows mixed declarations, so this= is fine. **VRAM PTE flags handling looks correct:** ```c if (entry->proto =3D=3D AMDGPU_INTERCONNECT_VRAM) seg_pte_flags &=3D ~(AMDGPU_PTE_SYSTEM | AMDGPU_PTE_SNOOPED); ``` Clearing SYSTEM and SNOOPED for local VRAM pages is the right thing =E2=80= =94 these are direct VRAM accesses through MMHUB, not system memory through= IOMMU. --- Generated by Claude Code Patch Reviewer