[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250227084631.025e02eee682c42f296fe570@kernel.org>
Date: Thu, 27 Feb 2025 08:46:31 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Yonghong Song <yhs@...a.com>, Breno Leitao <leitao@...ian.org>, Neal
Cardwell <ncardwell@...gle.com>, Kuniyuki Iwashima <kuniyu@...zon.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>,
"kuba@...nel.org" <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon
Horman <horms@...nel.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-trace-kernel@...r.kernel.org"
<linux-trace-kernel@...r.kernel.org>, Kernel Team <kernel-team@...a.com>,
"yonghong.song@...ux.dev" <yonghong.song@...ux.dev>
Subject: Re: [PATCH net-next] trace: tcp: Add tracepoint for tcp_sendmsg()
On Mon, 24 Feb 2025 20:23:00 +0100
Eric Dumazet <edumazet@...gle.com> wrote:
> On Mon, Feb 24, 2025 at 8:13 PM Yonghong Song <yhs@...a.com> wrote:
> >
> > > ________________________________________
> > >
> > > On Mon, Feb 24, 2025 at 7:24 PM Breno Leitao <leitao@...ian.org> wrote:
> > >>
> > >> Add a lightweight tracepoint to monitor TCP sendmsg operations, enabling
> > >> the tracing of TCP messages being sent.
> > >>
> > >> Meta has been using BPF programs to monitor this function for years,
> > >> indicating significant interest in observing this important
> > >> functionality. Adding a proper tracepoint provides a stable API for all
> > >> users who need visibility into TCP message transmission.
> > >>
> > >> The implementation uses DECLARE_TRACE instead of TRACE_EVENT to avoid
> > >> creating unnecessary trace event infrastructure and tracefs exports,
> > >> keeping the implementation minimal while stabilizing the API.
> > >>
> > >> Given that this patch creates a rawtracepoint, you could hook into it
> > >> using regular tooling, like bpftrace, using regular rawtracepoint
> > >> infrastructure, such as:
> > >>
> > >> rawtracepoint:tcp_sendmsg_tp {
> > >> ....
> > >> }
> > >
> > > I would expect tcp_sendmsg() being stable enough ?
> > >
> > > kprobe:tcp_sendmsg {
> > > }
> >
> > In LTO mode, tcp_sendmsg could be inlined cross files. For example,
> >
> > net/ipv4/tcp.c:
> > int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> > net/ipv4/tcp_bpf.c:
> > ...
> > return tcp_sendmsg(sk, msg, size);
> > net/ipv6/af_inet6.c:
> > ...
> > return INDIRECT_CALL_2(prot->sendmsg, tcp_sendmsg, udpv6_sendmsg, ...)
> >
> > And this does happen in our production environment.
>
> And we do not have a way to make the kprobe work even if LTO decided
> to inline a function ?
There is `perf probe` command to set it up based on the debuginfo. But
the function parameters sometimes optimized out and no more accessible.
(You can try.)
Thus if you needs this tracepoint not temporarily nor debugging,
I would recommend to use tracepoint (or trace event).
Thank you,
>
> This seems like a tracing or LTO issue, this could be addressed there
> in a generic way
> and avoid many other patches to work around this.
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists