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/v3d: Fix global performance monitor reference counting Date: Thu, 04 Jun 2026 14:44:42 +1000 Message-ID: In-Reply-To: <20260531-v3d-perfmon-lifetime-v2-1-60ed4485a203@igalia.com> References: <20260531-v3d-perfmon-lifetime-v2-0-60ed4485a203@igalia.com> <20260531-v3d-perfmon-lifetime-v2-1-60ed4485a203@igalia.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 **Status**: Looks correct. Good stable candidate. This patch fixes three distinct refcount leak paths in `v3d_perfmon_set_glo= bal_ioctl()` and `v3d_perfmon_delete()`. The analysis in the commit message= is precise. The fix for `v3d_perfmon_delete()`: ```c if (cmpxchg(&v3d->global_perfmon, perfmon, NULL) =3D=3D perfmon) v3d_perfmon_put(perfmon); ``` Correctly releases the extra reference stashed by SET_GLOBAL only when the = cmpxchg succeeds (i.e., this perfmon was actually the global one). The CLEAR_GLOBAL path fix: ```c v3d_perfmon_put(perfmon); old =3D xchg(&v3d->global_perfmon, NULL); if (!old) return -EINVAL; v3d_perfmon_put(old); ``` Correctly drops the find reference on `perfmon` early (since CLEAR_GLOBAL d= oesn't use it), then drops the stashed reference on whatever was actually t= he global perfmon. The semantics are a bit surprising =E2=80=94 CLEAR_GLOBA= L takes a perfmon ID but ignores it for the actual clear =E2=80=94 but the = comment documents this, and matching the existing behavior is the right cal= l for a stable fix. The SET_GLOBAL error path: ```c if (cmpxchg(&v3d->global_perfmon, NULL, perfmon)) { v3d_perfmon_put(perfmon); return -EBUSY; } ``` Straightforward =E2=80=94 drops the find reference when we can't install th= e perfmon. **No issues found.** --- --- Generated by Claude Code Patch Reviewer