tcp: add tracepoint for tcp_write_err()
Subsystems (4)
PATCH 1/1 tcp: add tracepoint for tcp_write_err()
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().
--- include/trace/events/tcp.h | 7 +++++++ net/ipv4/tcp_timer.c | 3 +++ 2 files changed, 10 insertions(+)
include/trace/events/tcp.h +7 -0
@@ -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),
net/ipv4/tcp_timer.c +3 -0
@@ -19,6 +19,7 @@* Jorge Cwik, <[email protected]> */ +#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);
Signature · 1 line
2.32.0.3.g01195cf9f
Paolo Abeni
maintainerQuoted 4 lines · Philo Lu
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 ofsk->sk_errdepends onsk->sk_err_soft, and we cannot easily recognized errors fromtcp_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
Quoted 9 lines · Paolo Abeni
Quoted 4 lines · Philo Lu
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 ofsk->sk_errdepends onsk->sk_err_soft, and we cannot easily recognized errors fromtcp_write_err().Why not? you can look at the dumped sock protocol and ev. capture the
sk_error_reporttracepoint 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.
Quoted 5 lines
IMHO this provides little value and is not worthy.
Cheers,
Paolo