From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: perf/core: out-of-line and export perf_allow_cpu/tracepoint() Date: Mon, 25 May 2026 18:04:51 +1000 Message-ID: In-Reply-To: <20260523013326.129491-2-jhubbard@nvidia.com> References: <20260523013326.129491-1-jhubbard@nvidia.com> <20260523013326.129491-2-jhubbard@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Good:** The out-of-line implementations are exact copies of the previous static inline bodies, preserving the distinct threshold levels and error codes: ```c int perf_allow_cpu(void) { if (sysctl_perf_event_paranoid > 0 && !perfmon_capable()) return -EACCES; return security_perf_event_open(PERF_SECURITY_CPU); } int perf_allow_tracepoint(void) { if (sysctl_perf_event_paranoid > -1 && !perfmon_capable()) return -EPERM; return security_perf_event_open(PERF_SECURITY_TRACEPOINT); } ``` The graduated thresholds (`> 0` for CPU, `> -1` for tracepoint, `> 1` for kernel in the existing code) and distinct error codes (`-EACCES` vs `-EPERM`) are all faithfully preserved. **Good: !CONFIG_PERF_EVENTS stubs are complete.** The patch adds stubs for all three helpers: ```c static inline int perf_allow_kernel(void) { return perfmon_capable() ? 0 : -EACCES; } static inline int perf_allow_cpu(void) { return perfmon_capable() ? 0 : -EACCES; } static inline int perf_allow_tracepoint(void) { return perfmon_capable() ? 0 : -EPERM; } ``` Note that `perf_allow_kernel()` didn't have a `!CONFIG_PERF_EVENTS` stub before this patch either -- the existing code declared it `extern` in the `CONFIG_PERF_EVENTS` block with no fallback. Adding it here is a bonus fix that makes the trio complete. The cover letter v2 changelog correctly attributes this to AI review feedback catching the build failure with `PERF_EVENTS=n`. **Minor observation:** The stubs use `perfmon_capable()` as the fallback, which is a reasonable conservative default -- it requires `CAP_PERFMON` or `CAP_SYS_ADMIN`. The LSM hook is naturally unavailable without `CONFIG_PERF_EVENTS`, so this is the best approximation. **Placement:** The new functions are placed in `kernel/events/core.c` right after the existing `perf_allow_kernel()` / `EXPORT_SYMBOL_GPL`, which is the natural location. No issues. No problems with this patch. --- --- Generated by Claude Code Patch Reviewer