[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230509164244.3163e421@rorschach.local.home>
Date: Tue, 9 May 2023 16:42:44 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Beau Belgrave <beaub@...ux.microsoft.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-trace-kernel@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
David Vernet <void@...ifault.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] tracing/user_events: Run BPF program if attached
On Tue, 9 May 2023 16:30:50 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> >From the user space side, which does:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/user_events/example.c#n60
>
> /* Check if anyone is listening */
> if (enabled) {
Hmm, looking at this deeper, we should update it to prevent the
compiler from optimizing it, and keeping "enabled" in a register. Which
would not work. Should probably add:
if (*(const volatile int *)&enabled) {
-- Steve
> /* Yep, trace out our data */
> writev(data_fd, (const struct iovec *)io, 2);
>
> /* Increase the count */
> count++;
>
> printf("Something was attached, wrote data\n");
> }
Powered by blists - more mailing lists