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/panthor: Use guards for resv locking Date: Sat, 16 May 2026 11:40:46 +1000 Message-ID: In-Reply-To: <20260513-panthor-guard-refactor-v1-4-f2d8c15a97ce@collabora.com> References: <20260513-panthor-guard-refactor-v1-0-f2d8c15a97ce@collabora.com> <20260513-panthor-guard-refactor-v1-4-f2d8c15a97ce@collabora.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 Clean application of the dma_resv guards from patch 2. Straightforward conv= ersions from `dma_resv_lock()/dma_resv_unlock()` to `guard(dma_resv)`. **`panthor_gem.c` =E2=80=94 `nonblocking_page_setup()` behavior change:** ```c ACQUIRE(dma_resv_try, resv_guard)(bo->base.resv); if (ACQUIRE_ERR(dma_resv_try, &resv_guard) || !bo->backing.pages) return VM_FAULT_RETRY; ``` The original code checked `dma_resv_trylock()` failure separately from `!bo= ->backing.pages`. Both returned `VM_FAULT_RETRY`. Combining them is correct= and cleaner. **`panthor_mmu.c` =E2=80=94 `panthor_vm_prepare_map_op_ctx()`:** The final two stanzas become: ```c guard(dma_resv)(panthor_vm_resv(vm)); drm_gpuvm_bo_extobj_add(op_ctx->map.vm_bo); ... guard(dma_resv)(bo->base.resv); guard(mutex)(&bo->base.gpuva.lock); panthor_gem_update_reclaim_state_locked(bo, NULL); ``` Wait =E2=80=94 both `guard(dma_resv)` calls will hold their locks until the= end of the function. In the original code, `panthor_vm_resv(vm)` was unloc= ked before `bo->base.resv` was locked. If `bo->base.resv !=3D panthor_vm_re= sv(vm)` (which is the condition for entering the `if` block), these are dif= ferent objects and holding both simultaneously shouldn't deadlock. But this= does extend the hold time of the VM resv lock. This is likely fine in prac= tice since the additional work is just a mutex lock and a function call. --- Generated by Claude Code Patch Reviewer