[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250416-udp_sendmsg-v1-1-1a886b8733c2@debian.org>
Date: Wed, 16 Apr 2025 12:23:09 -0700
From: Breno Leitao <leitao@...ian.org>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
"David S. Miller" <davem@...emloft.net>, David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
kuniyu@...zon.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, yonghong.song@...ux.dev,
song@...nel.org, kernel-team@...a.com, Breno Leitao <leitao@...ian.org>
Subject: [PATCH net-next] udp: Add tracepoint for udp_sendmsg()
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@...ian.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@...ian.org>
Powered by blists - more mailing lists