linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] udp: Add tracepoint for udp_sendmsg()
@ 2025-04-16 19:23 Breno Leitao
  2025-04-16 19:34 ` Willem de Bruijn
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Breno Leitao @ 2025-04-16 19:23 UTC (permalink / raw)
  To: Willem de Bruijn, Steven Rostedt, Masami Hiramatsu,
	Mathieu Desnoyers, David S. Miller, David Ahern, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, kuniyu
  Cc: netdev, linux-kernel, linux-trace-kernel, yonghong.song, song,
	kernel-team, Breno Leitao

Add a lightweight tracepoint to monitor UDP send message operations,
similar to the recently introduced tcp_sendmsg_locked() trace event in
commit 0f08335ade712 ("trace: tcp: Add tracepoint for
tcp_sendmsg_locked()")

This implementation uses DECLARE_TRACE instead of TRACE_EVENT to avoid
creating extensive trace event infrastructure and exporting to tracefs,
keeping it minimal and efficient.

Since this patch creates a rawtracepoint, it can be accessed using
standard tracing tools like bpftrace:

    rawtracepoint:udp_sendmsg_tp {
        ...
    }

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 include/trace/events/udp.h | 5 +++++
 net/ipv4/udp.c             | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/include/trace/events/udp.h b/include/trace/events/udp.h
index 6142be4068e29..38ab24053b6ff 100644
--- a/include/trace/events/udp.h
+++ b/include/trace/events/udp.h
@@ -46,6 +46,11 @@ TRACE_EVENT(udp_fail_queue_rcv_skb,
 		  __entry->saddr, __entry->daddr)
 );
 
+DECLARE_TRACE(udp_sendmsg_tp,
+	TP_PROTO(const struct sock *sk, const struct msghdr *msg),
+	TP_ARGS(sk, msg)
+);
+
 #endif /* _TRACE_UDP_H */
 
 /* This part must be outside protection */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index f9f5b92cf4b61..8c2902504a399 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1345,6 +1345,8 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 		connected = 1;
 	}
 
+	trace_udp_sendmsg_tp(sk, msg);
+
 	ipcm_init_sk(&ipc, inet);
 	ipc.gso_size = READ_ONCE(up->gso_size);
 

---
base-commit: 1d6f4861027b451e064896f34dd0beada8871bfe
change-id: 20250416-udp_sendmsg-084a32657a56

Best regards,
-- 
Breno Leitao <leitao@debian.org>


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

end of thread, other threads:[~2025-05-27 13:45 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 19:23 [PATCH net-next] udp: Add tracepoint for udp_sendmsg() Breno Leitao
2025-04-16 19:34 ` Willem de Bruijn
2025-04-17 11:31   ` Breno Leitao
2025-04-17 13:38     ` Willem de Bruijn
2025-04-16 23:16 ` David Ahern
2025-04-17 11:42   ` Breno Leitao
2025-04-17 15:55     ` David Ahern
2025-04-17 16:00       ` Breno Leitao
2025-04-18  4:57         ` David Ahern
2025-04-18 12:33           ` Steven Rostedt
2025-04-18 14:47             ` Steven Rostedt
2025-04-17  6:57 ` Paolo Abeni
2025-04-17 11:34   ` Breno Leitao
2025-04-17 13:17     ` Paolo Abeni
2025-04-17 15:37       ` Song Liu
2025-04-17 15:48         ` Willem de Bruijn
2025-04-17 20:00           ` Song Liu
2025-04-18 14:49             ` Willem de Bruijn
2025-05-27 13:45               ` Breno Leitao

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).