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/msm: Add basic perfcntr infrastructure Date: Tue, 05 May 2026 08:06:03 +1000 Message-ID: In-Reply-To: <20260504190751.61052-11-robin.clark@oss.qualcomm.com> References: <20260504190751.61052-1-robin.clark@oss.qualcomm.com> <20260504190751.61052-11-robin.clark@oss.qualcomm.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This adds `msm_perfcntr.c` with init/cleanup/resume/suspend stubs and group_idx/counter_base helpers. **Issue: `msm_gpu_sysprof_no_perfcntr_zap()` NULL dereference.** The inline function is changed to: ```c return (refcount_read(&gpu->sysprof_active) > 1) || READ_ONCE(gpu->perfcntrs->stream); ``` But `gpu->perfcntrs` is only set when `gpu->num_perfcntr_groups > 0` (which is a6xx+ only). For older GPUs (a2xx-a5xx), `gpu->perfcntrs` will be NULL, causing a NULL pointer dereference if this function is ever called on those GPUs. This should be guarded: ```c return (refcount_read(&gpu->sysprof_active) > 1) || (gpu->perfcntrs && READ_ONCE(gpu->perfcntrs->stream)); ``` **Minor: `devm_kzalloc`/`devm_kfree` usage.** Using `devm_*` allocations then manually freeing in `msm_perfcntr_cleanup()` is a bit unusual. The `devm_kfree` calls in cleanup are necessary since the device outlives the cleanup, but mixing devm with manual lifetime management can be confusing. Not a bug, just worth noting. **Minor: `msm_perfcntr_resume()` doesn't check `gpu->perfcntrs` for NULL** before accessing `gpu->perfcntrs->stream`, same concern as above. --- Generated by Claude Code Patch Reviewer