public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
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	[thread overview]
Message-ID: <review-patch1-20260523013326.129491-2-jhubbard@nvidia.com> (raw)
In-Reply-To: <20260523013326.129491-2-jhubbard@nvidia.com>

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

  reply	other threads:[~2026-05-25  8:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23  1:33 [PATCH v2 0/2] complete perf_allow_* trio and use in drm/xe John Hubbard
2026-05-23  1:33 ` [PATCH v2 1/2] perf/core: out-of-line and export perf_allow_cpu/tracepoint() John Hubbard
2026-05-25  8:04   ` Claude Code Review Bot [this message]
2026-05-23  1:33 ` [PATCH v2 2/2] drm/xe: gate observation streams with perf_allow_cpu() John Hubbard
2026-05-25  8:04   ` Claude review: " Claude Code Review Bot
2026-05-23  8:40 ` [PATCH v2 0/2] complete perf_allow_* trio and use in drm/xe Peter Zijlstra
2026-05-23 17:52   ` John Hubbard
2026-05-25  8:04 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-21  2:49 [PATCH 0/2] perf: " John Hubbard
2026-05-21  2:49 ` [PATCH 1/2] perf/core: out-of-line and export perf_allow_cpu/tracepoint() John Hubbard
2026-05-25 11:03   ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch1-20260523013326.129491-2-jhubbard@nvidia.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox