Message ID | 20240425162556.83456-1-lulie@linux.alibaba.com (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] tcp: add tracepoint for tcp_write_err() | expand |
On Fri, 2024-04-26 at 00:25 +0800, Philo Lu wrote: > This tracepoint can be used to trace tcp write error events, e.g., > retransmit timeout. Though there is a tracepoint in sk_error_report(), > the value of sk->sk_err depends on sk->sk_err_soft, and we cannot easily > recognized errors from tcp_write_err(). Why not? you can look at the dumped sock protocol and ev. capture the sk_error_report tracepoint call-trace. IMHO this provides little value and is not worthy. Cheers, Paolo
On 2024/4/30 16:27, Paolo Abeni wrote: > On Fri, 2024-04-26 at 00:25 +0800, Philo Lu wrote: >> This tracepoint can be used to trace tcp write error events, e.g., >> retransmit timeout. Though there is a tracepoint in sk_error_report(), >> the value of sk->sk_err depends on sk->sk_err_soft, and we cannot easily >> recognized errors from tcp_write_err(). > > Why not? you can look at the dumped sock protocol and ev. capture the > sk_error_report tracepoint call-trace. > Thanks for your suggestion, Paolo. I'll try to trace sk_error_report with its calling stack and see if this could solve my problem. Though tcp_write_err() seems to be inlined in my system, upper callers may provides useful infomation. Let me have a try;) Thanks. > IMHO this provides little value and is not worthy. > > Cheers, > > Paolo
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index 5c04a61a11c2c..0efb51dcb8a3f 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -195,6 +195,13 @@ DEFINE_EVENT(tcp_event_sk, tcp_rcv_space_adjust, TP_ARGS(sk) ); +DEFINE_EVENT(tcp_event_sk, tcp_write_err, + + TP_PROTO(struct sock *sk), + + TP_ARGS(sk) +); + TRACE_EVENT(tcp_retransmit_synack, TP_PROTO(const struct sock *sk, const struct request_sock *req), diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 976db57b95d40..ebba7e30d5534 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -19,6 +19,7 @@ * Jorge Cwik, <jorge@laser.satlink.net> */ +#include <trace/events/tcp.h> #include <linux/module.h> #include <linux/gfp.h> #include <net/tcp.h> @@ -73,6 +74,8 @@ u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when) static void tcp_write_err(struct sock *sk) { + trace_tcp_write_err(sk); + WRITE_ONCE(sk->sk_err, READ_ONCE(sk->sk_err_soft) ? : ETIMEDOUT); sk_error_report(sk);
This tracepoint can be used to trace tcp write error events, e.g., retransmit timeout. Though there is a tracepoint in sk_error_report(), the value of sk->sk_err depends on sk->sk_err_soft, and we cannot easily recognized errors from tcp_write_err(). Signed-off-by: Philo Lu <lulie@linux.alibaba.com> --- include/trace/events/tcp.h | 7 +++++++ net/ipv4/tcp_timer.c | 3 +++ 2 files changed, 10 insertions(+)