Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213777

Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->'

From Jeff Layton <jlayton@poochiereds.net>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->'
Date 2015-08-26 14:10 +0200
Message-ID <q1HGH-5gu-39@gated-at.bofh.it> (permalink)
References <q1fAJ-6pU-7@gated-at.bofh.it> <q1fAJ-6pU-9@gated-at.bofh.it> <q1GhA-38h-31@gated-at.bofh.it> <q1Hx0-4PL-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 26 Aug 2015 17:22:25 +0530
Pratyush Anand <panand@redhat.com> wrote:

> Hi Jeff,
> 
> Thanks for your review comments.
> 
> On 26/08/2015:06:31:03 AM, Jeff Layton wrote:
> > On Tue, 25 Aug 2015 11:34:19 +0530
> > Pratyush Anand <panand@redhat.com> wrote:
> > >  	TP_fast_assign(
> > >  		__entry->xprt = xprt;
> > > +		__entry->addr =
> > > +			xprt ? (struct sockaddr *)&xprt->xpt_remote : NULL;
> > 
> > I don't get it. It's not safe to save a pointer to xprt and dereference
> > that in a tracepoint (and I understand why that is), but it is safe to
> > save a pointer to a structure embedded inside of xprt? Shouldn't you be
> > saving a copy of the entire sockaddr struct instead?
> 
> As far as "saving of a pointer to a structure embedded inside of xprt" is
> concerned, I do not see any issue.
> 
> Its your take that what you want to print as your tracepoint print output. I
> might be missing something..  However, I do not see any value addition in
> printing address of a structure(located in ring buffer) where xprt->xpt_remote
> has been copied.
> 
> > 
> > Ahh, ok -- I think I see the confusion. %pIScp does not print the
> > address of the sockaddr, but instead dereferences the pointer and
> > prints it as a formatted address string. See pointer() in
> > lib/vsprintf.c. You do want to save off a copy of the structure instead.
> 
> In my opinion, saving of structure would only be necessary if you want to access
> element of the structure xprt->xpt_remote.
> 
> ~Pratyush

That's exactly what %pI does. Look at the pointer() function.

For this tracepoint, we want to print out the address of the remote end
of the socket. That's saved in xprt->xpt_remote.

%pIScp doesn't print the pointer's address. It dereferences that
pointer and formats and prints the socket address that it points to. If
you pass a NULL pointer into anything that uses %pI, it's going to oops.

-- 
Jeff Layton <jlayton@poochiereds.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->' Pratyush Anand <panand@redhat.com> - 2015-08-25 08:10 +0200
  Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op  '->' Steven Rostedt <rostedt@goodmis.org> - 2015-08-25 16:10 +0200
  Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op  '->' Jeff Layton <jlayton@poochiereds.net> - 2015-08-26 12:40 +0200
    Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->' Pratyush Anand <panand@redhat.com> - 2015-08-26 14:00 +0200
      Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op  '->' Jeff Layton <jlayton@poochiereds.net> - 2015-08-26 14:10 +0200
        Re: [PATCH 1/2] net: sunrpc: fix tracepoint Warning: unknown op '->' Pratyush Anand <panand@redhat.com> - 2015-08-26 14:20 +0200

csiph-web