From: Breno Leitao <leitao@debian.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
kuniyu@amazon.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, yonghong.song@linux.dev,
song@kernel.org, kernel-team@meta.com,
Breno Leitao <leitao@debian.org>
Subject: [PATCH net-next] udp: Add tracepoint for udp_sendmsg()
Date: Wed, 16 Apr 2025 12:23:09 -0700 [thread overview]
Message-ID: <20250416-udp_sendmsg-v1-1-1a886b8733c2@debian.org> (raw)
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>
next reply other threads:[~2025-04-16 19:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 19:23 Breno Leitao [this message]
2025-04-16 19:34 ` [PATCH net-next] udp: Add tracepoint for udp_sendmsg() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250416-udp_sendmsg-v1-1-1a886b8733c2@debian.org \
--to=leitao@debian.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=willemdebruijn.kernel@gmail.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox