Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/sock: Introduce trace_sk_data_ready()

As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
callback implementations. For example:

<...>
iperf-609 [002] ..... 70.660425: sk_data_ready: family=2 protocol=6 func=sock_def_readable
iperf-609 [002] ..... 70.660436: sk_data_ready: family=2 protocol=6 func=sock_def_readable
<...>

Suggested-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Peilin Ye and committed by
David S. Miller
40e0b090 a7b87d2a

+128
+3
drivers/infiniband/hw/erdma/erdma_cm.c
··· 11 11 /* Copyright (c) 2017, Open Grid Computing, Inc. */ 12 12 13 13 #include <linux/workqueue.h> 14 + #include <trace/events/sock.h> 14 15 15 16 #include "erdma.h" 16 17 #include "erdma_cm.h" ··· 925 924 static void erdma_cm_llp_data_ready(struct sock *sk) 926 925 { 927 926 struct erdma_cep *cep; 927 + 928 + trace_sk_data_ready(sk); 928 929 929 930 read_lock(&sk->sk_callback_lock); 930 931
+5
drivers/infiniband/sw/siw/siw_cm.c
··· 16 16 #include <net/tcp.h> 17 17 #include <linux/inet.h> 18 18 #include <linux/tcp.h> 19 + #include <trace/events/sock.h> 19 20 20 21 #include <rdma/iw_cm.h> 21 22 #include <rdma/ib_verbs.h> ··· 109 108 struct siw_cep *cep; 110 109 struct siw_qp *qp = NULL; 111 110 read_descriptor_t rd_desc; 111 + 112 + trace_sk_data_ready(sk); 112 113 113 114 read_lock(&sk->sk_callback_lock); 114 115 ··· 1218 1215 static void siw_cm_llp_data_ready(struct sock *sk) 1219 1216 { 1220 1217 struct siw_cep *cep; 1218 + 1219 + trace_sk_data_ready(sk); 1221 1220 1222 1221 read_lock(&sk->sk_callback_lock); 1223 1222
+3
drivers/infiniband/sw/siw/siw_qp.c
··· 10 10 #include <linux/llist.h> 11 11 #include <asm/barrier.h> 12 12 #include <net/tcp.h> 13 + #include <trace/events/sock.h> 13 14 14 15 #include "siw.h" 15 16 #include "siw_verbs.h" ··· 94 93 void siw_qp_llp_data_ready(struct sock *sk) 95 94 { 96 95 struct siw_qp *qp; 96 + 97 + trace_sk_data_ready(sk); 97 98 98 99 read_lock(&sk->sk_callback_lock); 99 100
+3
drivers/nvme/host/tcp.c
··· 14 14 #include <linux/blk-mq.h> 15 15 #include <crypto/hash.h> 16 16 #include <net/busy_poll.h> 17 + #include <trace/events/sock.h> 17 18 18 19 #include "nvme.h" 19 20 #include "fabrics.h" ··· 905 904 static void nvme_tcp_data_ready(struct sock *sk) 906 905 { 907 906 struct nvme_tcp_queue *queue; 907 + 908 + trace_sk_data_ready(sk); 908 909 909 910 read_lock_bh(&sk->sk_callback_lock); 910 911 queue = sk->sk_user_data;
+5
drivers/nvme/target/tcp.c
··· 14 14 #include <linux/inet.h> 15 15 #include <linux/llist.h> 16 16 #include <crypto/hash.h> 17 + #include <trace/events/sock.h> 17 18 18 19 #include "nvmet.h" 19 20 ··· 1471 1470 { 1472 1471 struct nvmet_tcp_queue *queue; 1473 1472 1473 + trace_sk_data_ready(sk); 1474 + 1474 1475 read_lock_bh(&sk->sk_callback_lock); 1475 1476 queue = sk->sk_user_data; 1476 1477 if (likely(queue)) ··· 1669 1666 static void nvmet_tcp_listen_data_ready(struct sock *sk) 1670 1667 { 1671 1668 struct nvmet_tcp_port *port; 1669 + 1670 + trace_sk_data_ready(sk); 1672 1671 1673 1672 read_lock_bh(&sk->sk_callback_lock); 1674 1673 port = sk->sk_user_data;
+3
drivers/scsi/iscsi_tcp.c
··· 36 36 #include <scsi/scsi.h> 37 37 #include <scsi/scsi_transport_iscsi.h> 38 38 #include <trace/events/iscsi.h> 39 + #include <trace/events/sock.h> 39 40 40 41 #include "iscsi_tcp.h" 41 42 ··· 170 169 struct iscsi_sw_tcp_conn *tcp_sw_conn; 171 170 struct iscsi_tcp_conn *tcp_conn; 172 171 struct iscsi_conn *conn; 172 + 173 + trace_sk_data_ready(sk); 173 174 174 175 read_lock_bh(&sk->sk_callback_lock); 175 176 conn = sk->sk_user_data;
+3
drivers/soc/qcom/qmi_interface.c
··· 12 12 #include <linux/string.h> 13 13 #include <net/sock.h> 14 14 #include <linux/workqueue.h> 15 + #include <trace/events/sock.h> 15 16 #include <linux/soc/qcom/qmi.h> 16 17 17 18 static struct socket *qmi_sock_create(struct qmi_handle *qmi, ··· 569 568 static void qmi_data_ready(struct sock *sk) 570 569 { 571 570 struct qmi_handle *qmi = sk->sk_user_data; 571 + 572 + trace_sk_data_ready(sk); 572 573 573 574 /* 574 575 * This will be NULL if we receive data while being in
+2
drivers/target/iscsi/iscsi_target_nego.c
··· 13 13 #include <linux/slab.h> 14 14 #include <linux/sched/signal.h> 15 15 #include <net/sock.h> 16 + #include <trace/events/sock.h> 16 17 #include <scsi/iscsi_proto.h> 17 18 #include <target/target_core_base.h> 18 19 #include <target/target_core_fabric.h> ··· 385 384 struct iscsit_conn *conn = sk->sk_user_data; 386 385 bool rc; 387 386 387 + trace_sk_data_ready(sk); 388 388 pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn); 389 389 390 390 write_lock_bh(&sk->sk_callback_lock);
+5
drivers/xen/pvcalls-back.c
··· 14 14 #include <net/inet_common.h> 15 15 #include <net/inet_connection_sock.h> 16 16 #include <net/request_sock.h> 17 + #include <trace/events/sock.h> 17 18 18 19 #include <xen/events.h> 19 20 #include <xen/grant_table.h> ··· 300 299 { 301 300 struct sock_mapping *map = sock->sk_user_data; 302 301 struct pvcalls_ioworker *iow; 302 + 303 + trace_sk_data_ready(sock); 303 304 304 305 if (map == NULL) 305 306 return; ··· 590 587 struct xen_pvcalls_response *rsp; 591 588 unsigned long flags; 592 589 int notify; 590 + 591 + trace_sk_data_ready(sock); 593 592 594 593 if (mappass == NULL) 595 594 return;
+5
fs/dlm/lowcomms.c
··· 54 54 #include <net/ipv6.h> 55 55 56 56 #include <trace/events/dlm.h> 57 + #include <trace/events/sock.h> 57 58 58 59 #include "dlm_internal.h" 59 60 #include "lowcomms.h" ··· 500 499 { 501 500 struct connection *con = sock2con(sk); 502 501 502 + trace_sk_data_ready(sk); 503 + 503 504 set_bit(CF_RECV_INTR, &con->flags); 504 505 lowcomms_queue_rwork(con); 505 506 } ··· 533 530 534 531 static void lowcomms_listen_data_ready(struct sock *sk) 535 532 { 533 + trace_sk_data_ready(sk); 534 + 536 535 queue_work(io_workqueue, &listen_con.rwork); 537 536 } 538 537
+5
fs/ocfs2/cluster/tcp.c
··· 46 46 #include <linux/net.h> 47 47 #include <linux/export.h> 48 48 #include <net/tcp.h> 49 + #include <trace/events/sock.h> 49 50 50 51 #include <linux/uaccess.h> 51 52 ··· 585 584 { 586 585 void (*ready)(struct sock *sk); 587 586 struct o2net_sock_container *sc; 587 + 588 + trace_sk_data_ready(sk); 588 589 589 590 read_lock_bh(&sk->sk_callback_lock); 590 591 sc = sk->sk_user_data; ··· 1933 1930 static void o2net_listen_data_ready(struct sock *sk) 1934 1931 { 1935 1932 void (*ready)(struct sock *sk); 1933 + 1934 + trace_sk_data_ready(sk); 1936 1935 1937 1936 read_lock_bh(&sk->sk_callback_lock); 1938 1937 ready = sk->sk_user_data;
+24
include/trace/events/sock.h
··· 263 263 __entry->error) 264 264 ); 265 265 266 + TRACE_EVENT(sk_data_ready, 267 + 268 + TP_PROTO(const struct sock *sk), 269 + 270 + TP_ARGS(sk), 271 + 272 + TP_STRUCT__entry( 273 + __field(const void *, skaddr) 274 + __field(__u16, family) 275 + __field(__u16, protocol) 276 + __field(unsigned long, ip) 277 + ), 278 + 279 + TP_fast_assign( 280 + __entry->skaddr = sk; 281 + __entry->family = sk->sk_family; 282 + __entry->protocol = sk->sk_protocol; 283 + __entry->ip = _RET_IP_; 284 + ), 285 + 286 + TP_printk("family=%u protocol=%u func=%ps", 287 + __entry->family, __entry->protocol, (void *)__entry->ip) 288 + ); 289 + 266 290 /* 267 291 * sock send/recv msg length 268 292 */
+4
net/bluetooth/rfcomm/core.c
··· 35 35 #include <net/bluetooth/l2cap.h> 36 36 #include <net/bluetooth/rfcomm.h> 37 37 38 + #include <trace/events/sock.h> 39 + 38 40 #define VERSION "1.11" 39 41 40 42 static bool disable_cfc; ··· 188 186 189 187 static void rfcomm_l2data_ready(struct sock *sk) 190 188 { 189 + trace_sk_data_ready(sk); 190 + 191 191 BT_DBG("%p", sk); 192 192 rfcomm_schedule(); 193 193 }
+4
net/ceph/messenger.c
··· 17 17 #endif /* CONFIG_BLOCK */ 18 18 #include <linux/dns_resolver.h> 19 19 #include <net/tcp.h> 20 + #include <trace/events/sock.h> 20 21 21 22 #include <linux/ceph/ceph_features.h> 22 23 #include <linux/ceph/libceph.h> ··· 345 344 static void ceph_sock_data_ready(struct sock *sk) 346 345 { 347 346 struct ceph_connection *con = sk->sk_user_data; 347 + 348 + trace_sk_data_ready(sk); 349 + 348 350 if (atomic_read(&con->msgr->stopping)) { 349 351 return; 350 352 }
+2
net/core/net-traces.c
··· 61 61 62 62 EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset); 63 63 EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum); 64 + 65 + EXPORT_TRACEPOINT_SYMBOL_GPL(sk_data_ready);
+5
net/core/skmsg.c
··· 8 8 #include <net/sock.h> 9 9 #include <net/tcp.h> 10 10 #include <net/tls.h> 11 + #include <trace/events/sock.h> 11 12 12 13 static bool sk_msg_try_coalesce_ok(struct sk_msg *msg, int elem_first_coalesce) 13 14 { ··· 1115 1114 { 1116 1115 struct sk_psock *psock; 1117 1116 1117 + trace_sk_data_ready(sk); 1118 + 1118 1119 rcu_read_lock(); 1119 1120 psock = sk_psock(sk); 1120 1121 if (likely(psock)) { ··· 1212 1209 static void sk_psock_verdict_data_ready(struct sock *sk) 1213 1210 { 1214 1211 struct socket *sock = sk->sk_socket; 1212 + 1213 + trace_sk_data_ready(sk); 1215 1214 1216 1215 if (unlikely(!sock || !sock->ops || !sock->ops->read_skb)) 1217 1216 return;
+2
net/core/sock.c
··· 3291 3291 { 3292 3292 struct socket_wq *wq; 3293 3293 3294 + trace_sk_data_ready(sk); 3295 + 3294 3296 rcu_read_lock(); 3295 3297 wq = rcu_dereference(sk->sk_wq); 3296 3298 if (skwq_has_sleeper(wq))
+3
net/kcm/kcmsock.c
··· 28 28 #include <net/netns/generic.h> 29 29 #include <net/sock.h> 30 30 #include <uapi/linux/kcm.h> 31 + #include <trace/events/sock.h> 31 32 32 33 unsigned int kcm_net_id; 33 34 ··· 349 348 static void psock_data_ready(struct sock *sk) 350 349 { 351 350 struct kcm_psock *psock; 351 + 352 + trace_sk_data_ready(sk); 352 353 353 354 read_lock_bh(&sk->sk_callback_lock); 354 355
+3
net/mptcp/subflow.c
··· 26 26 #include "mib.h" 27 27 28 28 #include <trace/events/mptcp.h> 29 + #include <trace/events/sock.h> 29 30 30 31 static void mptcp_subflow_ops_undo_override(struct sock *ssk); 31 32 ··· 1438 1437 u16 state = 1 << inet_sk_state_load(sk); 1439 1438 struct sock *parent = subflow->conn; 1440 1439 struct mptcp_sock *msk; 1440 + 1441 + trace_sk_data_ready(sk); 1441 1442 1442 1443 msk = mptcp_sk(parent); 1443 1444 if (state & TCPF_LISTEN) {
+4
net/phonet/pep-gprs.c
··· 19 19 #include <net/tcp_states.h> 20 20 #include <net/phonet/gprs.h> 21 21 22 + #include <trace/events/sock.h> 23 + 22 24 #define GPRS_DEFAULT_MTU 1400 23 25 24 26 struct gprs_dev { ··· 139 137 { 140 138 struct gprs_dev *gp = sk->sk_user_data; 141 139 struct sk_buff *skb; 140 + 141 + trace_sk_data_ready(sk); 142 142 143 143 while ((skb = pep_read(sk)) != NULL) { 144 144 skb_orphan(skb);
+3
net/qrtr/ns.c
··· 12 12 13 13 #include "qrtr.h" 14 14 15 + #include <trace/events/sock.h> 15 16 #define CREATE_TRACE_POINTS 16 17 #include <trace/events/qrtr.h> 17 18 ··· 753 752 754 753 static void qrtr_ns_data_ready(struct sock *sk) 755 754 { 755 + trace_sk_data_ready(sk); 756 + 756 757 queue_work(qrtr_ns.workqueue, &qrtr_ns.work); 757 758 } 758 759
+2
net/rds/tcp_listen.c
··· 34 34 #include <linux/gfp.h> 35 35 #include <linux/in.h> 36 36 #include <net/tcp.h> 37 + #include <trace/events/sock.h> 37 38 38 39 #include "rds.h" 39 40 #include "tcp.h" ··· 235 234 { 236 235 void (*ready)(struct sock *sk); 237 236 237 + trace_sk_data_ready(sk); 238 238 rdsdebug("listen data ready sk %p\n", sk); 239 239 240 240 read_lock_bh(&sk->sk_callback_lock);
+2
net/rds/tcp_recv.c
··· 33 33 #include <linux/kernel.h> 34 34 #include <linux/slab.h> 35 35 #include <net/tcp.h> 36 + #include <trace/events/sock.h> 36 37 37 38 #include "rds.h" 38 39 #include "tcp.h" ··· 310 309 struct rds_conn_path *cp; 311 310 struct rds_tcp_connection *tc; 312 311 312 + trace_sk_data_ready(sk); 313 313 rdsdebug("data ready sk %p\n", sk); 314 314 315 315 read_lock_bh(&sk->sk_callback_lock);
+3
net/sctp/socket.c
··· 59 59 #include <net/ipv6.h> 60 60 #include <net/inet_common.h> 61 61 #include <net/busy_poll.h> 62 + #include <trace/events/sock.h> 62 63 63 64 #include <linux/socket.h> /* for sa_family_t */ 64 65 #include <linux/export.h> ··· 9244 9243 void sctp_data_ready(struct sock *sk) 9245 9244 { 9246 9245 struct socket_wq *wq; 9246 + 9247 + trace_sk_data_ready(sk); 9247 9248 9248 9249 rcu_read_lock(); 9249 9250 wq = rcu_dereference(sk->sk_wq);
+3
net/smc/smc_rx.c
··· 15 15 #include <linux/sched/signal.h> 16 16 17 17 #include <net/sock.h> 18 + #include <trace/events/sock.h> 18 19 19 20 #include "smc.h" 20 21 #include "smc_core.h" ··· 31 30 static void smc_rx_wake_up(struct sock *sk) 32 31 { 33 32 struct socket_wq *wq; 33 + 34 + trace_sk_data_ready(sk); 34 35 35 36 /* derived from sock_def_readable() */ 36 37 /* called already in smc_listen_work() */
+5
net/sunrpc/svcsock.c
··· 55 55 #include <linux/sunrpc/stats.h> 56 56 #include <linux/sunrpc/xprt.h> 57 57 58 + #include <trace/events/sock.h> 58 59 #include <trace/events/sunrpc.h> 59 60 60 61 #include "socklib.h" ··· 310 309 static void svc_data_ready(struct sock *sk) 311 310 { 312 311 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; 312 + 313 + trace_sk_data_ready(sk); 313 314 314 315 if (svsk) { 315 316 /* Refer to svc_setup_socket() for details. */ ··· 689 686 static void svc_tcp_listen_data_ready(struct sock *sk) 690 687 { 691 688 struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; 689 + 690 + trace_sk_data_ready(sk); 692 691 693 692 if (svsk) { 694 693 /* Refer to svc_setup_socket() for details. */
+3
net/sunrpc/xprtsock.c
··· 52 52 #include <linux/uio.h> 53 53 #include <linux/sched/mm.h> 54 54 55 + #include <trace/events/sock.h> 55 56 #include <trace/events/sunrpc.h> 56 57 57 58 #include "socklib.h" ··· 1378 1377 static void xs_data_ready(struct sock *sk) 1379 1378 { 1380 1379 struct rpc_xprt *xprt; 1380 + 1381 + trace_sk_data_ready(sk); 1381 1382 1382 1383 xprt = xprt_from_sock(sk); 1383 1384 if (xprt != NULL) {
+3
net/tipc/socket.c
··· 37 37 38 38 #include <linux/rhashtable.h> 39 39 #include <linux/sched/signal.h> 40 + #include <trace/events/sock.h> 40 41 41 42 #include "core.h" 42 43 #include "name_table.h" ··· 2130 2129 static void tipc_data_ready(struct sock *sk) 2131 2130 { 2132 2131 struct socket_wq *wq; 2132 + 2133 + trace_sk_data_ready(sk); 2133 2134 2134 2135 rcu_read_lock(); 2135 2136 wq = rcu_dereference(sk->sk_wq);
+5
net/tipc/topsrv.c
··· 43 43 #include "bearer.h" 44 44 #include <net/sock.h> 45 45 #include <linux/module.h> 46 + #include <trace/events/sock.h> 46 47 47 48 /* Number of messages to send before rescheduling */ 48 49 #define MAX_SEND_MSG_COUNT 25 ··· 440 439 { 441 440 struct tipc_conn *con; 442 441 442 + trace_sk_data_ready(sk); 443 + 443 444 read_lock_bh(&sk->sk_callback_lock); 444 445 con = sk->sk_user_data; 445 446 if (connected(con)) { ··· 498 495 static void tipc_topsrv_listener_data_ready(struct sock *sk) 499 496 { 500 497 struct tipc_topsrv *srv; 498 + 499 + trace_sk_data_ready(sk); 501 500 502 501 read_lock_bh(&sk->sk_callback_lock); 503 502 srv = sk->sk_user_data;
+3
net/tls/tls_sw.c
··· 43 43 44 44 #include <net/strparser.h> 45 45 #include <net/tls.h> 46 + #include <trace/events/sock.h> 46 47 47 48 #include "tls.h" 48 49 ··· 2284 2283 struct tls_context *tls_ctx = tls_get_ctx(sk); 2285 2284 struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); 2286 2285 struct sk_psock *psock; 2286 + 2287 + trace_sk_data_ready(sk); 2287 2288 2288 2289 tls_strp_data_ready(&ctx->strp); 2289 2290
+3
net/xfrm/espintcp.c
··· 6 6 #include <net/espintcp.h> 7 7 #include <linux/skmsg.h> 8 8 #include <net/inet_common.h> 9 + #include <trace/events/sock.h> 9 10 #if IS_ENABLED(CONFIG_IPV6) 10 11 #include <net/ipv6_stubs.h> 11 12 #endif ··· 397 396 static void espintcp_data_ready(struct sock *sk) 398 397 { 399 398 struct espintcp_ctx *ctx = espintcp_getctx(sk); 399 + 400 + trace_sk_data_ready(sk); 400 401 401 402 strp_data_ready(&ctx->strp); 402 403 }