linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xdp: tracing: Hide some xdp events under CONFIG_BPF_SYSCALL
@ 2025-06-12 14:16 Steven Rostedt
  2025-06-12 15:53 ` Jesper Dangaard Brouer
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2025-06-12 14:16 UTC (permalink / raw)
  To: LKML, Linux trace kernel, bpf
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Alexei Starovoitov,
	Daniel Borkmann,
	"David S. Miller\"  <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Jesper Dangaard  Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>

From: Steven Rostedt <rostedt@goodmis.org>

The events xdp_cpumap_kthread, xdp_cpumap_enqueue and xdp_devmap_xmit are
only called when CONFIG_BPF_SYSCALL is defined.  As each event can take up
to 5K regardless if they are used or not, it's best not to define them
when they are not used. Add #ifdef around these events when they are not
used.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Note, I will be adding code soon that will make unused events cause a waring.

 include/trace/events/xdp.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
index 0fe0893c2567..18c0ac514fcb 100644
--- a/include/trace/events/xdp.h
+++ b/include/trace/events/xdp.h
@@ -168,6 +168,7 @@ DEFINE_EVENT(xdp_redirect_template, xdp_redirect_err,
 #define _trace_xdp_redirect_map_err(dev, xdp, to, map_type, map_id, index, err) \
 	 trace_xdp_redirect_err(dev, xdp, to, err, map_type, map_id, index)
 
+#ifdef CONFIG_BPF_SYSCALL
 TRACE_EVENT(xdp_cpumap_kthread,
 
 	TP_PROTO(int map_id, unsigned int processed,  unsigned int drops,
@@ -281,6 +282,7 @@ TRACE_EVENT(xdp_devmap_xmit,
 		  __entry->sent, __entry->drops,
 		  __entry->err)
 );
+#endif /* CONFIG_BPF_SYSCALL */
 
 /* Expect users already include <net/xdp.h>, but not xdp_priv.h */
 #include <net/xdp_priv.h>
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xdp: tracing: Hide some xdp events under CONFIG_BPF_SYSCALL
  2025-06-12 14:16 [PATCH] xdp: tracing: Hide some xdp events under CONFIG_BPF_SYSCALL Steven Rostedt
@ 2025-06-12 15:53 ` Jesper Dangaard Brouer
  0 siblings, 0 replies; 2+ messages in thread
From: Jesper Dangaard Brouer @ 2025-06-12 15:53 UTC (permalink / raw)
  To: Steven Rostedt, LKML, Linux trace kernel, bpf
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Alexei Starovoitov,
	Daniel Borkmann, David S. Miller", Jakub Kicinski,
	Jesper Dangaard Brouer, John Fastabend



On 12/06/2025 16.16, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> The events xdp_cpumap_kthread, xdp_cpumap_enqueue and xdp_devmap_xmit are
> only called when CONFIG_BPF_SYSCALL is defined.  As each event can take up
> to 5K regardless if they are used or not, it's best not to define them
> when they are not used. Add #ifdef around these events when they are not
> used.
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> Note, I will be adding code soon that will make unused events cause a waring.
> 
>   include/trace/events/xdp.h | 2 ++
>   1 file changed, 2 insertions(+)

LGTM

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>


> diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
> index 0fe0893c2567..18c0ac514fcb 100644
> --- a/include/trace/events/xdp.h
> +++ b/include/trace/events/xdp.h
> @@ -168,6 +168,7 @@ DEFINE_EVENT(xdp_redirect_template, xdp_redirect_err,
>   #define _trace_xdp_redirect_map_err(dev, xdp, to, map_type, map_id, index, err) \
>   	 trace_xdp_redirect_err(dev, xdp, to, err, map_type, map_id, index)
>   
> +#ifdef CONFIG_BPF_SYSCALL
>   TRACE_EVENT(xdp_cpumap_kthread,
>   
>   	TP_PROTO(int map_id, unsigned int processed,  unsigned int drops,
> @@ -281,6 +282,7 @@ TRACE_EVENT(xdp_devmap_xmit,
>   		  __entry->sent, __entry->drops,
>   		  __entry->err)
>   );
> +#endif /* CONFIG_BPF_SYSCALL */
>   
>   /* Expect users already include <net/xdp.h>, but not xdp_priv.h */
>   #include <net/xdp_priv.h>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-12 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 14:16 [PATCH] xdp: tracing: Hide some xdp events under CONFIG_BPF_SYSCALL Steven Rostedt
2025-06-12 15:53 ` Jesper Dangaard Brouer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).