All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Anand <panand@redhat.com>
To: bfields@fieldses.org
Cc: rostedt@goodmis.org, linux-nfs@vger.kernel.org,
	Pratyush Anand <panand@redhat.com>,
	Ingo Molnar <mingo@redhat.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	Jeff Layton <jlayton@primarydata.com>,
	linux-kernel@vger.kernel.org (open list),
	Trond Myklebust <trond.myklebust@primarydata.com>
Subject: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->'
Date: Tue, 25 Aug 2015 11:34:19 +0530	[thread overview]
Message-ID: <edc9697b5140015b15c96cc1b505b3c53169e634.1440482404.git.panand@redhat.com> (raw)
In-Reply-To: <cover.1440482404.git.panand@redhat.com>
In-Reply-To: <cover.1440482404.git.panand@redhat.com>

`perf stat  -e sunrpc:svc_xprt_do_enqueue true` results in

Warning: unknown op '->'
Warning: [sunrpc:svc_xprt_do_enqueue] unknown op '->'

Similar warning for svc_handle_xprt as well.

Actually TP_printk() should never dereference an address saved in the ring
buffer that points somewhere in the kernel. There's no guarantee that that
object still exists (with the exception of static strings).

Therefore change all the arguments for TP_printk(), so that it references
values existing in the ring buffer only.

While doing that, also fix another possible bug when argument xprt could be
NULL and TP_fast_assign() tries to access it's elements.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
 include/trace/events/sunrpc.h | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index fd1a02cb3c82..937e482d80e9 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -529,18 +529,24 @@ TRACE_EVENT(svc_xprt_do_enqueue,
 
 	TP_STRUCT__entry(
 		__field(struct svc_xprt *, xprt)
+		__field(struct sockaddr *, addr)
 		__field(struct svc_rqst *, rqst)
+		__field(int, pid)
+		__field(unsigned long, flags)
 	),
 
 	TP_fast_assign(
 		__entry->xprt = xprt;
+		__entry->addr =
+			xprt ? (struct sockaddr *)&xprt->xpt_remote : NULL;
 		__entry->rqst = rqst;
+		__entry->pid = rqst? rqst->rq_task->pid : 0;
+		__entry->flags = xprt ? xprt->xpt_flags : 0;
 	),
 
 	TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
-		(struct sockaddr *)&__entry->xprt->xpt_remote,
-		__entry->rqst ? __entry->rqst->rq_task->pid : 0,
-		show_svc_xprt_flags(__entry->xprt->xpt_flags))
+		__entry->addr, __entry->pid,
+		show_svc_xprt_flags(__entry->flags))
 );
 
 TRACE_EVENT(svc_xprt_dequeue,
@@ -589,16 +595,21 @@ TRACE_EVENT(svc_handle_xprt,
 	TP_STRUCT__entry(
 		__field(struct svc_xprt *, xprt)
 		__field(int, len)
+		__field(struct sockaddr *, addr)
+		__field(unsigned long, flags)
 	),
 
 	TP_fast_assign(
 		__entry->xprt = xprt;
+		__entry->addr =
+			xprt ? (struct sockaddr *)&xprt->xpt_remote : NULL;
 		__entry->len = len;
+		__entry->flags = xprt ? xprt->xpt_flags : 0;
 	),
 
 	TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
-		(struct sockaddr *)&__entry->xprt->xpt_remote, __entry->len,
-		show_svc_xprt_flags(__entry->xprt->xpt_flags))
+		__entry->addr, __entry->len,
+		show_svc_xprt_flags(__entry->flags))
 );
 #endif /* _TRACE_SUNRPC_H */
 
-- 
2.4.3


  reply	other threads:[~2015-08-25  6:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25  6:04 [PATCH 0/2] net: sunrpc: trace fixes Pratyush Anand
2015-08-25  6:04 ` Pratyush Anand [this message]
2015-08-25 14:02   ` [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->' Steven Rostedt
2015-08-26 10:31   ` Jeff Layton
2015-08-26 11:52     ` Pratyush Anand
2015-08-26 12:01       ` Jeff Layton
2015-08-26 12:11         ` Pratyush Anand
2015-08-25  6:04 ` [PATCH 2/2] net: sunrpc: fix trace print of &xprt->xpt_remote Pratyush Anand
2015-08-26 10:32   ` Jeff Layton
2015-08-26 20:30     ` Steven Rostedt

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=edc9697b5140015b15c96cc1b505b3c53169e634.1440482404.git.panand@redhat.com \
    --to=panand@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=bfields@redhat.com \
    --cc=jlayton@primarydata.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=trond.myklebust@primarydata.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.