From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ian Rogers <irogers@google.com>,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Douglas Raillard <douglas.raillard@arm.com>
Subject: Re: [POC][RFC][PATCH 1/3] tracing: Add perf events
Date: Tue, 18 Nov 2025 09:35:10 +0100 [thread overview]
Message-ID: <20251118083510.GI3245006@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20251118003531.644484343@kernel.org>
On Mon, Nov 17, 2025 at 07:29:51PM -0500, Steven Rostedt wrote:
> +u64 do_trace_perf_event(int type)
> +{
> + struct trace_perf_event __percpu **pevents;
> + struct trace_perf_event __percpu *events;
> + struct perf_event *e;
> + int *count;
> + int cpu;
> +
> + if (set_perf_type(type, NULL, NULL, &count, &pevents) < 0)
> + return 0;
> +
> + if (!*count)
> + return 0;
> +
> + guard(preempt)();
> +
> + events = READ_ONCE(*pevents);
> + if (!events)
> + return 0;
> +
> + cpu = smp_processor_id();
> +
> + e = per_cpu_ptr(events, cpu)->event;
> + if (!e)
> + return 0;
> +
> + e->pmu->read(e);
> + return local64_read(&e->count);
> +}
NAK, wtf do you think its okay to use internal stuff like that? And
wrongly while at it.
What you wanted to use was perf_event_read_local().
next prev parent reply other threads:[~2025-11-18 8:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 0:29 [POC][RFC][PATCH 0/3] tracing: Add perf events to trace buffer Steven Rostedt
2025-11-18 0:29 ` [POC][RFC][PATCH 1/3] tracing: Add perf events Steven Rostedt
2025-11-18 8:35 ` Peter Zijlstra [this message]
2025-11-18 13:42 ` Steven Rostedt
2025-11-18 20:24 ` Steven Rostedt
2025-11-18 0:29 ` [POC][RFC][PATCH 2/3] ftrace: Add perf counters to function tracing Steven Rostedt
2025-11-18 0:29 ` [POC][RFC][PATCH 3/3] fgraph: Add perf counters to function graph tracer Steven Rostedt
2025-11-18 3:08 ` [POC][RFC][PATCH 0/3] tracing: Add perf events to trace buffer Masami Hiramatsu
2025-11-18 3:42 ` Steven Rostedt
2025-11-18 8:11 ` Masami Hiramatsu
2025-11-18 13:53 ` Steven Rostedt
2025-11-18 13:57 ` Steven Rostedt
2025-11-18 16:31 ` Steven Rostedt
2025-11-18 7:25 ` Namhyung Kim
2025-11-18 16:24 ` Steven Rostedt
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=20251118083510.GI3245006@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=douglas.raillard@arm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@kernel.org \
--cc=tglx@linutronix.de \
/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