mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, fweisbec@gmail.com,
	mingo@redhat.com, Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] Fix tracing infrastructure to support multiple includes when defining CREATE_TRACE_POINTS
Date: Wed, 16 Dec 2009 06:49:03 -0500	[thread overview]
Message-ID: <20091216114903.GA29609@hmsreliant.think-freely.org> (raw)
In-Reply-To: <1260936829.2146.447.camel@gandalf.stny.rr.com>

On Tue, Dec 15, 2009 at 11:13:49PM -0500, Steven Rostedt wrote:
> On Tue, 2009-12-15 at 11:08 -0500, Neil Horman wrote:
> 
> Hi Neil,
> 
> I was playing with this, and I got really nasty errors in the trace
> parsing tools. Then I noticed why:
> 
> > -DECLARE_TRACE(napi_poll,
> > +TRACE_EVENT(napi_poll,
> > +
> >  	TP_PROTO(struct napi_struct *napi),
> > -	TP_ARGS(napi));
> > +
> > +	TP_ARGS(napi),
> > +
> > +	TP_STRUCT__entry(
> > +		__field(        struct napi_struct *,	napi)
> > +        ),
> > +
> > +        TP_fast_assign(
> > +                __entry->napi = napi;
> > +        ),
> > +
> > +        TP_printk("napi poll on napi struct %p for device %s",
> > +		__entry->napi, __entry->napi->dev->name)
> 
> You can't trust this! That "__entry" happens to reside on the ring
> buffer. If for some reason the device goes away, this blows up when you
> read the trace.
> 
> If you need to save the name of the device, then store it in the ring
> buffer. You can do it with a dynamic array:
> 
> 	TP_STRUCT__entry(
> 		__field(	struct napi_struct *, napi)
> 		__string(	dev_name, napi->dev->name)
> 	),
> 
> 	TP_fast_assign(
> 		__entry->napi = napi;
> 		__assign_str(dev_name, napi->dev->name);
> 	),
> 
> 	TP_printk("napi poll on napi struct %p for device %s",
> 		__entry->napi, __get_string(dev_name))
> 
> -- Steve
> 
> > +);
> >  
> >  #endif
> 
> 
> 
Ok, thanks, I'll resubmit shortly.
Neil


  reply	other threads:[~2009-12-16 11:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 19:19 Neil Horman
2009-12-03 14:15 ` Steven Rostedt
2009-12-03 19:35   ` Neil Horman
2009-12-03 19:42     ` Steven Rostedt
2009-12-07 20:04     ` Steven Rostedt
2009-12-07 20:18       ` Neil Horman
2009-12-07 20:47         ` Steven Rostedt
2009-12-07 20:49           ` Steven Rostedt
2009-12-07 20:53             ` Neil Horman
2009-12-14 19:50               ` Neil Horman
2009-12-15 16:08                 ` Neil Horman
2009-12-16  4:13                   ` Steven Rostedt
2009-12-16 11:49                     ` Neil Horman [this message]
2009-12-16 16:04                       ` Neil Horman
2009-12-22 18:03                         ` Steven Rostedt
2009-12-23 12:02                           ` Neil Horman
2009-12-23 13:58                             ` Steven Rostedt
2009-12-23 18:36                               ` Neil Horman

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=20091216114903.GA29609@hmsreliant.think-freely.org \
    --to=nhorman@tuxdriver.com \
    --cc=compudj@krystal.dyndns.org \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /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

all inboxes | Powered by JetHome®