From: Peilin Ye <[email protected]>
As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
and ->saved_data_ready() call sites. For example:
<...>
cat-7011 [005] ..... 92.018695: sk_data_ready: family=16 protocol=17 func=sock_def_readable
cat-7012 [005] ..... 93.612922: sk_data_ready: family=16 protocol=16 func=sock_def_readable
cat-7013 [005] ..... 94.653854: sk_data_ready: family=16 protocol=16 func=sock_def_readable
<...>
Suggested-by: Cong Wang <[email protected]>
Signed-off-by: Peilin Ye <[email protected]>
---
drivers/infiniband/sw/siw/siw_cm.c | 6 ++++-
.../chelsio/inline_crypto/chtls/chtls_cm.c | 4 +++
drivers/net/tun.c | 27 +++++++++++++------
include/linux/skmsg.h | 8 ++++--
include/trace/events/sock.h | 25 +++++++++++++++++
net/atm/clip.c | 2 ++
net/atm/lec.c | 6 +++++
net/atm/mpc.c | 4 +++
net/atm/raw.c | 2 ++
net/atm/signaling.c | 9 +++++--
net/ax25/ax25_in.c | 5 +++-
net/bluetooth/iso.c | 3 +++
net/bluetooth/l2cap_sock.c | 10 +++++--
net/bluetooth/rfcomm/sock.c | 3 +++
net/bluetooth/sco.c | 2 ++
net/caif/caif_socket.c | 7 +++--
net/core/skmsg.c | 1 +
net/core/sock.c | 4 ++-
net/dccp/input.c | 2 ++
net/dccp/minisocks.c | 5 +++-
net/ipv4/tcp_input.c | 12 +++++++--
net/ipv4/tcp_minisocks.c | 5 +++-
net/ipv4/udp.c | 5 +++-
net/iucv/af_iucv.c | 3 +++
net/kcm/kcmsock.c | 5 +++-
net/key/af_key.c | 2 ++
net/mptcp/protocol.c | 6 ++++-
net/mptcp/subflow.c | 2 ++
net/netlink/af_netlink.c | 2 ++
net/netrom/af_netrom.c | 5 +++-
net/nfc/llcp_core.c | 2 ++
net/packet/af_packet.c | 5 ++++
net/phonet/pep.c | 13 ++++++---
net/rose/af_rose.c | 5 +++-
net/rxrpc/recvmsg.c | 2 ++
net/sctp/stream_interleave.c | 3 +++
net/sctp/ulpqueue.c | 3 +++
net/smc/smc_close.c | 2 ++
net/tipc/socket.c | 2 ++
net/tipc/topsrv.c | 2 ++
net/tls/tls_sw.c | 9 +++++--
net/unix/af_unix.c | 6 +++++
net/vmw_vsock/af_vsock.c | 5 +++-
net/vmw_vsock/hyperv_transport.c | 5 +++-
net/vmw_vsock/virtio_transport_common.c | 2 ++
net/vmw_vsock/vmci_transport.c | 2 ++
net/x25/af_x25.c | 5 +++-
net/x25/x25_in.c | 5 +++-
net/xfrm/espintcp.c | 2 ++
49 files changed, 225 insertions(+), 37 deletions(-)
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index f88d2971c2c6..cd58af4785f2 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -16,6 +16,7 @@
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/tcp.h>
+#include <trace/events/sock.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
@@ -998,6 +999,7 @@ static void siw_cm_work_handler(struct work_struct *w)
struct siw_cm_work *work;
struct siw_cep *cep;
int release_cep = 0, rv = 0;
+ struct sock *sk;
work = container_of(w, struct siw_cm_work, work.work);
cep = work->cep;
@@ -1042,7 +1044,9 @@ static void siw_cm_work_handler(struct work_struct *w)
* silently ignore the mpa packet.
*/
if (cep->state == SIW_EPSTATE_RDMA_MODE) {
- cep->sock->sk->sk_data_ready(cep->sock->sk);
+ sk = cep->sock->sk;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
+ sk->sk_data_ready(sk);
siw_dbg_cep(cep, "already in RDMA mode");
} else {
siw_dbg_cep(cep, "out of state: %d\n",
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
index f90bfba4b303..0a7c7a9e5d0b 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
@@ -28,6 +28,7 @@
#include <net/tls.h>
#include <net/addrconf.h>
#include <net/secure_seq.h>
+#include <trace/events/sock.h>
#include "chtls.h"
#include "chtls_cm.h"
@@ -1555,6 +1556,7 @@ static void add_pass_open_to_parent(struct sock *child, struct sock *lsk,
} else {
refcount_set(&oreq->rsk_refcnt, 1);
inet_csk_reqsk_queue_add(lsk, oreq, child);
+ trace_sk_data_ready(lsk, lsk->sk_data_ready);
lsk->sk_data_ready(lsk);
}
}
@@ -1719,6 +1721,7 @@ static void chtls_recv_data(struct sock *sk, struct sk_buff *skb)
if (!sock_flag(sk, SOCK_DEAD)) {
check_sk_callbacks(csk);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
@@ -1840,6 +1843,7 @@ static void chtls_rx_hdr(struct sock *sk, struct sk_buff *skb)
if (!sock_flag(sk, SOCK_DEAD)) {
check_sk_callbacks(csk);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 3732e51b5ad8..ec9428a8903d 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -77,6 +77,7 @@
#include <net/ax25.h>
#include <net/rose.h>
#include <net/6lowpan.h>
+#include <trace/events/sock.h>
#include <linux/uaccess.h>
#include <linux/proc_fs.h>
@@ -709,19 +710,24 @@ static void tun_detach_all(struct net_device *dev)
struct tun_struct *tun = netdev_priv(dev);
struct tun_file *tfile, *tmp;
int i, n = tun->numqueues;
+ struct sock *sk;
for (i = 0; i < n; i++) {
tfile = rtnl_dereference(tun->tfiles[i]);
BUG_ON(!tfile);
tun_napi_disable(tfile);
- tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN;
- tfile->socket.sk->sk_data_ready(tfile->socket.sk);
+ sk = tfile->socket.sk;
+ sk->sk_shutdown = RCV_SHUTDOWN;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
+ sk->sk_data_ready(sk);
RCU_INIT_POINTER(tfile->tun, NULL);
--tun->numqueues;
}
list_for_each_entry(tfile, &tun->disabled, next) {
- tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN;
- tfile->socket.sk->sk_data_ready(tfile->socket.sk);
+ sk = tfile->socket.sk;
+ sk->sk_shutdown = RCV_SHUTDOWN;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
+ sk->sk_data_ready(sk);
RCU_INIT_POINTER(tfile->tun, NULL);
}
BUG_ON(tun->numqueues != 0);
@@ -1073,6 +1079,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
struct netdev_queue *queue;
struct tun_file *tfile;
int len = skb->len;
+ struct sock *sk;
rcu_read_lock();
tfile = rcu_dereference(tun->tfiles[txq]);
@@ -1096,8 +1103,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
goto drop;
}
- if (tfile->socket.sk->sk_filter &&
- sk_filter(tfile->socket.sk, skb)) {
+ sk = tfile->socket.sk;
+ if (sk->sk_filter && sk_filter(sk, skb)) {
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
goto drop;
}
@@ -1139,7 +1146,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
/* Notify and wake up reader process */
if (tfile->flags & TUN_FASYNC)
kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
- tfile->socket.sk->sk_data_ready(tfile->socket.sk);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
+ sk->sk_data_ready(sk);
rcu_read_unlock();
return NETDEV_TX_OK;
@@ -1260,10 +1268,13 @@ static const struct net_device_ops tun_netdev_ops = {
static void __tun_xdp_flush_tfile(struct tun_file *tfile)
{
+ struct sock *sk = tfile->socket.sk;
+
/* Notify and wake up reader process */
if (tfile->flags & TUN_FASYNC)
kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
- tfile->socket.sk->sk_data_ready(tfile->socket.sk);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
+ sk->sk_data_ready(sk);
}
static int tun_xdp_xmit(struct net_device *dev, int n,
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index 48f4b645193b..ccf4e1b94828 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -12,6 +12,7 @@
#include <net/sock.h>
#include <net/tcp.h>
#include <net/strparser.h>
+#include <trace/events/sock.h>
#define MAX_MSG_FRAGS MAX_SKB_FRAGS
#define NR_MSG_FRAG_IDS (MAX_MSG_FRAGS + 1)
@@ -454,10 +455,13 @@ static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock)
static inline void sk_psock_data_ready(struct sock *sk, struct sk_psock *psock)
{
- if (psock->saved_data_ready)
+ if (psock->saved_data_ready) {
+ trace_sk_data_ready(sk, psock->saved_data_ready);
psock->saved_data_ready(sk);
- else
+ } else {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
}
static inline void psock_set_prog(struct bpf_prog **pprog,
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 777ee6cbe933..22ed9065d874 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -263,6 +263,31 @@ TRACE_EVENT(inet_sk_error_report,
__entry->error)
);
+TRACE_EVENT(sk_data_ready,
+
+ TP_PROTO(const struct sock *sk,
+ const void (*data_ready)(struct sock *)),
+
+ TP_ARGS(sk, data_ready),
+
+ TP_STRUCT__entry(
+ __field(const void *, skaddr)
+ __field(__u16, family)
+ __field(__u16, protocol)
+ __field(const void *, func)
+ ),
+
+ TP_fast_assign(
+ __entry->skaddr = sk;
+ __entry->family = sk->sk_family;
+ __entry->protocol = sk->sk_protocol;
+ __entry->func = data_ready;
+ ),
+
+ TP_printk("family=%u protocol=%u func=%ps", __entry->family,
+ __entry->protocol, __entry->func)
+);
+
#endif /* _TRACE_SOCK_H */
/* This part must be outside protection */
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 294cb9efe3d3..78b251fd5273 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -39,6 +39,7 @@
#include <linux/uaccess.h>
#include <asm/byteorder.h> /* for htons etc. */
#include <linux/atomic.h>
+#include <trace/events/sock.h>
#include "common.h"
#include "resources.h"
@@ -69,6 +70,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
sk = sk_atm(atmarpd);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
return 0;
}
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 6257bf12e5a0..8dd3036c1c20 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -26,6 +26,7 @@
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/seq_file.h>
+#include <trace/events/sock.h>
/* And atm device */
#include <linux/atmdev.h>
@@ -156,6 +157,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
atm_force_charge(priv->lecd, skb2->truesize);
sk = sk_atm(priv->lecd);
skb_queue_tail(&sk->sk_receive_queue, skb2);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
@@ -450,6 +452,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
atm_force_charge(priv->lecd, skb2->truesize);
sk = sk_atm(priv->lecd);
skb_queue_tail(&sk->sk_receive_queue, skb2);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
@@ -533,12 +536,14 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
atm_force_charge(priv->lecd, skb->truesize);
sk = sk_atm(priv->lecd);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
if (data != NULL) {
pr_debug("about to send %d bytes of data\n", data->len);
atm_force_charge(priv->lecd, data->truesize);
skb_queue_tail(&sk->sk_receive_queue, data);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
@@ -609,6 +614,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
pr_debug("%s: To daemon\n", dev->name);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
} else { /* Data frame, queue to protocol handlers */
struct lec_arp_table *entry;
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 033871e718a3..074abe53feb6 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -23,6 +23,7 @@
#include <net/arp.h>
#include <net/dst.h>
#include <linux/proc_fs.h>
+#include <trace/events/sock.h>
/* And atm device */
#include <linux/atmdev.h>
@@ -706,6 +707,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
dprintk("(%s) control packet arrived\n", dev->name);
/* Pass control packets to daemon */
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
return;
}
@@ -991,6 +993,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
sk = sk_atm(mpc->mpoad_vcc);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
return 0;
@@ -1273,6 +1276,7 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
sk = sk_atm(vcc);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
dprintk("exiting\n");
}
diff --git a/net/atm/raw.c b/net/atm/raw.c
index 2b5f78a7ec3e..b98d0d17e420 100644
--- a/net/atm/raw.c
+++ b/net/atm/raw.c
@@ -12,6 +12,7 @@
#include <linux/skbuff.h>
#include <linux/mm.h>
#include <linux/slab.h>
+#include <trace/events/sock.h>
#include "common.h"
#include "protocols.h"
@@ -26,6 +27,7 @@ static void atm_push_raw(struct atm_vcc *vcc, struct sk_buff *skb)
struct sock *sk = sk_atm(vcc);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index 5de06ab8ed75..b38feb812eb8 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -16,6 +16,7 @@
#include <linux/atmdev.h>
#include <linux/bitops.h>
#include <linux/slab.h>
+#include <trace/events/sock.h>
#include "resources.h"
#include "signaling.h"
@@ -24,14 +25,18 @@ struct atm_vcc *sigd = NULL;
static void sigd_put_skb(struct sk_buff *skb)
{
+ struct sock *sk;
+
if (!sigd) {
pr_debug("atmsvc: no signaling daemon\n");
kfree_skb(skb);
return;
}
atm_force_charge(sigd, skb->truesize);
- skb_queue_tail(&sk_atm(sigd)->sk_receive_queue, skb);
- sk_atm(sigd)->sk_data_ready(sk_atm(sigd));
+ sk = sk_atm(sigd);
+ skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
+ sk->sk_data_ready(sk);
}
static void modify_qos(struct atm_vcc *vcc, struct atmsvc_msg *msg)
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 1cac25aca637..a8288735f96a 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -26,6 +26,7 @@
#include <linux/fcntl.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
+#include <trace/events/sock.h>
/*
* Given a fragment, queue it on the fragment queue and if the fragment
@@ -417,8 +418,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
ax25_start_idletimer(ax25);
if (sk) {
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
sock_put(sk);
} else {
free:
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 613039ba5dbf..cf4395873524 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -9,6 +9,7 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -161,6 +162,7 @@ static void iso_chan_del(struct sock *sk, int err)
parent = bt_sk(sk)->parent;
if (parent) {
bt_accept_unlink(sk);
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
} else {
sk->sk_state_change(sk);
@@ -1469,6 +1471,7 @@ static void iso_conn_ready(struct iso_conn *conn)
sk->sk_state = BT_CONNECTED;
/* Wake up parent */
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
release_sock(parent);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index ca8f07f3542b..7fc4c86b1e06 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -31,6 +31,7 @@
#include <linux/export.h>
#include <linux/filter.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -1584,6 +1585,7 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)
if (parent) {
bt_accept_unlink(sk);
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
} else {
sk->sk_state_change(sk);
@@ -1645,8 +1647,10 @@ static void l2cap_sock_ready_cb(struct l2cap_chan *chan)
sk->sk_state = BT_CONNECTED;
sk->sk_state_change(sk);
- if (parent)
+ if (parent) {
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
+ }
release_sock(sk);
}
@@ -1658,8 +1662,10 @@ static void l2cap_sock_defer_cb(struct l2cap_chan *chan)
lock_sock(sk);
parent = bt_sk(sk)->parent;
- if (parent)
+ if (parent) {
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
+ }
release_sock(sk);
}
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 4bf4ea6cbb5e..d6af9bb8da1e 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -28,6 +28,7 @@
#include <linux/export.h>
#include <linux/debugfs.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -55,6 +56,7 @@ static void rfcomm_sk_data_ready(struct rfcomm_dlc *d, struct sk_buff *skb)
atomic_add(skb->len, &sk->sk_rmem_alloc);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
@@ -83,6 +85,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
sock_set_flag(sk, SOCK_ZAPPED);
bt_accept_unlink(sk);
}
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
} else {
if (d->state == BT_CONNECTED)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 1111da4e2f2b..7d611364952b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -28,6 +28,7 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -1316,6 +1317,7 @@ static void sco_conn_ready(struct sco_conn *conn)
sk->sk_state = BT_CONNECTED;
/* Wake up parent */
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
release_sock(parent);
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index 748be7253248..99addf07125a 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -26,6 +26,7 @@
#include <net/caif/caif_layer.h>
#include <net/caif/caif_dev.h>
#include <net/caif/cfpkt.h>
+#include <trace/events/sock.h>
MODULE_LICENSE("GPL");
MODULE_ALIAS_NETPROTO(AF_CAIF);
@@ -150,10 +151,12 @@ static void caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
__skb_queue_tail(list, skb);
spin_unlock_irqrestore(&list->lock, flags);
out:
- if (queued)
+ if (queued) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
- else
+ } else {
kfree_skb(skb);
+ }
}
/* Packet Receive Callback function called from CAIF Stack */
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 188f8558d27d..68ea92ef147d 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1114,6 +1114,7 @@ static void sk_psock_strp_data_ready(struct sock *sk)
psock = sk_psock(sk);
if (likely(psock)) {
if (tls_sw_has_ctx_rx(sk)) {
+ trace_sk_data_ready(sk, psock->saved_data_ready);
psock->saved_data_ready(sk);
} else {
write_lock_bh(&sk->sk_callback_lock);
diff --git a/net/core/sock.c b/net/core/sock.c
index eeb6cbac6f49..9a0ede730a7b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -502,8 +502,10 @@ int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
__skb_queue_tail(list, skb);
spin_unlock_irqrestore(&list->lock, flags);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return 0;
}
EXPORT_SYMBOL(__sock_queue_rcv_skb);
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 2cbb757a894f..5c42c6a4a356 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include "ackvec.h"
#include "ccid.h"
@@ -24,6 +25,7 @@ static void dccp_enqueue_skb(struct sock *sk, struct sk_buff *skb)
__skb_pull(skb, dccp_hdr(skb)->dccph_doff * 4);
__skb_queue_tail(&sk->sk_receive_queue, skb);
skb_set_owner_r(skb, sk);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 64d805b27add..663f07576a52 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -15,6 +15,7 @@
#include <net/sock.h>
#include <net/xfrm.h>
#include <net/inet_timewait_sock.h>
+#include <trace/events/sock.h>
#include "ackvec.h"
#include "ccid.h"
@@ -229,8 +230,10 @@ int dccp_child_process(struct sock *parent, struct sock *child,
skb->len);
/* Wakeup parent, send SIGIO */
- if (state == DCCP_RESPOND && child->sk_state != state)
+ if (state == DCCP_RESPOND && child->sk_state != state) {
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
+ }
} else {
/* Alas, it is possible again, because we do lookup
* in main socket hash table and lock on listening
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index bc2ea12221f9..86e44250affc 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -76,6 +76,7 @@
#include <linux/ipsec.h>
#include <asm/unaligned.h>
#include <linux/errqueue.h>
+#include <trace/events/sock.h>
#include <trace/events/tcp.h>
#include <linux/jump_label_ratelimit.h>
#include <net/busy_poll.h>
@@ -4795,6 +4796,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
tcp_drop_reason(sk, skb, SKB_DROP_REASON_PROTO_MEM);
return;
@@ -5000,8 +5002,10 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
void tcp_data_ready(struct sock *sk)
{
- if (tcp_epollin_ready(sk, sk->sk_rcvlowat) || sock_flag(sk, SOCK_DONE))
+ if (tcp_epollin_ready(sk, sk->sk_rcvlowat) || sock_flag(sk, SOCK_DONE)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
}
static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
@@ -5047,6 +5051,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
else if (tcp_try_rmem_schedule(sk, skb, skb->truesize)) {
reason = SKB_DROP_REASON_PROTO_MEM;
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
goto drop;
}
@@ -5664,8 +5669,10 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, const struct tcphdr *t
if (skb_copy_bits(skb, ptr, &tmp, 1))
BUG();
WRITE_ONCE(tp->urg_data, TCP_URG_VALID | tmp);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
}
}
}
@@ -7018,6 +7025,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
sock_put(fastopen_sk);
goto drop_and_free;
}
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
bh_unlock_sock(fastopen_sk);
sock_put(fastopen_sk);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 442838ab0253..fe528da25d78 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -22,6 +22,7 @@
#include <net/tcp.h>
#include <net/xfrm.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
static bool tcp_in_window(u32 seq, u32 end_seq, u32 s_win, u32 e_win)
{
@@ -855,8 +856,10 @@ int tcp_child_process(struct sock *parent, struct sock *child,
if (!sock_owned_by_user(child)) {
ret = tcp_rcv_state_process(child, skb);
/* Wakeup parent, send SIGIO */
- if (state == TCP_SYN_RECV && child->sk_state != state)
+ if (state == TCP_SYN_RECV && child->sk_state != state) {
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
+ }
} else {
/* Alas, it is possible again, because we do lookup
* in main socket hash table and lock on listening
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d63118ce5900..3092962129f2 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -108,6 +108,7 @@
#include <linux/static_key.h>
#include <linux/btf_ids.h>
#include <trace/events/skb.h>
+#include <trace/events/sock.h>
#include <net/busy_poll.h>
#include "udp_impl.h"
#include <net/sock_reuseport.h>
@@ -1582,8 +1583,10 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
__skb_queue_tail(list, skb);
spin_unlock(&list->lock);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
busylock_release(busy);
return 0;
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 498a0c35b7bb..7edc3890b9c1 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -31,6 +31,7 @@
#include <asm/ebcdic.h>
#include <asm/cpcmd.h>
#include <linux/kmod.h>
+#include <trace/events/sock.h>
#include <net/iucv/af_iucv.h>
@@ -1665,6 +1666,7 @@ static int iucv_callback_connreq(struct iucv_path *path,
/* Wake up accept */
nsk->sk_state = IUCV_CONNECTED;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
err = 0;
fail:
@@ -1885,6 +1887,7 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb)
if (!err) {
iucv_accept_enqueue(sk, nsk);
nsk->sk_state = IUCV_CONNECTED;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
} else
iucv_sock_kill(nsk);
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 1215c863e1c4..3b1a5807a449 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -28,6 +28,7 @@
#include <net/netns/generic.h>
#include <net/sock.h>
#include <uapi/linux/kcm.h>
+#include <trace/events/sock.h>
unsigned int kcm_net_id;
@@ -206,8 +207,10 @@ static int kcm_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
skb_queue_tail(list, skb);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return 0;
}
diff --git a/net/key/af_key.c b/net/key/af_key.c
index c85df5b958d2..17e3295945a3 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -28,6 +28,7 @@
#include <net/xfrm.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#define _X2KEY(x) ((x) == XFRM_INF ? 0 : (x))
#define _KEY2X(x) ((x) == 0 ? XFRM_INF : (x))
@@ -201,6 +202,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, gfp_t allocation,
if (skb) {
skb_set_owner_r(skb, sk);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
err = 0;
}
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 866dfad3cde6..27a62209ee68 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -26,6 +26,7 @@
#include "protocol.h"
#include "mib.h"
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/mptcp.h>
@@ -815,8 +816,10 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
/* Wake-up the reader only for in-sequence data */
mptcp_data_lock(sk);
- if (move_skbs_to_msk(msk, ssk))
+ if (move_skbs_to_msk(msk, ssk)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
mptcp_data_unlock(sk);
}
@@ -910,6 +913,7 @@ static void mptcp_check_for_eof(struct mptcp_sock *msk)
sk->sk_shutdown |= RCV_SHUTDOWN;
smp_mb__before_atomic(); /* SHUTDOWN must be visible first */
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index c7d49fb6e7bd..8409e46c58d8 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -26,6 +26,7 @@
#include "mib.h"
#include <trace/events/mptcp.h>
+#include <trace/events/sock.h>
static void mptcp_subflow_ops_undo_override(struct sock *ssk);
@@ -1382,6 +1383,7 @@ static void subflow_data_ready(struct sock *sk)
if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue))
return;
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
return;
}
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a662e8a5ff84..0532cb50701f 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -69,6 +69,7 @@
#include <net/sock.h>
#include <net/scm.h>
#include <net/netlink.h>
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/netlink.h>
@@ -1263,6 +1264,7 @@ static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb)
netlink_deliver_tap(sock_net(sk), skb);
skb_queue_tail(&sk->sk_receive_queue, skb);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
return len;
}
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 6f7f4392cffb..5998464f832b 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -40,6 +40,7 @@
#include <net/tcp_states.h>
#include <net/arp.h>
#include <linux/init.h>
+#include <trace/events/sock.h>
static int nr_ndevs = 4;
@@ -1015,8 +1016,10 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
sk_acceptq_added(sk);
skb_queue_head(&sk->sk_receive_queue, skb);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
bh_unlock_sock(sk);
sock_put(sk);
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
index 3364caabef8b..3e7ff57a8c65 100644
--- a/net/nfc/llcp_core.c
+++ b/net/nfc/llcp_core.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/nfc.h>
+#include <trace/events/sock.h>
#include "nfc.h"
#include "llcp.h"
@@ -973,6 +974,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
new_sk->sk_state = LLCP_CONNECTED;
/* Wake the listening processes */
+ trace_sk_data_ready(parent, parent->sk_data_ready);
parent->sk_data_ready(parent);
/* Send CC */
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d3f6db350de7..5925b58cb5de 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -93,6 +93,7 @@
#include <linux/bpf.h>
#include <net/compat.h>
#include <linux/netfilter_netdev.h>
+#include <trace/events/sock.h>
#include "internal.h"
@@ -829,6 +830,7 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
/* Flush the block */
prb_flush_block(pkc1, pbd1, status);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1);
@@ -2212,6 +2214,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
skb_clear_delivery_time(skb);
__skb_queue_tail(&sk->sk_receive_queue, skb);
spin_unlock(&sk->sk_receive_queue.lock);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
return 0;
@@ -2485,6 +2488,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
__packet_set_status(po, h.raw, status);
__clear_bit(slot_id, po->rx_ring.rx_owner_map);
spin_unlock(&sk->sk_receive_queue.lock);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
} else if (po->tp_version == TPACKET_V3) {
prb_clear_blk_fill_status(&po->rx_ring);
@@ -2507,6 +2511,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
atomic_inc(&po->tp_drops);
is_drop_n_account = true;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
kfree_skb(copy_skb);
goto drop_n_restore;
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 83ea13a50690..8bfa1b6b9420 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -22,6 +22,7 @@
#include <net/phonet/phonet.h>
#include <net/phonet/pep.h>
#include <net/phonet/gprs.h>
+#include <trace/events/sock.h>
/* sk_state values:
* TCP_CLOSE sock not in use yet
@@ -451,8 +452,10 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
skb->dev = NULL;
skb_set_owner_r(skb, sk);
skb_queue_tail(queue, skb);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return NET_RX_SUCCESS;
}
@@ -575,8 +578,10 @@ static int pipe_handler_do_rcv(struct sock *sk, struct sk_buff *skb)
skb->dev = NULL;
skb_set_owner_r(skb, sk);
skb_queue_tail(&sk->sk_receive_queue, skb);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return NET_RX_SUCCESS;
case PNS_PEP_CONNECT_RESP:
@@ -683,8 +688,10 @@ static int pep_do_rcv(struct sock *sk, struct sk_buff *skb)
}
skb_queue_head(&sk->sk_receive_queue, skb);
sk_acceptq_added(sk);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return NET_RX_SUCCESS;
case PNS_PEP_DISCONNECT_REQ:
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 36fefc3957d7..c063d639f1c5 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -43,6 +43,7 @@
#include <net/tcp_states.h>
#include <net/ip.h>
#include <net/arp.h>
+#include <trace/events/sock.h>
static int rose_ndevs = 10;
@@ -1055,8 +1056,10 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
rose_start_heartbeat(make);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return 1;
}
diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
index 7e39c262fd79..90138ac63d94 100644
--- a/net/rxrpc/recvmsg.c
+++ b/net/rxrpc/recvmsg.c
@@ -14,6 +14,7 @@
#include <net/sock.h>
#include <net/af_rxrpc.h>
+#include <trace/events/sock.h>
#include "ar-internal.h"
/*
@@ -49,6 +50,7 @@ void rxrpc_notify_socket(struct rxrpc_call *call)
if (!sock_flag(sk, SOCK_DEAD)) {
_debug("call %ps", sk->sk_data_ready);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
index bb22b71df7a3..497d37ef0c43 100644
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -20,6 +20,7 @@
#include <net/sctp/sm.h>
#include <net/sctp/ulpevent.h>
#include <linux/sctp.h>
+#include <trace/events/sock.h>
static struct sctp_chunk *sctp_make_idatafrag_empty(
const struct sctp_association *asoc,
@@ -498,6 +499,7 @@ static int sctp_enqueue_event(struct sctp_ulpq *ulpq,
if (!sp->data_ready_signalled) {
sp->data_ready_signalled = 1;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
@@ -1000,6 +1002,7 @@ static void sctp_intl_stream_abort_pd(struct sctp_ulpq *ulpq, __u16 sid,
if (!sp->data_ready_signalled) {
sp->data_ready_signalled = 1;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 0a8510a0c5e6..ba2b9c4e0095 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -27,6 +27,7 @@
#include <net/sctp/structs.h>
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
+#include <trace/events/sock.h>
/* Forward declarations for internal helpers. */
static struct sctp_ulpevent *sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
@@ -254,6 +255,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sk_buff_head *skb_list)
if (queue == &sk->sk_receive_queue && !sp->data_ready_signalled) {
if (!sock_owned_by_user(sk))
sp->data_ready_signalled = 1;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
return 1;
@@ -1127,6 +1129,7 @@ void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp)
/* If there is data waiting, send it up the socket now. */
if ((sctp_ulpq_clear_pd(ulpq) || ev) && !sp->data_ready_signalled) {
sp->data_ready_signalled = 1;
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 31db7438857c..9eb5c52eefef 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -14,6 +14,7 @@
#include <net/sock.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "smc.h"
#include "smc_tx.h"
@@ -425,6 +426,7 @@ static void smc_close_passive_work(struct work_struct *work)
}
wakeup:
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk); /* wakeup blocked rcvbuf consumers */
sk->sk_write_space(sk); /* wakeup blocked sndbuf producers */
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f1c3b8eb4b3d..7db9cf1c5948 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -37,6 +37,7 @@
#include <linux/rhashtable.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include "core.h"
#include "name_table.h"
@@ -2385,6 +2386,7 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb,
skb_set_owner_r(skb, sk);
trace_tipc_sk_overlimit2(sk, skb, TIPC_DUMP_ALL,
"rcvq >90% allocated!");
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
}
}
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 5522865deae9..4e138081f01a 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -43,6 +43,7 @@
#include "bearer.h"
#include <net/sock.h>
#include <linux/module.h>
+#include <trace/events/sock.h>
/* Number of messages to send before rescheduling */
#define MAX_SEND_MSG_COUNT 25
@@ -476,6 +477,7 @@ static void tipc_topsrv_accept(struct work_struct *work)
write_unlock_bh(&newsk->sk_callback_lock);
/* Wake up receive process in case of 'SYN+' message */
+ trace_sk_data_ready(newsk, newsk->sk_data_ready);
newsk->sk_data_ready(newsk);
}
}
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 264cf367e265..0667891f2fcd 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -43,6 +43,7 @@
#include <net/strparser.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
#include "tls.h"
@@ -2271,9 +2272,11 @@ int tls_rx_msg_size(struct tls_strparser *strp, struct sk_buff *skb)
void tls_rx_msg_ready(struct tls_strparser *strp)
{
struct tls_sw_context_rx *ctx;
+ struct sock *sk = strp->sk;
ctx = container_of(strp, struct tls_sw_context_rx, strp);
- ctx->saved_data_ready(strp->sk);
+ trace_sk_data_ready(sk, ctx->saved_data_ready);
+ ctx->saved_data_ready(sk);
}
static void tls_data_ready(struct sock *sk)
@@ -2286,8 +2289,10 @@ static void tls_data_ready(struct sock *sk)
psock = sk_psock_get(sk);
if (psock) {
- if (!list_empty(&psock->ingress_msg))
+ if (!list_empty(&psock->ingress_msg)) {
+ trace_sk_data_ready(sk, ctx->saved_data_ready);
ctx->saved_data_ready(sk);
+ }
sk_psock_put(sk, psock);
}
}
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index c955c7253d4b..bdd140138c19 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -115,6 +115,7 @@
#include <linux/freezer.h>
#include <linux/file.h>
#include <linux/btf_ids.h>
+#include <trace/events/sock.h>
#include "scm.h"
@@ -1627,6 +1628,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
__skb_queue_tail(&other->sk_receive_queue, skb);
spin_unlock(&other->sk_receive_queue.lock);
unix_state_unlock(other);
+ trace_sk_data_ready(other, other->sk_data_ready);
other->sk_data_ready(other);
sock_put(other);
return 0;
@@ -2072,6 +2074,7 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
scm_stat_add(other, skb);
skb_queue_tail(&other->sk_receive_queue, skb);
unix_state_unlock(other);
+ trace_sk_data_ready(other, other->sk_data_ready);
other->sk_data_ready(other);
sock_put(other);
scm_destroy(&scm);
@@ -2136,6 +2139,7 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other
skb_queue_tail(&other->sk_receive_queue, skb);
sk_send_sigurg(other);
unix_state_unlock(other);
+ trace_sk_data_ready(other, other->sk_data_ready);
other->sk_data_ready(other);
return err;
@@ -2228,6 +2232,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
scm_stat_add(other, skb);
skb_queue_tail(&other->sk_receive_queue, skb);
unix_state_unlock(other);
+ trace_sk_data_ready(other, other->sk_data_ready);
other->sk_data_ready(other);
sent += size;
}
@@ -2356,6 +2361,7 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page,
unix_state_unlock(other);
mutex_unlock(&unix_sk(other)->iolock);
+ trace_sk_data_ready(other, other->sk_data_ready);
other->sk_data_ready(other);
scm_destroy(&scm);
return size;
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index ee418701cdee..1ad731eb1482 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -110,6 +110,7 @@
#include <linux/workqueue.h>
#include <net/sock.h>
#include <net/af_vsock.h>
+#include <trace/events/sock.h>
static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr);
static void vsock_sk_destruct(struct sock *sk);
@@ -887,8 +888,10 @@ void vsock_data_ready(struct sock *sk)
struct vsock_sock *vsk = vsock_sk(sk);
if (vsock_stream_has_data(vsk) >= sk->sk_rcvlowat ||
- sock_flag(sk, SOCK_DONE))
+ sock_flag(sk, SOCK_DONE)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
}
EXPORT_SYMBOL_GPL(vsock_data_ready);
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index 59c3e2697069..dfb753261440 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -14,6 +14,7 @@
#include <net/sock.h>
#include <net/af_vsock.h>
#include <asm/hyperv-tlfs.h>
+#include <trace/events/sock.h>
/* Older (VMBUS version 'VERSION_WIN10' or before) Windows hosts have some
* stricter requirements on the hv_sock ring buffer size of six 4K pages.
@@ -251,8 +252,10 @@ static void hvs_channel_cb(void *ctx)
struct hvsock *hvs = vsk->trans;
struct vmbus_channel *chan = hvs->chan;
- if (hvs_channel_readable(chan))
+ if (hvs_channel_readable(chan)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
if (hv_get_bytes_to_write(&chan->outbound) > 0)
sk->sk_write_space(sk);
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 35863132f4f1..c7eb4771b9c0 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -17,6 +17,7 @@
#include <net/sock.h>
#include <net/af_vsock.h>
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/vsock_virtio_transport_common.h>
@@ -1223,6 +1224,7 @@ virtio_transport_recv_listen(struct sock *sk, struct virtio_vsock_pkt *pkt,
release_sock(child);
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
return 0;
}
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 842c94286d31..d79506d53009 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -26,6 +26,7 @@
#include <linux/workqueue.h>
#include <net/sock.h>
#include <net/af_vsock.h>
+#include <trace/events/sock.h>
#include "vmci_transport_notify.h"
@@ -1254,6 +1255,7 @@ vmci_transport_recv_connecting_server(struct sock *listener,
/* Callers of accept() will be waiting on the listening socket, not
* the pending socket.
*/
+ trace_sk_data_ready(listener, listener->sk_data_ready);
listener->sk_data_ready(listener);
return 0;
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 3b55502b2965..3f252226c241 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -53,6 +53,7 @@
#include <linux/init.h>
#include <linux/compat.h>
#include <linux/ctype.h>
+#include <trace/events/sock.h>
#include <net/x25.h>
#include <net/compat.h>
@@ -1080,8 +1081,10 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
x25_start_heartbeat(make);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
rc = 1;
sock_put(sk);
out:
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c
index b981a4828d08..7eb444723633 100644
--- a/net/x25/x25_in.c
+++ b/net/x25/x25_in.c
@@ -28,6 +28,7 @@
#include <net/sock.h>
#include <net/tcp_states.h>
#include <net/x25.h>
+#include <trace/events/sock.h>
static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
{
@@ -73,8 +74,10 @@ static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
skb_set_owner_r(skbn, sk);
skb_queue_tail(&sk->sk_receive_queue, skbn);
- if (!sock_flag(sk, SOCK_DEAD))
+ if (!sock_flag(sk, SOCK_DEAD)) {
+ trace_sk_data_ready(sk, sk->sk_data_ready);
sk->sk_data_ready(sk);
+ }
return 0;
}
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 974eb97b77d2..2f81405b4e05 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -6,6 +6,7 @@
#include <net/espintcp.h>
#include <linux/skmsg.h>
#include <net/inet_common.h>
+#include <trace/events/sock.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6_stubs.h>
#endif
@@ -24,6 +25,7 @@ static void handle_nonesp(struct espintcp_ctx *ctx, struct sk_buff *skb,
memset(skb->cb, 0, sizeof(skb->cb));
skb_queue_tail(&ctx->ike_queue, skb);
+ trace_sk_data_ready(sk, ctx->saved_data_ready);
ctx->saved_data_ready(sk);
}
--
2.20.1
On Wed, Sep 28, 2022 at 3:15 PM Peilin Ye <[email protected]> wrote:
>
> From: Peilin Ye <[email protected]>
>
> As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> and ->saved_data_ready() call sites. For example:
>
> <...>
> cat-7011 [005] ..... 92.018695: sk_data_ready: family=16 protocol=17 func=sock_def_readable
> cat-7012 [005] ..... 93.612922: sk_data_ready: family=16 protocol=16 func=sock_def_readable
> cat-7013 [005] ..... 94.653854: sk_data_ready: family=16 protocol=16 func=sock_def_readable
> <...>
>
> Suggested-by: Cong Wang <[email protected]>
> Signed-off-by: Peilin Ye <[email protected]>
I will not comment on if/why these tracepoints are useful, only on the
way you did this work.
I would rather split this in two parts.
First patch adding and using a common helper.
static inline void sock_data_ready(struct sock *sk)
{
sk->sk_data_ready(sk);
}
s/sk->sk_data_ready(sk)/sock_data_ready(sk)/
Second patch adding the tracing point once in the helper ?
Alternatively, why not add the tracepoint directly in the called
functions (we have few of them),
instead of all call points ?
On Wed, 28 Sep 2022 15:15:14 -0700 Peilin Ye wrote:
> From: Peilin Ye <[email protected]>
>
> As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> and ->saved_data_ready() call sites. For example:
warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
const void (*data_ready)(struct sock *)),
Please double check W=1 build before reposting
On Thu, Sep 29, 2022 at 09:18:40AM -0700, Jakub Kicinski wrote:
> warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
> const void (*data_ready)(struct sock *)),
>
> Please double check W=1 build before reposting
Sorry; should be "void (*const data_ready)(struct sock *)" instead.
Will fix in v2.
Peilin Ye
On Thu, Sep 29, 2022 at 09:19:34AM -0700, Eric Dumazet wrote:
> I would rather split this in two parts.
>
> First patch adding and using a common helper.
>
> static inline void sock_data_ready(struct sock *sk)
> {
> sk->sk_data_ready(sk);
> }
>
> s/sk->sk_data_ready(sk)/sock_data_ready(sk)/
>
>
> Second patch adding the tracing point once in the helper ?
>
> Alternatively, why not add the tracepoint directly in the called
> functions (we have few of them),
> instead of all call points ?
Thanks for the suggestions. I will move this tracepoint into callees in
v2.
Thanks,
Peilin Ye
From: Peilin Ye <[email protected]>
As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
callback implementations. For example:
<...>
dpkg-deb-7752 [000] ..... 145.660735: sk_data_ready: family=16 protocol=16 func=sock_def_readable
dpkg-deb-7757 [000] ..... 145.759168: sk_data_ready: family=16 protocol=16 func=sock_def_readable
dpkg-deb-7758 [000] ..... 145.763956: sk_data_ready: family=16 protocol=16 func=sock_def_readable
<...>
Suggested-by: Cong Wang <[email protected]>
Signed-off-by: Peilin Ye <[email protected]>
---
changes since v1:
- Move tracepoint into ->sk_data_ready() callback implementations
(Eric Dumazet)
- Fix W=1 warning (Jakub Kicinski)
drivers/infiniband/hw/erdma/erdma_cm.c | 3 +++
drivers/infiniband/sw/siw/siw_cm.c | 5 +++++
drivers/infiniband/sw/siw/siw_qp.c | 3 +++
drivers/nvme/host/tcp.c | 3 +++
drivers/nvme/target/tcp.c | 5 +++++
drivers/scsi/iscsi_tcp.c | 3 +++
drivers/soc/qcom/qmi_interface.c | 3 +++
drivers/target/iscsi/iscsi_target_nego.c | 2 ++
drivers/xen/pvcalls-back.c | 5 +++++
fs/dlm/lowcomms.c | 5 +++++
fs/ocfs2/cluster/tcp.c | 5 +++++
include/trace/events/sock.h | 24 ++++++++++++++++++++++++
net/ceph/messenger.c | 4 ++++
net/core/skmsg.c | 3 +++
net/core/sock.c | 2 ++
net/kcm/kcmsock.c | 3 +++
net/mptcp/subflow.c | 3 +++
net/qrtr/ns.c | 3 +++
net/rds/tcp_listen.c | 2 ++
net/rds/tcp_recv.c | 2 ++
net/sctp/socket.c | 3 +++
net/smc/smc_rx.c | 3 +++
net/sunrpc/svcsock.c | 5 +++++
net/sunrpc/xprtsock.c | 3 +++
net/tipc/socket.c | 3 +++
net/tipc/topsrv.c | 5 +++++
net/tls/tls_sw.c | 3 +++
net/xfrm/espintcp.c | 3 +++
28 files changed, 116 insertions(+)
diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index f13f16479eca..63f314222813 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -16,6 +16,7 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#include <net/addrconf.h>
+#include <trace/events/sock.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_verbs.h>
@@ -933,6 +934,8 @@ static void erdma_cm_llp_data_ready(struct sock *sk)
{
struct erdma_cep *cep;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index f88d2971c2c6..05c58f0f1e2d 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -16,6 +16,7 @@
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/tcp.h>
+#include <trace/events/sock.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
@@ -109,6 +110,8 @@ static void siw_rtr_data_ready(struct sock *sk)
struct siw_qp *qp = NULL;
read_descriptor_t rd_desc;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
@@ -1216,6 +1219,8 @@ static void siw_cm_llp_data_ready(struct sock *sk)
{
struct siw_cep *cep;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c
index 7e01f2438afc..f0710d346102 100644
--- a/drivers/infiniband/sw/siw/siw_qp.c
+++ b/drivers/infiniband/sw/siw/siw_qp.c
@@ -10,6 +10,7 @@
#include <linux/llist.h>
#include <asm/barrier.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "siw.h"
#include "siw_verbs.h"
@@ -94,6 +95,8 @@ void siw_qp_llp_data_ready(struct sock *sk)
{
struct siw_qp *qp;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
if (unlikely(!sk->sk_user_data || !sk_to_qp(sk)))
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d5871fd6f769..a1cab344cc41 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -14,6 +14,7 @@
#include <linux/blk-mq.h>
#include <crypto/hash.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include "nvme.h"
#include "fabrics.h"
@@ -906,6 +907,8 @@ static void nvme_tcp_data_ready(struct sock *sk)
{
struct nvme_tcp_queue *queue;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue && queue->rd_enabled) &&
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index a3694a32f6d5..bee3af922876 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -14,6 +14,7 @@
#include <linux/inet.h>
#include <linux/llist.h>
#include <crypto/hash.h>
+#include <trace/events/sock.h>
#include "nvmet.h"
@@ -1467,6 +1468,8 @@ static void nvmet_tcp_data_ready(struct sock *sk)
{
struct nvmet_tcp_queue *queue;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue))
@@ -1664,6 +1667,8 @@ static void nvmet_tcp_listen_data_ready(struct sock *sk)
{
struct nvmet_tcp_port *port;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
port = sk->sk_user_data;
if (!port)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 29b1bd755afe..5f9110d0578b 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -36,6 +36,7 @@
#include <scsi/scsi.h>
#include <scsi/scsi_transport_iscsi.h>
#include <trace/events/iscsi.h>
+#include <trace/events/sock.h>
#include "iscsi_tcp.h"
@@ -170,6 +171,8 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk)
struct iscsi_tcp_conn *tcp_conn;
struct iscsi_conn *conn;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
index c8c4c730b135..c5f441bf2198 100644
--- a/drivers/soc/qcom/qmi_interface.c
+++ b/drivers/soc/qcom/qmi_interface.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <net/sock.h>
#include <linux/workqueue.h>
+#include <trace/events/sock.h>
#include <linux/soc/qcom/qmi.h>
static struct socket *qmi_sock_create(struct qmi_handle *qmi,
@@ -569,6 +570,8 @@ static void qmi_data_ready(struct sock *sk)
{
struct qmi_handle *qmi = sk->sk_user_data;
+ trace_sk_data_ready(sk, __func__);
+
/*
* This will be NULL if we receive data while being in
* qmi_handle_release()
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index f2919319ad38..210788c80366 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include <scsi/iscsi_proto.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
@@ -384,6 +385,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
struct iscsit_conn *conn = sk->sk_user_data;
bool rc;
+ trace_sk_data_ready(sk, __func__);
pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);
write_lock_bh(&sk->sk_callback_lock);
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index d6f945fd4147..6644f191a89c 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -14,6 +14,7 @@
#include <net/inet_common.h>
#include <net/inet_connection_sock.h>
#include <net/request_sock.h>
+#include <trace/events/sock.h>
#include <xen/events.h>
#include <xen/grant_table.h>
@@ -300,6 +301,8 @@ static void pvcalls_sk_data_ready(struct sock *sock)
struct sock_mapping *map = sock->sk_user_data;
struct pvcalls_ioworker *iow;
+ trace_sk_data_ready(sock, __func__);
+
if (map == NULL)
return;
@@ -588,6 +591,8 @@ static void pvcalls_pass_sk_data_ready(struct sock *sock)
unsigned long flags;
int notify;
+ trace_sk_data_ready(sock, __func__);
+
if (mappass == NULL)
return;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 59f64c596233..e79c4bab121d 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -54,6 +54,7 @@
#include <net/ipv6.h>
#include <trace/events/dlm.h>
+#include <trace/events/sock.h>
#include "dlm_internal.h"
#include "lowcomms.h"
@@ -507,6 +508,8 @@ static void lowcomms_data_ready(struct sock *sk)
{
struct connection *con;
+ trace_sk_data_ready(sk, __func__);
+
con = sock2con(sk);
if (con && !test_and_set_bit(CF_READ_PENDING, &con->flags))
queue_work(recv_workqueue, &con->rwork);
@@ -514,6 +517,8 @@ static void lowcomms_data_ready(struct sock *sk)
static void lowcomms_listen_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk, __func__);
+
if (!dlm_allow_conn)
return;
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index f660c0dbdb63..464142e8908a 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -46,6 +46,7 @@
#include <linux/net.h>
#include <linux/export.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/uaccess.h>
@@ -585,6 +586,8 @@ static void o2net_data_ready(struct sock *sk)
void (*ready)(struct sock *sk);
struct o2net_sock_container *sc;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
sc = sk->sk_user_data;
if (sc) {
@@ -645,6 +648,8 @@ static void o2net_state_change(struct sock *sk)
static void o2net_register_callbacks(struct sock *sk,
struct o2net_sock_container *sc)
{
+ trace_sk_data_ready(sk, __func__);
+
write_lock_bh(&sk->sk_callback_lock);
/* accepted sockets inherit the old listen socket data ready */
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 777ee6cbe933..4d373e26d897 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -263,6 +263,30 @@ TRACE_EVENT(inet_sk_error_report,
__entry->error)
);
+TRACE_EVENT(sk_data_ready,
+
+ TP_PROTO(const struct sock *sk, const char *func),
+
+ TP_ARGS(sk, func),
+
+ TP_STRUCT__entry(
+ __field(const void *, skaddr)
+ __field(__u16, family)
+ __field(__u16, protocol)
+ __string(func, func)
+ ),
+
+ TP_fast_assign(
+ __entry->skaddr = sk;
+ __entry->family = sk->sk_family;
+ __entry->protocol = sk->sk_protocol;
+ __assign_str(func, func)
+ ),
+
+ TP_printk("family=%u protocol=%u func=%s",
+ __entry->family, __entry->protocol, __get_str(func))
+);
+
#endif /* _TRACE_SOCK_H */
/* This part must be outside protection */
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index d3bb656308b4..835bf9c8e3bc 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -17,6 +17,7 @@
#endif /* CONFIG_BLOCK */
#include <linux/dns_resolver.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/ceph/ceph_features.h>
#include <linux/ceph/libceph.h>
@@ -344,6 +345,9 @@ static void con_sock_state_closed(struct ceph_connection *con)
static void ceph_sock_data_ready(struct sock *sk)
{
struct ceph_connection *con = sk->sk_user_data;
+
+ trace_sk_data_ready(sk, __func__);
+
if (atomic_read(&con->msgr->stopping)) {
return;
}
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index ca70525621c7..58e25ae451d7 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -8,6 +8,7 @@
#include <net/sock.h>
#include <net/tcp.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
static bool sk_msg_try_coalesce_ok(struct sk_msg *msg, int elem_first_coalesce)
{
@@ -1210,6 +1211,8 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
{
struct socket *sock = sk->sk_socket;
+ trace_sk_data_ready(sk, __func__);
+
if (unlikely(!sock || !sock->ops || !sock->ops->read_skb))
return;
sock->ops->read_skb(sk, sk_psock_verdict_recv);
diff --git a/net/core/sock.c b/net/core/sock.c
index eeb6cbac6f49..0a25dcecdd5b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3269,6 +3269,8 @@ void sock_def_readable(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 1215c863e1c4..dac5c67ef312 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -28,6 +28,7 @@
#include <net/netns/generic.h>
#include <net/sock.h>
#include <uapi/linux/kcm.h>
+#include <trace/events/sock.h>
unsigned int kcm_net_id;
@@ -344,6 +345,8 @@ static void psock_data_ready(struct sock *sk)
{
struct kcm_psock *psock;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
psock = (struct kcm_psock *)sk->sk_user_data;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 07dd23d0fe04..20ee6884f03e 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -26,6 +26,7 @@
#include "mib.h"
#include <trace/events/mptcp.h>
+#include <trace/events/sock.h>
static void mptcp_subflow_ops_undo_override(struct sock *ssk);
@@ -1349,6 +1350,8 @@ static void subflow_data_ready(struct sock *sk)
struct sock *parent = subflow->conn;
struct mptcp_sock *msk;
+ trace_sk_data_ready(sk, __func__);
+
msk = mptcp_sk(parent);
if (state & TCPF_LISTEN) {
/* MPJ subflow are removed from accept queue before reaching here,
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 1990d496fcfc..eee6fc837621 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -12,6 +12,7 @@
#include "qrtr.h"
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/qrtr.h>
@@ -752,6 +753,8 @@ static void qrtr_ns_worker(struct work_struct *work)
static void qrtr_ns_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk, __func__);
+
queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
}
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 7edf2e69d3fe..e1a165816737 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -34,6 +34,7 @@
#include <linux/gfp.h>
#include <linux/in.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -234,6 +235,7 @@ void rds_tcp_listen_data_ready(struct sock *sk)
{
void (*ready)(struct sock *sk);
+ trace_sk_data_ready(sk, __func__);
rdsdebug("listen data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index f4ee13da90c7..0c2efbfc3f32 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -33,6 +33,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -309,6 +310,7 @@ void rds_tcp_data_ready(struct sock *sk)
struct rds_conn_path *cp;
struct rds_tcp_connection *tc;
+ trace_sk_data_ready(sk, __func__);
rdsdebug("data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 171f1a35d205..a76ffbe08c6d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -59,6 +59,7 @@
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include <linux/socket.h> /* for sa_family_t */
#include <linux/export.h>
@@ -9237,6 +9238,8 @@ void sctp_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index 17c5aee7ee4f..da309723a8de 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -15,6 +15,7 @@
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include "smc.h"
#include "smc_core.h"
@@ -31,6 +32,8 @@ static void smc_rx_wake_up(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
/* derived from sock_def_readable() */
/* called already in smc_listen_work() */
rcu_read_lock();
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 2fc98fea59b4..eb767fd3545f 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -55,6 +55,7 @@
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/xprt.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -310,6 +311,8 @@ static void svc_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk, __func__);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
@@ -687,6 +690,8 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk, __func__);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e976007f4fd0..c2e06a4881d7 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -52,6 +52,7 @@
#include <linux/uio.h>
#include <linux/sched/mm.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -1378,6 +1379,8 @@ static void xs_data_ready(struct sock *sk)
{
struct rpc_xprt *xprt;
+ trace_sk_data_ready(sk, __func__);
+
xprt = xprt_from_sock(sk);
if (xprt != NULL) {
struct sock_xprt *transport = container_of(xprt,
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f1c3b8eb4b3d..14965b05a691 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -37,6 +37,7 @@
#include <linux/rhashtable.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include "core.h"
#include "name_table.h"
@@ -2130,6 +2131,8 @@ static void tipc_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 5522865deae9..231bb704b455 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -43,6 +43,7 @@
#include "bearer.h"
#include <net/sock.h>
#include <linux/module.h>
+#include <trace/events/sock.h>
/* Number of messages to send before rescheduling */
#define MAX_SEND_MSG_COUNT 25
@@ -437,6 +438,8 @@ static void tipc_conn_data_ready(struct sock *sk)
{
struct tipc_conn *con;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
con = sk->sk_user_data;
if (connected(con)) {
@@ -487,6 +490,8 @@ static void tipc_topsrv_listener_data_ready(struct sock *sk)
{
struct tipc_topsrv *srv;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
srv = sk->sk_user_data;
if (srv->listener)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 264cf367e265..412733bdb8db 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -43,6 +43,7 @@
#include <net/strparser.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
#include "tls.h"
@@ -2282,6 +2283,8 @@ static void tls_data_ready(struct sock *sk)
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
struct sk_psock *psock;
+ trace_sk_data_ready(sk, __func__);
+
tls_strp_data_ready(&ctx->strp);
psock = sk_psock_get(sk);
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 29a540dcb5a7..9f68fb7dab6c 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -6,6 +6,7 @@
#include <net/espintcp.h>
#include <linux/skmsg.h>
#include <net/inet_common.h>
+#include <trace/events/sock.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6_stubs.h>
#endif
@@ -397,6 +398,8 @@ static void espintcp_data_ready(struct sock *sk)
{
struct espintcp_ctx *ctx = espintcp_getctx(sk);
+ trace_sk_data_ready(sk, __func__);
+
strp_data_ready(&ctx->strp);
}
--
2.20.1
Hi Peilin,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Peilin-Ye/net-sock-Introduce-trace_sk_data_ready/20221008-061418
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0326074ff4652329f2a1a9c8685104576bd8d131
config: x86_64-rhel-8.3-kselftests
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/5f951b832d90c5bfbf98c90e82194c0238c3ac33
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Peilin-Ye/net-sock-Introduce-trace_sk_data_ready/20221008-061418
git checkout 5f951b832d90c5bfbf98c90e82194c0238c3ac33
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>, old ones prefixed by <<):
ERROR: modpost: "__SCT__tp_func_sk_data_ready" [fs/dlm/dlm.ko] undefined!
ERROR: modpost: "__tracepoint_sk_data_ready" [fs/dlm/dlm.ko] undefined!
ERROR: modpost: "__SCK__tp_func_sk_data_ready" [fs/dlm/dlm.ko] undefined!
ERROR: modpost: "__SCT__tp_func_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
ERROR: modpost: "__tracepoint_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
ERROR: modpost: "__SCK__tp_func_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
ERROR: modpost: "__SCT__tp_func_sk_data_ready" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
ERROR: modpost: "__tracepoint_sk_data_ready" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
ERROR: modpost: "__SCK__tp_func_sk_data_ready" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
>> ERROR: modpost: "__SCT__tp_func_sk_data_ready" [net/tls/tls.ko] undefined!
WARNING: modpost: suppressed 11 unresolved symbol warnings because there were too many)
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Hi Peilin,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Peilin-Ye/net-sock-Introduce-trace_sk_data_ready/20221008-061418
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0326074ff4652329f2a1a9c8685104576bd8d131
config: s390-defconfig
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/5f951b832d90c5bfbf98c90e82194c0238c3ac33
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Peilin-Ye/net-sock-Introduce-trace_sk_data_ready/20221008-061418
git checkout 5f951b832d90c5bfbf98c90e82194c0238c3ac33
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>, old ones prefixed by <<):
ERROR: modpost: "__tracepoint_sk_data_ready" [fs/dlm/dlm.ko] undefined!
>> ERROR: modpost: "__traceiter_sk_data_ready" [fs/dlm/dlm.ko] undefined!
ERROR: modpost: "__tracepoint_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
>> ERROR: modpost: "__traceiter_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
>> ERROR: modpost: "__tracepoint_sk_data_ready" [drivers/scsi/iscsi_tcp.ko] undefined!
>> ERROR: modpost: "__traceiter_sk_data_ready" [drivers/scsi/iscsi_tcp.ko] undefined!
>> ERROR: modpost: "__tracepoint_sk_data_ready" [net/sunrpc/sunrpc.ko] undefined!
>> ERROR: modpost: "__traceiter_sk_data_ready" [net/sunrpc/sunrpc.ko] undefined!
>> ERROR: modpost: "__tracepoint_sk_data_ready" [net/sctp/sctp.ko] undefined!
>> ERROR: modpost: "__traceiter_sk_data_ready" [net/sctp/sctp.ko] undefined!
WARNING: modpost: suppressed 6 unresolved symbol warnings because there were too many)
--
0-DAY CI Kernel Test Service
https://01.org/lkp
On Sat, Oct 08, 2022 at 08:38:06AM +0800, kernel test robot wrote:
> ERROR: modpost: "__SCT__tp_func_sk_data_ready" [fs/dlm/dlm.ko] undefined!
> ERROR: modpost: "__tracepoint_sk_data_ready" [fs/dlm/dlm.ko] undefined!
> ERROR: modpost: "__SCK__tp_func_sk_data_ready" [fs/dlm/dlm.ko] undefined!
> ERROR: modpost: "__SCT__tp_func_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
> ERROR: modpost: "__tracepoint_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
> ERROR: modpost: "__SCK__tp_func_sk_data_ready" [fs/ocfs2/cluster/ocfs2_nodemanager.ko] undefined!
> ERROR: modpost: "__SCT__tp_func_sk_data_ready" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
> ERROR: modpost: "__tracepoint_sk_data_ready" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
> ERROR: modpost: "__SCK__tp_func_sk_data_ready" [drivers/target/iscsi/iscsi_target_mod.ko] undefined!
> >> ERROR: modpost: "__SCT__tp_func_sk_data_ready" [net/tls/tls.ko] undefined!
> WARNING: modpost: suppressed 11 unresolved symbol warnings because there were too many)
Similar to [1], we need EXPORT_TRACEPOINT_SYMBOL_GPL() in
net/core/net-traces.c for modules. Will fix in v3.
[1] https://lore.kernel.org/netdev/[email protected]/
Thanks,
Peilin Ye
From: Peilin Ye <[email protected]>
As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
callback implementations. For example:
<...>
dpkg-deb-7752 [000] ..... 145.660735: sk_data_ready: family=16 protocol=16 func=sock_def_readable
dpkg-deb-7757 [000] ..... 145.759168: sk_data_ready: family=16 protocol=16 func=sock_def_readable
dpkg-deb-7758 [000] ..... 145.763956: sk_data_ready: family=16 protocol=16 func=sock_def_readable
<...>
Suggested-by: Cong Wang <[email protected]>
Signed-off-by: Peilin Ye <[email protected]>
---
change since v2:
- Fix modpost error for modules (kernel test robot)
changes since v1:
- Move tracepoint into ->sk_data_ready() callback implementations
(Eric Dumazet)
- Fix W=1 warning (Jakub Kicinski)
drivers/infiniband/hw/erdma/erdma_cm.c | 3 +++
drivers/infiniband/sw/siw/siw_cm.c | 5 +++++
drivers/infiniband/sw/siw/siw_qp.c | 3 +++
drivers/nvme/host/tcp.c | 3 +++
drivers/nvme/target/tcp.c | 5 +++++
drivers/scsi/iscsi_tcp.c | 3 +++
drivers/soc/qcom/qmi_interface.c | 3 +++
drivers/target/iscsi/iscsi_target_nego.c | 2 ++
drivers/xen/pvcalls-back.c | 5 +++++
fs/dlm/lowcomms.c | 5 +++++
fs/ocfs2/cluster/tcp.c | 5 +++++
include/trace/events/sock.h | 24 ++++++++++++++++++++++++
net/ceph/messenger.c | 4 ++++
net/core/net-traces.c | 2 ++
net/core/skmsg.c | 3 +++
net/core/sock.c | 2 ++
net/kcm/kcmsock.c | 3 +++
net/mptcp/subflow.c | 3 +++
net/qrtr/ns.c | 3 +++
net/rds/tcp_listen.c | 2 ++
net/rds/tcp_recv.c | 2 ++
net/sctp/socket.c | 3 +++
net/smc/smc_rx.c | 3 +++
net/sunrpc/svcsock.c | 5 +++++
net/sunrpc/xprtsock.c | 3 +++
net/tipc/socket.c | 3 +++
net/tipc/topsrv.c | 5 +++++
net/tls/tls_sw.c | 3 +++
net/xfrm/espintcp.c | 3 +++
29 files changed, 118 insertions(+)
diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index f13f16479eca..63f314222813 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -16,6 +16,7 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#include <net/addrconf.h>
+#include <trace/events/sock.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_verbs.h>
@@ -933,6 +934,8 @@ static void erdma_cm_llp_data_ready(struct sock *sk)
{
struct erdma_cep *cep;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index f88d2971c2c6..05c58f0f1e2d 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -16,6 +16,7 @@
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/tcp.h>
+#include <trace/events/sock.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
@@ -109,6 +110,8 @@ static void siw_rtr_data_ready(struct sock *sk)
struct siw_qp *qp = NULL;
read_descriptor_t rd_desc;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
@@ -1216,6 +1219,8 @@ static void siw_cm_llp_data_ready(struct sock *sk)
{
struct siw_cep *cep;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c
index 7e01f2438afc..f0710d346102 100644
--- a/drivers/infiniband/sw/siw/siw_qp.c
+++ b/drivers/infiniband/sw/siw/siw_qp.c
@@ -10,6 +10,7 @@
#include <linux/llist.h>
#include <asm/barrier.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "siw.h"
#include "siw_verbs.h"
@@ -94,6 +95,8 @@ void siw_qp_llp_data_ready(struct sock *sk)
{
struct siw_qp *qp;
+ trace_sk_data_ready(sk, __func__);
+
read_lock(&sk->sk_callback_lock);
if (unlikely(!sk->sk_user_data || !sk_to_qp(sk)))
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d5871fd6f769..a1cab344cc41 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -14,6 +14,7 @@
#include <linux/blk-mq.h>
#include <crypto/hash.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include "nvme.h"
#include "fabrics.h"
@@ -906,6 +907,8 @@ static void nvme_tcp_data_ready(struct sock *sk)
{
struct nvme_tcp_queue *queue;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue && queue->rd_enabled) &&
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index a3694a32f6d5..bee3af922876 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -14,6 +14,7 @@
#include <linux/inet.h>
#include <linux/llist.h>
#include <crypto/hash.h>
+#include <trace/events/sock.h>
#include "nvmet.h"
@@ -1467,6 +1468,8 @@ static void nvmet_tcp_data_ready(struct sock *sk)
{
struct nvmet_tcp_queue *queue;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue))
@@ -1664,6 +1667,8 @@ static void nvmet_tcp_listen_data_ready(struct sock *sk)
{
struct nvmet_tcp_port *port;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
port = sk->sk_user_data;
if (!port)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 29b1bd755afe..5f9110d0578b 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -36,6 +36,7 @@
#include <scsi/scsi.h>
#include <scsi/scsi_transport_iscsi.h>
#include <trace/events/iscsi.h>
+#include <trace/events/sock.h>
#include "iscsi_tcp.h"
@@ -170,6 +171,8 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk)
struct iscsi_tcp_conn *tcp_conn;
struct iscsi_conn *conn;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
index c8c4c730b135..c5f441bf2198 100644
--- a/drivers/soc/qcom/qmi_interface.c
+++ b/drivers/soc/qcom/qmi_interface.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <net/sock.h>
#include <linux/workqueue.h>
+#include <trace/events/sock.h>
#include <linux/soc/qcom/qmi.h>
static struct socket *qmi_sock_create(struct qmi_handle *qmi,
@@ -569,6 +570,8 @@ static void qmi_data_ready(struct sock *sk)
{
struct qmi_handle *qmi = sk->sk_user_data;
+ trace_sk_data_ready(sk, __func__);
+
/*
* This will be NULL if we receive data while being in
* qmi_handle_release()
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index f2919319ad38..210788c80366 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include <scsi/iscsi_proto.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
@@ -384,6 +385,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
struct iscsit_conn *conn = sk->sk_user_data;
bool rc;
+ trace_sk_data_ready(sk, __func__);
pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);
write_lock_bh(&sk->sk_callback_lock);
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index d6f945fd4147..6644f191a89c 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -14,6 +14,7 @@
#include <net/inet_common.h>
#include <net/inet_connection_sock.h>
#include <net/request_sock.h>
+#include <trace/events/sock.h>
#include <xen/events.h>
#include <xen/grant_table.h>
@@ -300,6 +301,8 @@ static void pvcalls_sk_data_ready(struct sock *sock)
struct sock_mapping *map = sock->sk_user_data;
struct pvcalls_ioworker *iow;
+ trace_sk_data_ready(sock, __func__);
+
if (map == NULL)
return;
@@ -588,6 +591,8 @@ static void pvcalls_pass_sk_data_ready(struct sock *sock)
unsigned long flags;
int notify;
+ trace_sk_data_ready(sock, __func__);
+
if (mappass == NULL)
return;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 59f64c596233..e79c4bab121d 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -54,6 +54,7 @@
#include <net/ipv6.h>
#include <trace/events/dlm.h>
+#include <trace/events/sock.h>
#include "dlm_internal.h"
#include "lowcomms.h"
@@ -507,6 +508,8 @@ static void lowcomms_data_ready(struct sock *sk)
{
struct connection *con;
+ trace_sk_data_ready(sk, __func__);
+
con = sock2con(sk);
if (con && !test_and_set_bit(CF_READ_PENDING, &con->flags))
queue_work(recv_workqueue, &con->rwork);
@@ -514,6 +517,8 @@ static void lowcomms_data_ready(struct sock *sk)
static void lowcomms_listen_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk, __func__);
+
if (!dlm_allow_conn)
return;
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index f660c0dbdb63..464142e8908a 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -46,6 +46,7 @@
#include <linux/net.h>
#include <linux/export.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/uaccess.h>
@@ -585,6 +586,8 @@ static void o2net_data_ready(struct sock *sk)
void (*ready)(struct sock *sk);
struct o2net_sock_container *sc;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
sc = sk->sk_user_data;
if (sc) {
@@ -645,6 +648,8 @@ static void o2net_state_change(struct sock *sk)
static void o2net_register_callbacks(struct sock *sk,
struct o2net_sock_container *sc)
{
+ trace_sk_data_ready(sk, __func__);
+
write_lock_bh(&sk->sk_callback_lock);
/* accepted sockets inherit the old listen socket data ready */
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 777ee6cbe933..4d373e26d897 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -263,6 +263,30 @@ TRACE_EVENT(inet_sk_error_report,
__entry->error)
);
+TRACE_EVENT(sk_data_ready,
+
+ TP_PROTO(const struct sock *sk, const char *func),
+
+ TP_ARGS(sk, func),
+
+ TP_STRUCT__entry(
+ __field(const void *, skaddr)
+ __field(__u16, family)
+ __field(__u16, protocol)
+ __string(func, func)
+ ),
+
+ TP_fast_assign(
+ __entry->skaddr = sk;
+ __entry->family = sk->sk_family;
+ __entry->protocol = sk->sk_protocol;
+ __assign_str(func, func)
+ ),
+
+ TP_printk("family=%u protocol=%u func=%s",
+ __entry->family, __entry->protocol, __get_str(func))
+);
+
#endif /* _TRACE_SOCK_H */
/* This part must be outside protection */
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index d3bb656308b4..835bf9c8e3bc 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -17,6 +17,7 @@
#endif /* CONFIG_BLOCK */
#include <linux/dns_resolver.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/ceph/ceph_features.h>
#include <linux/ceph/libceph.h>
@@ -344,6 +345,9 @@ static void con_sock_state_closed(struct ceph_connection *con)
static void ceph_sock_data_ready(struct sock *sk)
{
struct ceph_connection *con = sk->sk_user_data;
+
+ trace_sk_data_ready(sk, __func__);
+
if (atomic_read(&con->msgr->stopping)) {
return;
}
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index c40cd8dd75c7..ee7006bbe49b 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -61,3 +61,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll);
EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset);
EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum);
+
+EXPORT_TRACEPOINT_SYMBOL_GPL(sk_data_ready);
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index ca70525621c7..58e25ae451d7 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -8,6 +8,7 @@
#include <net/sock.h>
#include <net/tcp.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
static bool sk_msg_try_coalesce_ok(struct sk_msg *msg, int elem_first_coalesce)
{
@@ -1210,6 +1211,8 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
{
struct socket *sock = sk->sk_socket;
+ trace_sk_data_ready(sk, __func__);
+
if (unlikely(!sock || !sock->ops || !sock->ops->read_skb))
return;
sock->ops->read_skb(sk, sk_psock_verdict_recv);
diff --git a/net/core/sock.c b/net/core/sock.c
index eeb6cbac6f49..0a25dcecdd5b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3269,6 +3269,8 @@ void sock_def_readable(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 1215c863e1c4..dac5c67ef312 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -28,6 +28,7 @@
#include <net/netns/generic.h>
#include <net/sock.h>
#include <uapi/linux/kcm.h>
+#include <trace/events/sock.h>
unsigned int kcm_net_id;
@@ -344,6 +345,8 @@ static void psock_data_ready(struct sock *sk)
{
struct kcm_psock *psock;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
psock = (struct kcm_psock *)sk->sk_user_data;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 07dd23d0fe04..20ee6884f03e 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -26,6 +26,7 @@
#include "mib.h"
#include <trace/events/mptcp.h>
+#include <trace/events/sock.h>
static void mptcp_subflow_ops_undo_override(struct sock *ssk);
@@ -1349,6 +1350,8 @@ static void subflow_data_ready(struct sock *sk)
struct sock *parent = subflow->conn;
struct mptcp_sock *msk;
+ trace_sk_data_ready(sk, __func__);
+
msk = mptcp_sk(parent);
if (state & TCPF_LISTEN) {
/* MPJ subflow are removed from accept queue before reaching here,
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 1990d496fcfc..eee6fc837621 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -12,6 +12,7 @@
#include "qrtr.h"
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/qrtr.h>
@@ -752,6 +753,8 @@ static void qrtr_ns_worker(struct work_struct *work)
static void qrtr_ns_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk, __func__);
+
queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
}
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 7edf2e69d3fe..e1a165816737 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -34,6 +34,7 @@
#include <linux/gfp.h>
#include <linux/in.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -234,6 +235,7 @@ void rds_tcp_listen_data_ready(struct sock *sk)
{
void (*ready)(struct sock *sk);
+ trace_sk_data_ready(sk, __func__);
rdsdebug("listen data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index f4ee13da90c7..0c2efbfc3f32 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -33,6 +33,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -309,6 +310,7 @@ void rds_tcp_data_ready(struct sock *sk)
struct rds_conn_path *cp;
struct rds_tcp_connection *tc;
+ trace_sk_data_ready(sk, __func__);
rdsdebug("data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 171f1a35d205..a76ffbe08c6d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -59,6 +59,7 @@
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include <linux/socket.h> /* for sa_family_t */
#include <linux/export.h>
@@ -9237,6 +9238,8 @@ void sctp_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index 17c5aee7ee4f..da309723a8de 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -15,6 +15,7 @@
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include "smc.h"
#include "smc_core.h"
@@ -31,6 +32,8 @@ static void smc_rx_wake_up(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
/* derived from sock_def_readable() */
/* called already in smc_listen_work() */
rcu_read_lock();
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 2fc98fea59b4..eb767fd3545f 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -55,6 +55,7 @@
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/xprt.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -310,6 +311,8 @@ static void svc_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk, __func__);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
@@ -687,6 +690,8 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk, __func__);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e976007f4fd0..c2e06a4881d7 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -52,6 +52,7 @@
#include <linux/uio.h>
#include <linux/sched/mm.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -1378,6 +1379,8 @@ static void xs_data_ready(struct sock *sk)
{
struct rpc_xprt *xprt;
+ trace_sk_data_ready(sk, __func__);
+
xprt = xprt_from_sock(sk);
if (xprt != NULL) {
struct sock_xprt *transport = container_of(xprt,
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f1c3b8eb4b3d..14965b05a691 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -37,6 +37,7 @@
#include <linux/rhashtable.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include "core.h"
#include "name_table.h"
@@ -2130,6 +2131,8 @@ static void tipc_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk, __func__);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 5522865deae9..231bb704b455 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -43,6 +43,7 @@
#include "bearer.h"
#include <net/sock.h>
#include <linux/module.h>
+#include <trace/events/sock.h>
/* Number of messages to send before rescheduling */
#define MAX_SEND_MSG_COUNT 25
@@ -437,6 +438,8 @@ static void tipc_conn_data_ready(struct sock *sk)
{
struct tipc_conn *con;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
con = sk->sk_user_data;
if (connected(con)) {
@@ -487,6 +490,8 @@ static void tipc_topsrv_listener_data_ready(struct sock *sk)
{
struct tipc_topsrv *srv;
+ trace_sk_data_ready(sk, __func__);
+
read_lock_bh(&sk->sk_callback_lock);
srv = sk->sk_user_data;
if (srv->listener)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 264cf367e265..412733bdb8db 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -43,6 +43,7 @@
#include <net/strparser.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
#include "tls.h"
@@ -2282,6 +2283,8 @@ static void tls_data_ready(struct sock *sk)
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
struct sk_psock *psock;
+ trace_sk_data_ready(sk, __func__);
+
tls_strp_data_ready(&ctx->strp);
psock = sk_psock_get(sk);
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 29a540dcb5a7..9f68fb7dab6c 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -6,6 +6,7 @@
#include <net/espintcp.h>
#include <linux/skmsg.h>
#include <net/inet_common.h>
+#include <trace/events/sock.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6_stubs.h>
#endif
@@ -397,6 +398,8 @@ static void espintcp_data_ready(struct sock *sk)
{
struct espintcp_ctx *ctx = espintcp_getctx(sk);
+ trace_sk_data_ready(sk, __func__);
+
strp_data_ready(&ctx->strp);
}
--
2.20.1
On Tue, Oct 11, 2022 at 12:58:56PM -0700, Peilin Ye wrote:
> From: Peilin Ye <[email protected]>
>
> As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> callback implementations. For example:
>
> <...>
> dpkg-deb-7752 [000] ..... 145.660735: sk_data_ready: family=16 protocol=16 func=sock_def_readable
> dpkg-deb-7757 [000] ..... 145.759168: sk_data_ready: family=16 protocol=16 func=sock_def_readable
> dpkg-deb-7758 [000] ..... 145.763956: sk_data_ready: family=16 protocol=16 func=sock_def_readable
> <...>
>
> Suggested-by: Cong Wang <[email protected]>
> Signed-off-by: Peilin Ye <[email protected]>
> ---
> change since v2:
> - Fix modpost error for modules (kernel test robot)
>
> changes since v1:
> - Move tracepoint into ->sk_data_ready() callback implementations
> (Eric Dumazet)
> - Fix W=1 warning (Jakub Kicinski)
>
> drivers/infiniband/hw/erdma/erdma_cm.c | 3 +++
> drivers/infiniband/sw/siw/siw_cm.c | 5 +++++
> drivers/infiniband/sw/siw/siw_qp.c | 3 +++
> drivers/nvme/host/tcp.c | 3 +++
> drivers/nvme/target/tcp.c | 5 +++++
> drivers/scsi/iscsi_tcp.c | 3 +++
> drivers/soc/qcom/qmi_interface.c | 3 +++
> drivers/target/iscsi/iscsi_target_nego.c | 2 ++
> drivers/xen/pvcalls-back.c | 5 +++++
> fs/dlm/lowcomms.c | 5 +++++
> fs/ocfs2/cluster/tcp.c | 5 +++++
> include/trace/events/sock.h | 24 ++++++++++++++++++++++++
> net/ceph/messenger.c | 4 ++++
> net/core/net-traces.c | 2 ++
> net/core/skmsg.c | 3 +++
> net/core/sock.c | 2 ++
> net/kcm/kcmsock.c | 3 +++
> net/mptcp/subflow.c | 3 +++
> net/qrtr/ns.c | 3 +++
> net/rds/tcp_listen.c | 2 ++
> net/rds/tcp_recv.c | 2 ++
> net/sctp/socket.c | 3 +++
> net/smc/smc_rx.c | 3 +++
> net/sunrpc/svcsock.c | 5 +++++
> net/sunrpc/xprtsock.c | 3 +++
> net/tipc/socket.c | 3 +++
> net/tipc/topsrv.c | 5 +++++
> net/tls/tls_sw.c | 3 +++
> net/xfrm/espintcp.c | 3 +++
> 29 files changed, 118 insertions(+)
>
> diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
> index f13f16479eca..63f314222813 100644
> --- a/drivers/infiniband/hw/erdma/erdma_cm.c
> +++ b/drivers/infiniband/hw/erdma/erdma_cm.c
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
> pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);
This can go.
<...>
> + trace_sk_data_ready(sock, __func__);
<...>
> + trace_sk_data_ready(sock, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
> + trace_sk_data_ready(sk, __func__);
<...>
__func__ repetitive pattern hints that it is not best API interface.
> +TRACE_EVENT(sk_data_ready,
> +
> + TP_PROTO(const struct sock *sk, const char *func),
> +
> + TP_ARGS(sk, func),
> +
> + TP_STRUCT__entry(
> + __field(const void *, skaddr)
> + __field(__u16, family)
> + __field(__u16, protocol)
> + __string(func, func)
TRACE_EVENT() is macro defined in .h file, you can safely put __func__
instead.
> + ),
> +
> + TP_fast_assign(
> + __entry->skaddr = sk;
> + __entry->family = sk->sk_family;
> + __entry->protocol = sk->sk_protocol;
> + __assign_str(func, func)
> + ),
> +
> + TP_printk("family=%u protocol=%u func=%s",
> + __entry->family, __entry->protocol, __get_str(func))
> +);
> +
> #endif /* _TRACE_SOCK_H */
On Wed, Oct 12, 2022 at 08:58:32AM +0300, Leon Romanovsky wrote:
> > + trace_sk_data_ready(sk, __func__);
> > pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);
>
> This can go.
<...>
> __func__ repetitive pattern hints that it is not best API interface.
>
>
> > +TRACE_EVENT(sk_data_ready,
> > +
> > + TP_PROTO(const struct sock *sk, const char *func),
> > +
> > + TP_ARGS(sk, func),
> > +
> > + TP_STRUCT__entry(
> > + __field(const void *, skaddr)
> > + __field(__u16, family)
> > + __field(__u16, protocol)
> > + __string(func, func)
>
> TRACE_EVENT() is macro defined in .h file, you can safely put __func__
> instead.
Thanks for the suggestions! I will update in v4.
Peilin Ye
From: Peilin Ye <[email protected]>
As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
callback implementations. For example:
<...>
ksoftirqd/0-16 [000] ..s.. 99.784482: sk_data_ready: family=10 protocol=58 func=sock_def_readable
ksoftirqd/0-16 [000] ..s.. 99.784819: sk_data_ready: family=10 protocol=58 func=sock_def_readable
<...>
Suggested-by: Cong Wang <[email protected]>
Signed-off-by: Peilin Ye <[email protected]>
---
changes since v3:
- Avoid using __func__ everywhere (Leon Romanovsky)
- No need to trace iscsi_target_sk_data_ready() (Leon Romanovsky)
change since v2:
- Fix modpost error for modules (kernel test robot)
changes since v1:
- Move tracepoint into ->sk_data_ready() callback implementations
(Eric Dumazet)
- Fix W=1 warning (Jakub Kicinski)
drivers/infiniband/hw/erdma/erdma_cm.c | 3 +++
drivers/infiniband/sw/siw/siw_cm.c | 5 +++++
drivers/infiniband/sw/siw/siw_qp.c | 3 +++
drivers/nvme/host/tcp.c | 3 +++
drivers/nvme/target/tcp.c | 5 +++++
drivers/scsi/iscsi_tcp.c | 3 +++
drivers/soc/qcom/qmi_interface.c | 3 +++
drivers/xen/pvcalls-back.c | 5 +++++
fs/dlm/lowcomms.c | 5 +++++
fs/ocfs2/cluster/tcp.c | 5 +++++
include/trace/events/sock.h | 24 ++++++++++++++++++++++++
net/ceph/messenger.c | 4 ++++
net/core/net-traces.c | 2 ++
net/core/skmsg.c | 3 +++
net/core/sock.c | 2 ++
net/kcm/kcmsock.c | 3 +++
net/mptcp/subflow.c | 3 +++
net/qrtr/ns.c | 3 +++
net/rds/tcp_listen.c | 2 ++
net/rds/tcp_recv.c | 2 ++
net/sctp/socket.c | 3 +++
net/smc/smc_rx.c | 3 +++
net/sunrpc/svcsock.c | 5 +++++
net/sunrpc/xprtsock.c | 3 +++
net/tipc/socket.c | 3 +++
net/tipc/topsrv.c | 5 +++++
net/tls/tls_sw.c | 3 +++
net/xfrm/espintcp.c | 3 +++
28 files changed, 116 insertions(+)
diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index f13f16479eca..084da6698080 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -16,6 +16,7 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#include <net/addrconf.h>
+#include <trace/events/sock.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_verbs.h>
@@ -933,6 +934,8 @@ static void erdma_cm_llp_data_ready(struct sock *sk)
{
struct erdma_cep *cep;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index f88d2971c2c6..da530c0404da 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -16,6 +16,7 @@
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/tcp.h>
+#include <trace/events/sock.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
@@ -109,6 +110,8 @@ static void siw_rtr_data_ready(struct sock *sk)
struct siw_qp *qp = NULL;
read_descriptor_t rd_desc;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
@@ -1216,6 +1219,8 @@ static void siw_cm_llp_data_ready(struct sock *sk)
{
struct siw_cep *cep;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c
index 7e01f2438afc..6dddb5a64568 100644
--- a/drivers/infiniband/sw/siw/siw_qp.c
+++ b/drivers/infiniband/sw/siw/siw_qp.c
@@ -10,6 +10,7 @@
#include <linux/llist.h>
#include <asm/barrier.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "siw.h"
#include "siw_verbs.h"
@@ -94,6 +95,8 @@ void siw_qp_llp_data_ready(struct sock *sk)
{
struct siw_qp *qp;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
if (unlikely(!sk->sk_user_data || !sk_to_qp(sk)))
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d5871fd6f769..9a21e6054ef8 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -14,6 +14,7 @@
#include <linux/blk-mq.h>
#include <crypto/hash.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include "nvme.h"
#include "fabrics.h"
@@ -906,6 +907,8 @@ static void nvme_tcp_data_ready(struct sock *sk)
{
struct nvme_tcp_queue *queue;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue && queue->rd_enabled) &&
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index a3694a32f6d5..01a4473a8d92 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -14,6 +14,7 @@
#include <linux/inet.h>
#include <linux/llist.h>
#include <crypto/hash.h>
+#include <trace/events/sock.h>
#include "nvmet.h"
@@ -1467,6 +1468,8 @@ static void nvmet_tcp_data_ready(struct sock *sk)
{
struct nvmet_tcp_queue *queue;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue))
@@ -1664,6 +1667,8 @@ static void nvmet_tcp_listen_data_ready(struct sock *sk)
{
struct nvmet_tcp_port *port;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
port = sk->sk_user_data;
if (!port)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 29b1bd755afe..f65ef51124be 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -36,6 +36,7 @@
#include <scsi/scsi.h>
#include <scsi/scsi_transport_iscsi.h>
#include <trace/events/iscsi.h>
+#include <trace/events/sock.h>
#include "iscsi_tcp.h"
@@ -170,6 +171,8 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk)
struct iscsi_tcp_conn *tcp_conn;
struct iscsi_conn *conn;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
index c8c4c730b135..b075f0dad76a 100644
--- a/drivers/soc/qcom/qmi_interface.c
+++ b/drivers/soc/qcom/qmi_interface.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <net/sock.h>
#include <linux/workqueue.h>
+#include <trace/events/sock.h>
#include <linux/soc/qcom/qmi.h>
static struct socket *qmi_sock_create(struct qmi_handle *qmi,
@@ -569,6 +570,8 @@ static void qmi_data_ready(struct sock *sk)
{
struct qmi_handle *qmi = sk->sk_user_data;
+ trace_sk_data_ready(sk);
+
/*
* This will be NULL if we receive data while being in
* qmi_handle_release()
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index d6f945fd4147..4a78fb1b88aa 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -14,6 +14,7 @@
#include <net/inet_common.h>
#include <net/inet_connection_sock.h>
#include <net/request_sock.h>
+#include <trace/events/sock.h>
#include <xen/events.h>
#include <xen/grant_table.h>
@@ -300,6 +301,8 @@ static void pvcalls_sk_data_ready(struct sock *sock)
struct sock_mapping *map = sock->sk_user_data;
struct pvcalls_ioworker *iow;
+ trace_sk_data_ready(sock);
+
if (map == NULL)
return;
@@ -588,6 +591,8 @@ static void pvcalls_pass_sk_data_ready(struct sock *sock)
unsigned long flags;
int notify;
+ trace_sk_data_ready(sock);
+
if (mappass == NULL)
return;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 59f64c596233..08596b8e2204 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -54,6 +54,7 @@
#include <net/ipv6.h>
#include <trace/events/dlm.h>
+#include <trace/events/sock.h>
#include "dlm_internal.h"
#include "lowcomms.h"
@@ -507,6 +508,8 @@ static void lowcomms_data_ready(struct sock *sk)
{
struct connection *con;
+ trace_sk_data_ready(sk);
+
con = sock2con(sk);
if (con && !test_and_set_bit(CF_READ_PENDING, &con->flags))
queue_work(recv_workqueue, &con->rwork);
@@ -514,6 +517,8 @@ static void lowcomms_data_ready(struct sock *sk)
static void lowcomms_listen_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk);
+
if (!dlm_allow_conn)
return;
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index f660c0dbdb63..ba733be2a5e1 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -46,6 +46,7 @@
#include <linux/net.h>
#include <linux/export.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/uaccess.h>
@@ -585,6 +586,8 @@ static void o2net_data_ready(struct sock *sk)
void (*ready)(struct sock *sk);
struct o2net_sock_container *sc;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
sc = sk->sk_user_data;
if (sc) {
@@ -645,6 +648,8 @@ static void o2net_state_change(struct sock *sk)
static void o2net_register_callbacks(struct sock *sk,
struct o2net_sock_container *sc)
{
+ trace_sk_data_ready(sk);
+
write_lock_bh(&sk->sk_callback_lock);
/* accepted sockets inherit the old listen socket data ready */
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 777ee6cbe933..d8685fdbeb0b 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -263,6 +263,30 @@ TRACE_EVENT(inet_sk_error_report,
__entry->error)
);
+TRACE_EVENT(sk_data_ready,
+
+ TP_PROTO(const struct sock *sk),
+
+ TP_ARGS(sk),
+
+ TP_STRUCT__entry(
+ __field(const void *, skaddr)
+ __field(__u16, family)
+ __field(__u16, protocol)
+ __field(unsigned long, ip)
+ ),
+
+ TP_fast_assign(
+ __entry->skaddr = sk;
+ __entry->family = sk->sk_family;
+ __entry->protocol = sk->sk_protocol;
+ __entry->ip = _RET_IP_;
+ ),
+
+ TP_printk("family=%u protocol=%u func=%ps",
+ __entry->family, __entry->protocol, (void *)__entry->ip)
+);
+
#endif /* _TRACE_SOCK_H */
/* This part must be outside protection */
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index d3bb656308b4..f925b0944486 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -17,6 +17,7 @@
#endif /* CONFIG_BLOCK */
#include <linux/dns_resolver.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/ceph/ceph_features.h>
#include <linux/ceph/libceph.h>
@@ -344,6 +345,9 @@ static void con_sock_state_closed(struct ceph_connection *con)
static void ceph_sock_data_ready(struct sock *sk)
{
struct ceph_connection *con = sk->sk_user_data;
+
+ trace_sk_data_ready(sk);
+
if (atomic_read(&con->msgr->stopping)) {
return;
}
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index c40cd8dd75c7..ee7006bbe49b 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -61,3 +61,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll);
EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset);
EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum);
+
+EXPORT_TRACEPOINT_SYMBOL_GPL(sk_data_ready);
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index ca70525621c7..5cdf0a4228d2 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -8,6 +8,7 @@
#include <net/sock.h>
#include <net/tcp.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
static bool sk_msg_try_coalesce_ok(struct sk_msg *msg, int elem_first_coalesce)
{
@@ -1210,6 +1211,8 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
{
struct socket *sock = sk->sk_socket;
+ trace_sk_data_ready(sk);
+
if (unlikely(!sock || !sock->ops || !sock->ops->read_skb))
return;
sock->ops->read_skb(sk, sk_psock_verdict_recv);
diff --git a/net/core/sock.c b/net/core/sock.c
index eeb6cbac6f49..9a96ba6a4742 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3269,6 +3269,8 @@ void sock_def_readable(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 1215c863e1c4..a5ad180b38c5 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -28,6 +28,7 @@
#include <net/netns/generic.h>
#include <net/sock.h>
#include <uapi/linux/kcm.h>
+#include <trace/events/sock.h>
unsigned int kcm_net_id;
@@ -344,6 +345,8 @@ static void psock_data_ready(struct sock *sk)
{
struct kcm_psock *psock;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
psock = (struct kcm_psock *)sk->sk_user_data;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 07dd23d0fe04..60c8868e96b4 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -26,6 +26,7 @@
#include "mib.h"
#include <trace/events/mptcp.h>
+#include <trace/events/sock.h>
static void mptcp_subflow_ops_undo_override(struct sock *ssk);
@@ -1349,6 +1350,8 @@ static void subflow_data_ready(struct sock *sk)
struct sock *parent = subflow->conn;
struct mptcp_sock *msk;
+ trace_sk_data_ready(sk);
+
msk = mptcp_sk(parent);
if (state & TCPF_LISTEN) {
/* MPJ subflow are removed from accept queue before reaching here,
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 1990d496fcfc..97bfdf9fd028 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -12,6 +12,7 @@
#include "qrtr.h"
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/qrtr.h>
@@ -752,6 +753,8 @@ static void qrtr_ns_worker(struct work_struct *work)
static void qrtr_ns_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk);
+
queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
}
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 7edf2e69d3fe..014fa24418c1 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -34,6 +34,7 @@
#include <linux/gfp.h>
#include <linux/in.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -234,6 +235,7 @@ void rds_tcp_listen_data_ready(struct sock *sk)
{
void (*ready)(struct sock *sk);
+ trace_sk_data_ready(sk);
rdsdebug("listen data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index f4ee13da90c7..c00f04a1a534 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -33,6 +33,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -309,6 +310,7 @@ void rds_tcp_data_ready(struct sock *sk)
struct rds_conn_path *cp;
struct rds_tcp_connection *tc;
+ trace_sk_data_ready(sk);
rdsdebug("data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 171f1a35d205..6de05c14220a 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -59,6 +59,7 @@
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include <linux/socket.h> /* for sa_family_t */
#include <linux/export.h>
@@ -9237,6 +9238,8 @@ void sctp_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index 17c5aee7ee4f..0a6e615f000c 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -15,6 +15,7 @@
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include "smc.h"
#include "smc_core.h"
@@ -31,6 +32,8 @@ static void smc_rx_wake_up(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
/* derived from sock_def_readable() */
/* called already in smc_listen_work() */
rcu_read_lock();
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 2fc98fea59b4..54ddae31249a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -55,6 +55,7 @@
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/xprt.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -310,6 +311,8 @@ static void svc_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
@@ -687,6 +690,8 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e976007f4fd0..47dcc5c2c767 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -52,6 +52,7 @@
#include <linux/uio.h>
#include <linux/sched/mm.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -1378,6 +1379,8 @@ static void xs_data_ready(struct sock *sk)
{
struct rpc_xprt *xprt;
+ trace_sk_data_ready(sk);
+
xprt = xprt_from_sock(sk);
if (xprt != NULL) {
struct sock_xprt *transport = container_of(xprt,
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f1c3b8eb4b3d..d87e711e69ec 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -37,6 +37,7 @@
#include <linux/rhashtable.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include "core.h"
#include "name_table.h"
@@ -2130,6 +2131,8 @@ static void tipc_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 5522865deae9..d8868ebb46f6 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -43,6 +43,7 @@
#include "bearer.h"
#include <net/sock.h>
#include <linux/module.h>
+#include <trace/events/sock.h>
/* Number of messages to send before rescheduling */
#define MAX_SEND_MSG_COUNT 25
@@ -437,6 +438,8 @@ static void tipc_conn_data_ready(struct sock *sk)
{
struct tipc_conn *con;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
con = sk->sk_user_data;
if (connected(con)) {
@@ -487,6 +490,8 @@ static void tipc_topsrv_listener_data_ready(struct sock *sk)
{
struct tipc_topsrv *srv;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
srv = sk->sk_user_data;
if (srv->listener)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 264cf367e265..8138730533f9 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -43,6 +43,7 @@
#include <net/strparser.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
#include "tls.h"
@@ -2282,6 +2283,8 @@ static void tls_data_ready(struct sock *sk)
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
struct sk_psock *psock;
+ trace_sk_data_ready(sk);
+
tls_strp_data_ready(&ctx->strp);
psock = sk_psock_get(sk);
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 29a540dcb5a7..e428312d3c54 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -6,6 +6,7 @@
#include <net/espintcp.h>
#include <linux/skmsg.h>
#include <net/inet_common.h>
+#include <trace/events/sock.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6_stubs.h>
#endif
@@ -397,6 +398,8 @@ static void espintcp_data_ready(struct sock *sk)
{
struct espintcp_ctx *ctx = espintcp_getctx(sk);
+ trace_sk_data_ready(sk);
+
strp_data_ready(&ctx->strp);
}
--
2.20.1
On Wed, Oct 12, 2022 at 04:21:21PM -0700, Peilin Ye wrote:
> From: Peilin Ye <[email protected]>
>
> As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> callback implementations. For example:
>
> <...>
> ksoftirqd/0-16 [000] ..s.. 99.784482: sk_data_ready: family=10 protocol=58 func=sock_def_readable
> ksoftirqd/0-16 [000] ..s.. 99.784819: sk_data_ready: family=10 protocol=58 func=sock_def_readable
> <...>
>
> Suggested-by: Cong Wang <[email protected]>
> Signed-off-by: Peilin Ye <[email protected]>
> ---
> changes since v3:
> - Avoid using __func__ everywhere (Leon Romanovsky)
> - No need to trace iscsi_target_sk_data_ready() (Leon Romanovsky)
I meant no need both trace point and debug print and suggested to remove
debug print.
Thanks
From: Peilin Ye <[email protected]>
As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
callback implementations. For example:
<...>
ksoftirqd/0-16 [000] ..s.. 99.784482: sk_data_ready: family=10 protocol=58 func=sock_def_readable
ksoftirqd/0-16 [000] ..s.. 99.784819: sk_data_ready: family=10 protocol=58 func=sock_def_readable
<...>
Suggested-by: Cong Wang <[email protected]>
Signed-off-by: Peilin Ye <[email protected]>
---
change since v4:
- Add back tracepoint in iscsi_target_sk_data_ready()
changes since v3:
- Avoid using __func__ everywhere (Leon Romanovsky)
- Delete tracepoint in iscsi_target_sk_data_ready()
change since v2:
- Fix modpost error for modules (kernel test robot)
changes since v1:
- Move tracepoint into ->sk_data_ready() callback implementations
(Eric Dumazet)
- Fix W=1 warning (Jakub Kicinski)
drivers/infiniband/hw/erdma/erdma_cm.c | 3 +++
drivers/infiniband/sw/siw/siw_cm.c | 5 +++++
drivers/infiniband/sw/siw/siw_qp.c | 3 +++
drivers/nvme/host/tcp.c | 3 +++
drivers/nvme/target/tcp.c | 5 +++++
drivers/scsi/iscsi_tcp.c | 3 +++
drivers/soc/qcom/qmi_interface.c | 3 +++
drivers/target/iscsi/iscsi_target_nego.c | 2 ++
drivers/xen/pvcalls-back.c | 5 +++++
fs/dlm/lowcomms.c | 5 +++++
fs/ocfs2/cluster/tcp.c | 5 +++++
include/trace/events/sock.h | 24 ++++++++++++++++++++++++
net/ceph/messenger.c | 4 ++++
net/core/net-traces.c | 2 ++
net/core/skmsg.c | 3 +++
net/core/sock.c | 2 ++
net/kcm/kcmsock.c | 3 +++
net/mptcp/subflow.c | 3 +++
net/qrtr/ns.c | 3 +++
net/rds/tcp_listen.c | 2 ++
net/rds/tcp_recv.c | 2 ++
net/sctp/socket.c | 3 +++
net/smc/smc_rx.c | 3 +++
net/sunrpc/svcsock.c | 5 +++++
net/sunrpc/xprtsock.c | 3 +++
net/tipc/socket.c | 3 +++
net/tipc/topsrv.c | 5 +++++
net/tls/tls_sw.c | 3 +++
net/xfrm/espintcp.c | 3 +++
29 files changed, 118 insertions(+)
diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index f13f16479eca..084da6698080 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -16,6 +16,7 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#include <net/addrconf.h>
+#include <trace/events/sock.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_verbs.h>
@@ -933,6 +934,8 @@ static void erdma_cm_llp_data_ready(struct sock *sk)
{
struct erdma_cep *cep;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index f88d2971c2c6..da530c0404da 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -16,6 +16,7 @@
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/tcp.h>
+#include <trace/events/sock.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
@@ -109,6 +110,8 @@ static void siw_rtr_data_ready(struct sock *sk)
struct siw_qp *qp = NULL;
read_descriptor_t rd_desc;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
@@ -1216,6 +1219,8 @@ static void siw_cm_llp_data_ready(struct sock *sk)
{
struct siw_cep *cep;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
cep = sk_to_cep(sk);
diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c
index 7e01f2438afc..6dddb5a64568 100644
--- a/drivers/infiniband/sw/siw/siw_qp.c
+++ b/drivers/infiniband/sw/siw/siw_qp.c
@@ -10,6 +10,7 @@
#include <linux/llist.h>
#include <asm/barrier.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "siw.h"
#include "siw_verbs.h"
@@ -94,6 +95,8 @@ void siw_qp_llp_data_ready(struct sock *sk)
{
struct siw_qp *qp;
+ trace_sk_data_ready(sk);
+
read_lock(&sk->sk_callback_lock);
if (unlikely(!sk->sk_user_data || !sk_to_qp(sk)))
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d5871fd6f769..9a21e6054ef8 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -14,6 +14,7 @@
#include <linux/blk-mq.h>
#include <crypto/hash.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include "nvme.h"
#include "fabrics.h"
@@ -906,6 +907,8 @@ static void nvme_tcp_data_ready(struct sock *sk)
{
struct nvme_tcp_queue *queue;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue && queue->rd_enabled) &&
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index a3694a32f6d5..01a4473a8d92 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -14,6 +14,7 @@
#include <linux/inet.h>
#include <linux/llist.h>
#include <crypto/hash.h>
+#include <trace/events/sock.h>
#include "nvmet.h"
@@ -1467,6 +1468,8 @@ static void nvmet_tcp_data_ready(struct sock *sk)
{
struct nvmet_tcp_queue *queue;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
queue = sk->sk_user_data;
if (likely(queue))
@@ -1664,6 +1667,8 @@ static void nvmet_tcp_listen_data_ready(struct sock *sk)
{
struct nvmet_tcp_port *port;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
port = sk->sk_user_data;
if (!port)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 29b1bd755afe..f65ef51124be 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -36,6 +36,7 @@
#include <scsi/scsi.h>
#include <scsi/scsi_transport_iscsi.h>
#include <trace/events/iscsi.h>
+#include <trace/events/sock.h>
#include "iscsi_tcp.h"
@@ -170,6 +171,8 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk)
struct iscsi_tcp_conn *tcp_conn;
struct iscsi_conn *conn;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
index c8c4c730b135..b075f0dad76a 100644
--- a/drivers/soc/qcom/qmi_interface.c
+++ b/drivers/soc/qcom/qmi_interface.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <net/sock.h>
#include <linux/workqueue.h>
+#include <trace/events/sock.h>
#include <linux/soc/qcom/qmi.h>
static struct socket *qmi_sock_create(struct qmi_handle *qmi,
@@ -569,6 +570,8 @@ static void qmi_data_ready(struct sock *sk)
{
struct qmi_handle *qmi = sk->sk_user_data;
+ trace_sk_data_ready(sk);
+
/*
* This will be NULL if we receive data while being in
* qmi_handle_release()
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index f2919319ad38..2962b0e02707 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include <scsi/iscsi_proto.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
@@ -384,6 +385,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
struct iscsit_conn *conn = sk->sk_user_data;
bool rc;
+ trace_sk_data_ready(sk);
pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);
write_lock_bh(&sk->sk_callback_lock);
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index d6f945fd4147..4a78fb1b88aa 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -14,6 +14,7 @@
#include <net/inet_common.h>
#include <net/inet_connection_sock.h>
#include <net/request_sock.h>
+#include <trace/events/sock.h>
#include <xen/events.h>
#include <xen/grant_table.h>
@@ -300,6 +301,8 @@ static void pvcalls_sk_data_ready(struct sock *sock)
struct sock_mapping *map = sock->sk_user_data;
struct pvcalls_ioworker *iow;
+ trace_sk_data_ready(sock);
+
if (map == NULL)
return;
@@ -588,6 +591,8 @@ static void pvcalls_pass_sk_data_ready(struct sock *sock)
unsigned long flags;
int notify;
+ trace_sk_data_ready(sock);
+
if (mappass == NULL)
return;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 59f64c596233..08596b8e2204 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -54,6 +54,7 @@
#include <net/ipv6.h>
#include <trace/events/dlm.h>
+#include <trace/events/sock.h>
#include "dlm_internal.h"
#include "lowcomms.h"
@@ -507,6 +508,8 @@ static void lowcomms_data_ready(struct sock *sk)
{
struct connection *con;
+ trace_sk_data_ready(sk);
+
con = sock2con(sk);
if (con && !test_and_set_bit(CF_READ_PENDING, &con->flags))
queue_work(recv_workqueue, &con->rwork);
@@ -514,6 +517,8 @@ static void lowcomms_data_ready(struct sock *sk)
static void lowcomms_listen_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk);
+
if (!dlm_allow_conn)
return;
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index f660c0dbdb63..ba733be2a5e1 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -46,6 +46,7 @@
#include <linux/net.h>
#include <linux/export.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/uaccess.h>
@@ -585,6 +586,8 @@ static void o2net_data_ready(struct sock *sk)
void (*ready)(struct sock *sk);
struct o2net_sock_container *sc;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
sc = sk->sk_user_data;
if (sc) {
@@ -645,6 +648,8 @@ static void o2net_state_change(struct sock *sk)
static void o2net_register_callbacks(struct sock *sk,
struct o2net_sock_container *sc)
{
+ trace_sk_data_ready(sk);
+
write_lock_bh(&sk->sk_callback_lock);
/* accepted sockets inherit the old listen socket data ready */
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 777ee6cbe933..d8685fdbeb0b 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -263,6 +263,30 @@ TRACE_EVENT(inet_sk_error_report,
__entry->error)
);
+TRACE_EVENT(sk_data_ready,
+
+ TP_PROTO(const struct sock *sk),
+
+ TP_ARGS(sk),
+
+ TP_STRUCT__entry(
+ __field(const void *, skaddr)
+ __field(__u16, family)
+ __field(__u16, protocol)
+ __field(unsigned long, ip)
+ ),
+
+ TP_fast_assign(
+ __entry->skaddr = sk;
+ __entry->family = sk->sk_family;
+ __entry->protocol = sk->sk_protocol;
+ __entry->ip = _RET_IP_;
+ ),
+
+ TP_printk("family=%u protocol=%u func=%ps",
+ __entry->family, __entry->protocol, (void *)__entry->ip)
+);
+
#endif /* _TRACE_SOCK_H */
/* This part must be outside protection */
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index d3bb656308b4..f925b0944486 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -17,6 +17,7 @@
#endif /* CONFIG_BLOCK */
#include <linux/dns_resolver.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include <linux/ceph/ceph_features.h>
#include <linux/ceph/libceph.h>
@@ -344,6 +345,9 @@ static void con_sock_state_closed(struct ceph_connection *con)
static void ceph_sock_data_ready(struct sock *sk)
{
struct ceph_connection *con = sk->sk_user_data;
+
+ trace_sk_data_ready(sk);
+
if (atomic_read(&con->msgr->stopping)) {
return;
}
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index c40cd8dd75c7..ee7006bbe49b 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -61,3 +61,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll);
EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset);
EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum);
+
+EXPORT_TRACEPOINT_SYMBOL_GPL(sk_data_ready);
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index ca70525621c7..5cdf0a4228d2 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -8,6 +8,7 @@
#include <net/sock.h>
#include <net/tcp.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
static bool sk_msg_try_coalesce_ok(struct sk_msg *msg, int elem_first_coalesce)
{
@@ -1210,6 +1211,8 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
{
struct socket *sock = sk->sk_socket;
+ trace_sk_data_ready(sk);
+
if (unlikely(!sock || !sock->ops || !sock->ops->read_skb))
return;
sock->ops->read_skb(sk, sk_psock_verdict_recv);
diff --git a/net/core/sock.c b/net/core/sock.c
index eeb6cbac6f49..9a96ba6a4742 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3269,6 +3269,8 @@ void sock_def_readable(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 1215c863e1c4..a5ad180b38c5 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -28,6 +28,7 @@
#include <net/netns/generic.h>
#include <net/sock.h>
#include <uapi/linux/kcm.h>
+#include <trace/events/sock.h>
unsigned int kcm_net_id;
@@ -344,6 +345,8 @@ static void psock_data_ready(struct sock *sk)
{
struct kcm_psock *psock;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
psock = (struct kcm_psock *)sk->sk_user_data;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 07dd23d0fe04..60c8868e96b4 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -26,6 +26,7 @@
#include "mib.h"
#include <trace/events/mptcp.h>
+#include <trace/events/sock.h>
static void mptcp_subflow_ops_undo_override(struct sock *ssk);
@@ -1349,6 +1350,8 @@ static void subflow_data_ready(struct sock *sk)
struct sock *parent = subflow->conn;
struct mptcp_sock *msk;
+ trace_sk_data_ready(sk);
+
msk = mptcp_sk(parent);
if (state & TCPF_LISTEN) {
/* MPJ subflow are removed from accept queue before reaching here,
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 1990d496fcfc..97bfdf9fd028 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -12,6 +12,7 @@
#include "qrtr.h"
+#include <trace/events/sock.h>
#define CREATE_TRACE_POINTS
#include <trace/events/qrtr.h>
@@ -752,6 +753,8 @@ static void qrtr_ns_worker(struct work_struct *work)
static void qrtr_ns_data_ready(struct sock *sk)
{
+ trace_sk_data_ready(sk);
+
queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
}
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 7edf2e69d3fe..014fa24418c1 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -34,6 +34,7 @@
#include <linux/gfp.h>
#include <linux/in.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -234,6 +235,7 @@ void rds_tcp_listen_data_ready(struct sock *sk)
{
void (*ready)(struct sock *sk);
+ trace_sk_data_ready(sk);
rdsdebug("listen data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index f4ee13da90c7..c00f04a1a534 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -33,6 +33,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <net/tcp.h>
+#include <trace/events/sock.h>
#include "rds.h"
#include "tcp.h"
@@ -309,6 +310,7 @@ void rds_tcp_data_ready(struct sock *sk)
struct rds_conn_path *cp;
struct rds_tcp_connection *tc;
+ trace_sk_data_ready(sk);
rdsdebug("data ready sk %p\n", sk);
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 171f1a35d205..6de05c14220a 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -59,6 +59,7 @@
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/busy_poll.h>
+#include <trace/events/sock.h>
#include <linux/socket.h> /* for sa_family_t */
#include <linux/export.h>
@@ -9237,6 +9238,8 @@ void sctp_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index 17c5aee7ee4f..0a6e615f000c 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -15,6 +15,7 @@
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <trace/events/sock.h>
#include "smc.h"
#include "smc_core.h"
@@ -31,6 +32,8 @@ static void smc_rx_wake_up(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
/* derived from sock_def_readable() */
/* called already in smc_listen_work() */
rcu_read_lock();
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 2fc98fea59b4..54ddae31249a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -55,6 +55,7 @@
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/xprt.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -310,6 +311,8 @@ static void svc_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
@@ -687,6 +690,8 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
{
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
+ trace_sk_data_ready(sk);
+
if (svsk) {
/* Refer to svc_setup_socket() for details. */
rmb();
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e976007f4fd0..47dcc5c2c767 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -52,6 +52,7 @@
#include <linux/uio.h>
#include <linux/sched/mm.h>
+#include <trace/events/sock.h>
#include <trace/events/sunrpc.h>
#include "socklib.h"
@@ -1378,6 +1379,8 @@ static void xs_data_ready(struct sock *sk)
{
struct rpc_xprt *xprt;
+ trace_sk_data_ready(sk);
+
xprt = xprt_from_sock(sk);
if (xprt != NULL) {
struct sock_xprt *transport = container_of(xprt,
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f1c3b8eb4b3d..d87e711e69ec 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -37,6 +37,7 @@
#include <linux/rhashtable.h>
#include <linux/sched/signal.h>
+#include <trace/events/sock.h>
#include "core.h"
#include "name_table.h"
@@ -2130,6 +2131,8 @@ static void tipc_data_ready(struct sock *sk)
{
struct socket_wq *wq;
+ trace_sk_data_ready(sk);
+
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 5522865deae9..d8868ebb46f6 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -43,6 +43,7 @@
#include "bearer.h"
#include <net/sock.h>
#include <linux/module.h>
+#include <trace/events/sock.h>
/* Number of messages to send before rescheduling */
#define MAX_SEND_MSG_COUNT 25
@@ -437,6 +438,8 @@ static void tipc_conn_data_ready(struct sock *sk)
{
struct tipc_conn *con;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
con = sk->sk_user_data;
if (connected(con)) {
@@ -487,6 +490,8 @@ static void tipc_topsrv_listener_data_ready(struct sock *sk)
{
struct tipc_topsrv *srv;
+ trace_sk_data_ready(sk);
+
read_lock_bh(&sk->sk_callback_lock);
srv = sk->sk_user_data;
if (srv->listener)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 264cf367e265..8138730533f9 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -43,6 +43,7 @@
#include <net/strparser.h>
#include <net/tls.h>
+#include <trace/events/sock.h>
#include "tls.h"
@@ -2282,6 +2283,8 @@ static void tls_data_ready(struct sock *sk)
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
struct sk_psock *psock;
+ trace_sk_data_ready(sk);
+
tls_strp_data_ready(&ctx->strp);
psock = sk_psock_get(sk);
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 29a540dcb5a7..e428312d3c54 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -6,6 +6,7 @@
#include <net/espintcp.h>
#include <linux/skmsg.h>
#include <net/inet_common.h>
+#include <trace/events/sock.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6_stubs.h>
#endif
@@ -397,6 +398,8 @@ static void espintcp_data_ready(struct sock *sk)
{
struct espintcp_ctx *ctx = espintcp_getctx(sk);
+ trace_sk_data_ready(sk);
+
strp_data_ready(&ctx->strp);
}
--
2.20.1
On Thu, Oct 13, 2022 at 12:43:29PM +0300, Leon Romanovsky wrote:
> On Wed, Oct 12, 2022 at 04:21:21PM -0700, Peilin Ye wrote:
> > From: Peilin Ye <[email protected]>
> >
> > As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> > callback implementations. For example:
> >
> > <...>
> > ksoftirqd/0-16 [000] ..s.. 99.784482: sk_data_ready: family=10 protocol=58 func=sock_def_readable
> > ksoftirqd/0-16 [000] ..s.. 99.784819: sk_data_ready: family=10 protocol=58 func=sock_def_readable
> > <...>
> >
> > Suggested-by: Cong Wang <[email protected]>
> > Signed-off-by: Peilin Ye <[email protected]>
> > ---
> > changes since v3:
> > - Avoid using __func__ everywhere (Leon Romanovsky)
> > - No need to trace iscsi_target_sk_data_ready() (Leon Romanovsky)
>
> I meant no need both trace point and debug print and suggested to remove
> debug print.
Ah, I see. I will clean up redundant debug prints in
iscsi_target_sk_data_ready(), rds_tcp_listen_data_ready() and
rds_tcp_data_ready() in separate patches.
Thanks,
Peilin Ye
On Thu, Oct 13, 2022 at 05:00:58PM -0700, Peilin Ye wrote:
> From: Peilin Ye <[email protected]>
>
> As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> callback implementations. For example:
>
> <...>
> ksoftirqd/0-16 [000] ..s.. 99.784482: sk_data_ready: family=10 protocol=58 func=sock_def_readable
> ksoftirqd/0-16 [000] ..s.. 99.784819: sk_data_ready: family=10 protocol=58 func=sock_def_readable
> <...>
>
> Suggested-by: Cong Wang <[email protected]>
> Signed-off-by: Peilin Ye <[email protected]>
Please don't reply-to new patches and always send them as new threads
with links to previous versions in changelog.
> ---
> change since v4:
> - Add back tracepoint in iscsi_target_sk_data_ready()
>
> changes since v3:
> - Avoid using __func__ everywhere (Leon Romanovsky)
> - Delete tracepoint in iscsi_target_sk_data_ready()
>
> change since v2:
> - Fix modpost error for modules (kernel test robot)
>
> changes since v1:
> - Move tracepoint into ->sk_data_ready() callback implementations
> (Eric Dumazet)
> - Fix W=1 warning (Jakub Kicinski)
>
> drivers/infiniband/hw/erdma/erdma_cm.c | 3 +++
> drivers/infiniband/sw/siw/siw_cm.c | 5 +++++
> drivers/infiniband/sw/siw/siw_qp.c | 3 +++
> drivers/nvme/host/tcp.c | 3 +++
> drivers/nvme/target/tcp.c | 5 +++++
> drivers/scsi/iscsi_tcp.c | 3 +++
> drivers/soc/qcom/qmi_interface.c | 3 +++
> drivers/target/iscsi/iscsi_target_nego.c | 2 ++
> drivers/xen/pvcalls-back.c | 5 +++++
> fs/dlm/lowcomms.c | 5 +++++
> fs/ocfs2/cluster/tcp.c | 5 +++++
> include/trace/events/sock.h | 24 ++++++++++++++++++++++++
> net/ceph/messenger.c | 4 ++++
> net/core/net-traces.c | 2 ++
> net/core/skmsg.c | 3 +++
> net/core/sock.c | 2 ++
> net/kcm/kcmsock.c | 3 +++
> net/mptcp/subflow.c | 3 +++
> net/qrtr/ns.c | 3 +++
> net/rds/tcp_listen.c | 2 ++
> net/rds/tcp_recv.c | 2 ++
> net/sctp/socket.c | 3 +++
> net/smc/smc_rx.c | 3 +++
> net/sunrpc/svcsock.c | 5 +++++
> net/sunrpc/xprtsock.c | 3 +++
> net/tipc/socket.c | 3 +++
> net/tipc/topsrv.c | 5 +++++
> net/tls/tls_sw.c | 3 +++
> net/xfrm/espintcp.c | 3 +++
> 29 files changed, 118 insertions(+)
>
> diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
> index f13f16479eca..084da6698080 100644
> --- a/drivers/infiniband/hw/erdma/erdma_cm.c
> +++ b/drivers/infiniband/hw/erdma/erdma_cm.c
> @@ -16,6 +16,7 @@
> #include <linux/types.h>
> #include <linux/workqueue.h>
> #include <net/addrconf.h>
> +#include <trace/events/sock.h>
>
> #include <rdma/ib_user_verbs.h>
> #include <rdma/ib_verbs.h>
> @@ -933,6 +934,8 @@ static void erdma_cm_llp_data_ready(struct sock *sk)
> {
> struct erdma_cep *cep;
>
> + trace_sk_data_ready(sk);
> +
> read_lock(&sk->sk_callback_lock);
I see this pattern in all places and don't know if it is correct or not,
but you are calling to trace_sk_data_ready() at the beginning of
function and do it without taking sk_callback_lock.
Thanks
On Sat, Oct 15, 2022 at 1:07 PM Cong Wang <[email protected]> wrote:
>
> On Thu, Sep 29, 2022 at 09:19:34AM -0700, Eric Dumazet wrote:
> > Second patch adding the tracing point once in the helper ?
> >
> > Alternatively, why not add the tracepoint directly in the called
> > functions (we have few of them),
> > instead of all call points ?
>
> Why do we want to give implementations of sk_data_ready() freedom
> to not to call this trace_sk_data_ready()?
>
> Thanks.
I proposed an alternative. Choose one, but not the one you do not like :/
The first proposition was to split the patch in a more logical way.
I think we have less sk_data_ready() functions than call sites, so
code size would be smaller,
but this is probably something we care about enough.
On Thu, Sep 29, 2022 at 09:19:34AM -0700, Eric Dumazet wrote:
> Second patch adding the tracing point once in the helper ?
>
> Alternatively, why not add the tracepoint directly in the called
> functions (we have few of them),
> instead of all call points ?
Why do we want to give implementations of sk_data_ready() freedom
to not to call this trace_sk_data_ready()?
Thanks.
On Fri, Oct 14, 2022 at 09:35:22AM +0300, Leon Romanovsky wrote:
> Please don't reply-to new patches and always send them as new threads
> with links to previous versions in changelog.
Sure, I can do that. However, for example:
- I got a build error.
- I found on LKML some v1 patch developed by someone else that
introduced a similar error, by searching the error message.
- I wanted to know how v2 fixed that error in v1, but since v2 didn't
in-reply-to v1, it took me some extra seconds to find v2.
Therefore, I think sometimes it's useful to keep all versions in one
thread, especially when the set only contains one patch?
> > diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
> > index f13f16479eca..084da6698080 100644
> > --- a/drivers/infiniband/hw/erdma/erdma_cm.c
> > +++ b/drivers/infiniband/hw/erdma/erdma_cm.c
> > @@ -16,6 +16,7 @@
> > #include <linux/types.h>
> > #include <linux/workqueue.h>
> > #include <net/addrconf.h>
> > +#include <trace/events/sock.h>
> >
> > #include <rdma/ib_user_verbs.h>
> > #include <rdma/ib_verbs.h>
> > @@ -933,6 +934,8 @@ static void erdma_cm_llp_data_ready(struct sock *sk)
> > {
> > struct erdma_cep *cep;
> >
> > + trace_sk_data_ready(sk);
> > +
> > read_lock(&sk->sk_callback_lock);
>
> I see this pattern in all places and don't know if it is correct or not,
> but you are calling to trace_sk_data_ready() at the beginning of
> function and do it without taking sk_callback_lock.
Thanks for bringing this up, but I'm not sure it's an issue. We already
do similar thing, for example, in net/core/neighbour.c:
static int __neigh_update(struct neighbour *neigh, const u8 *lladdr,
u8 new, u32 flags, u32 nlmsg_pid,
struct netlink_ext_ack *extack)
{
bool gc_update = false, managed_update = false;
int update_isrouter = 0;
struct net_device *dev;
int err, notify = 0;
u8 old;
trace_neigh_update(neigh, lladdr, new, flags, nlmsg_pid);
write_lock_bh(&neigh->lock);
Thanks,
Peilin Ye