From: Jeff Layton <jlayton@primarydata.com>
To: bfields@fieldses.org
Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
Tejun Heo <tj@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
NeilBrown <neilb@suse.de>
Subject: [PATCH v2 16/16] sunrpc: add tracepoints around svc_sock handling
Date: Wed, 10 Dec 2014 14:08:00 -0500 [thread overview]
Message-ID: <1418238480-18857-17-git-send-email-jlayton@primarydata.com> (raw)
In-Reply-To: <1418238480-18857-1-git-send-email-jlayton@primarydata.com>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
include/trace/events/sunrpc.h | 46 +++++++++++++++++++++++++++++++++++++++++++
net/sunrpc/svcsock.c | 6 ++++++
2 files changed, 52 insertions(+)
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 0d54473d9b37..8bcc38c3f974 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -9,6 +9,7 @@
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/xprtsock.h>
#include <linux/sunrpc/svc_xprt.h>
+#include <linux/sunrpc/svcsock.h>
#include <net/tcp_states.h>
#include <linux/net.h>
#include <linux/tracepoint.h>
@@ -594,6 +595,51 @@ TRACE_EVENT(svc_handle_xprt,
(struct sockaddr *)&__entry->xprt->xpt_remote, __entry->len,
show_svc_xprt_flags(__entry->xprt->xpt_flags))
);
+
+DECLARE_EVENT_CLASS(svc_socket_event,
+ TP_PROTO(struct sock *sk),
+
+ TP_ARGS(sk),
+
+ TP_STRUCT__entry(
+ __field(struct sock *, sk)
+ __field(struct svc_sock *, svsk)
+ __field_struct(struct sockaddr_storage, ss)
+ __field(unsigned long, xpt_flags)
+ ),
+
+ TP_fast_assign(
+ __entry->sk = sk;
+ __entry->svsk = sk->sk_user_data;
+ if (__entry->svsk) {
+ struct svc_xprt *xprt = &__entry->svsk->sk_xprt;
+
+ memcpy(&__entry->ss, &xprt->xpt_remote,
+ sizeof(__entry->ss));
+ __entry->xpt_flags = xprt->xpt_flags;
+ } else {
+ memset(&__entry->ss, 0, sizeof(__entry->ss));
+ __entry->xpt_flags = 0;
+ }
+ ),
+
+ TP_printk("sk=0x%p peer=%pIScp sk_state=%s xpt_flags=%s", __entry->sk,
+ (struct sockaddr *)&__entry->ss,
+ rpc_show_sock_state(__entry->sk->sk_state),
+ show_svc_xprt_flags(__entry->xpt_flags))
+);
+
+DEFINE_EVENT(svc_socket_event, svc_tcp_listen_data_ready,
+ TP_PROTO(struct sock *sk), TP_ARGS(sk));
+
+DEFINE_EVENT(svc_socket_event, svc_tcp_state_change,
+ TP_PROTO(struct sock *sk), TP_ARGS(sk));
+
+DEFINE_EVENT(svc_socket_event, svc_tcp_data_ready,
+ TP_PROTO(struct sock *sk), TP_ARGS(sk));
+
+DEFINE_EVENT(svc_socket_event, svc_tcp_accept,
+ TP_PROTO(struct sock *sk), TP_ARGS(sk));
#endif /* _TRACE_SUNRPC_H */
#include <trace/define_trace.h>
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index cc331b6cf573..2334ebeda814 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -44,6 +44,7 @@
#include <asm/uaccess.h>
#include <asm/ioctls.h>
#include <trace/events/skb.h>
+#include <trace/events/sunrpc.h>
#include <linux/sunrpc/types.h>
#include <linux/sunrpc/clnt.h>
@@ -765,6 +766,7 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
wait_queue_head_t *wq;
+ trace_svc_tcp_listen_data_ready(sk);
dprintk("svc: socket %p TCP (listen) state change %d\n",
sk, sk->sk_state);
@@ -799,6 +801,7 @@ static void svc_tcp_state_change(struct sock *sk)
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
wait_queue_head_t *wq = sk_sleep(sk);
+ trace_svc_tcp_state_change(sk);
dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n",
sk, sk->sk_state, sk->sk_user_data);
@@ -817,6 +820,7 @@ static void svc_tcp_data_ready(struct sock *sk)
struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
wait_queue_head_t *wq = sk_sleep(sk);
+ trace_svc_tcp_data_ready(sk);
dprintk("svc: socket %p TCP data ready (svsk %p)\n",
sk, sk->sk_user_data);
if (svsk) {
@@ -842,6 +846,8 @@ static struct svc_xprt *svc_tcp_accept(struct svc_xprt *xprt)
int err, slen;
RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ trace_svc_tcp_accept(svsk->sk_sk);
+
dprintk("svc: tcp_accept %p sock %p\n", svsk, sock);
if (!sock)
return NULL;
--
2.1.0
next prev parent reply other threads:[~2014-12-10 19:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 19:07 [PATCH v2 00/16] nfsd/sunrpc: add support for a workqueue-based nfsd Jeff Layton
2014-12-10 19:07 ` [PATCH v2 01/16] sunrpc: add a new svc_serv_ops struct and move sv_shutdown into it Jeff Layton
2014-12-10 19:07 ` [PATCH v2 02/16] sunrpc: move sv_function into sv_ops Jeff Layton
2014-12-10 19:07 ` [PATCH v2 03/16] sunrpc: move sv_module parm " Jeff Layton
2014-12-10 19:07 ` [PATCH v2 04/16] sunrpc: turn enqueueing a svc_xprt into a svc_serv operation Jeff Layton
2014-12-10 19:07 ` [PATCH v2 05/16] sunrpc: abstract out svc_set_num_threads to sv_ops Jeff Layton
2014-12-10 19:07 ` [PATCH v2 06/16] sunrpc: move pool_mode definitions into svc.h Jeff Layton
2014-12-10 19:07 ` [PATCH v2 07/16] sunrpc: factor svc_rqst allocation and freeing from sv_nrthreads refcounting Jeff Layton
2014-12-10 19:07 ` [PATCH v2 08/16] sunrpc: set up workqueue function in svc_xprt Jeff Layton
2014-12-10 19:07 ` [PATCH v2 09/16] sunrpc: set up svc_rqst work if it's defined Jeff Layton
2014-12-10 19:07 ` [PATCH v2 10/16] sunrpc: add basic support for workqueue-based services Jeff Layton
2014-12-10 19:07 ` [PATCH v2 11/16] nfsd: keep a reference to the fs_struct in svc_rqst Jeff Layton
2014-12-10 19:07 ` [PATCH v2 12/16] nfsd: add support for workqueue based service processing Jeff Layton
2014-12-10 19:07 ` [PATCH v2 13/16] sunrpc: keep a cache of svc_rqsts for each NUMA node Jeff Layton
2014-12-10 19:07 ` [PATCH v2 14/16] sunrpc: add more tracepoints around svc_xprt handling Jeff Layton
2014-12-10 19:07 ` [PATCH v2 15/16] sunrpc: print the svc_rqst pointer value in svc_process tracepoint Jeff Layton
2014-12-10 19:08 ` Jeff Layton [this message]
2014-12-10 22:31 ` [PATCH v2 00/16] nfsd/sunrpc: add support for a workqueue-based nfsd Chuck Lever
2014-12-10 23:13 ` Jeff Layton
2014-12-12 2:12 ` Al Viro
2014-12-12 2:29 ` Linus Torvalds
2014-12-12 3:02 ` Al Viro
2014-12-12 3:06 ` Al Viro
2014-12-12 11:54 ` Jeff Layton
2014-12-12 16:59 ` Al Viro
2014-12-13 14:06 ` Jeff Layton
2014-12-13 17:29 ` Al Viro
2014-12-12 2:52 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418238480-18857-17-git-send-email-jlayton@primarydata.com \
--to=jlayton@primarydata.com \
--cc=bfields@fieldses.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox