Thread (52 messages) 52 messages, 7 authors, 2023-06-08

Re: [PATCH] tracing/user_events: Run BPF program if attached

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-05-09 20:42:53
Also in: bpf, lkml

On Tue, 9 May 2023 16:30:50 -0400
Steven Rostedt [off-list ref] wrote:
quoted
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");
	}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help