The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Michael Rubin <mrubin@google.com>,
	David Sharp <dhsharp@google.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Jiaying Zhang <jiayingz@google.com>
Subject: Re: [PATCH 1/2] trace: Add trap entry/exit tracepoints
Date: Thu, 28 Apr 2011 19:36:32 -0400	[thread overview]
Message-ID: <1304033792.18763.214.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1303774765-13032-1-git-send-email-vnagarnaik@google.com>

On Mon, 2011-04-25 at 16:39 -0700, Vaibhav Nagarnaik wrote:
> From: Jiaying Zhang <jiayingz@google.com>
> 
> For debugging and performance monitoring purpose, we often need to trace
> trap entry and exit events. The following patch adds the event
> definition for trap entry/exit and the instrumentation hooks for x86
> platforms. Other platforms should be able to use these events as well
> once they add the corresponding instrumentation.

I'm fine with this patch, but it requires Acks from Ingo or Thomas.


> 
> $ echo 1 > debug/tracing/events/trap/enable
> run gdb to genrate some trap events
> $ cat debug/tracing/trace
>           <...>-13619 [003]   917.726602: trap_entry: number=3
>           <...>-13619 [003]   917.726612: trap_exit: number=3
>           <...>-13619 [003]   917.747263: trap_entry: number=1
>           <...>-13619 [003]   917.747272: trap_exit: number=1
>           <...>-13619 [003]   917.747567: trap_entry: number=3
>           <...>-13619 [003]   917.747570: trap_exit: number=3
>           <...>-13619 [003]   917.748101: trap_entry: number=1
>           <...>-13619 [003]   917.748103: trap_exit: number=1
> 
> $ echo 1 > tracing_enabled; ~/trap pagefault; echo 0 > tracing_enabled
> $ cat trace | grep "trap-" | grep number=14 | head
>        trap-12528 [003]  1159.755792: trap_entry: number=14
>        trap-12528 [003]  1159.755801: trap_entry: number=14
>        trap-12528 [003]  1159.755804: trap_entry: number=14
>        trap-12528 [003]  1159.755807: trap_entry: number=14
>        trap-12528 [003]  1159.755810: trap_entry: number=14
>        trap-12528 [003]  1159.755817: trap_entry: number=14
>        trap-12528 [003]  1159.755819: trap_entry: number=14
>        trap-12528 [003]  1159.755821: trap_entry: number=14
>        trap-12528 [003]  1159.755824: trap_entry: number=14
>        trap-12528 [003]  1159.755826: trap_entry: number=14
> $ cat trace | grep "trap-" | grep number=7 | head
>        trap-12528 [003]  1159.756283: trap_entry: number=7
>        trap-12529 [003]  1159.757427: trap_entry: number=7
>        trap-12530 [003]  1159.758277: trap_entry: number=7
>        trap-12531 [003]  1159.759172: trap_entry: number=7
>        trap-12532 [003]  1159.768643: trap_entry: number=7
>        trap-12533 [003]  1159.778195: trap_entry: number=7
>        trap-15026 [001]  1557.877722: trap_entry: number=7
>        trap-15253 [001]  1621.395067: trap_entry: number=7
> 
> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>


> +++ b/include/trace/events/trap.h

As this is placed in the generic code, I wonder if a
"trace_trap_entry(id)" is sufficient for all archs.

-- Steve

> @@ -0,0 +1,44 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM trap
> +
> +#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_TRAP_H
> +
> +#include <linux/tracepoint.h>
> +
> +DECLARE_EVENT_CLASS(trap,
> +
> +	TP_PROTO(int id),
> +
> +	TP_ARGS(id),
> +
> +	TP_STRUCT__entry(
> +		__field(	int,	id	)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = id;
> +	),
> +
> +	TP_printk("number=%d", __entry->id)
> +);
> +
> +DEFINE_EVENT(trap, trap_entry,
> +
> +	TP_PROTO(int id),
> +
> +	TP_ARGS(id)
> +);
> +
> +DEFINE_EVENT(trap, trap_exit,
> +
> +	TP_PROTO(int id),
> +
> +	TP_ARGS(id)
> +);
> +
> +#endif /* _TRACE_TRAP_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> +



  reply	other threads:[~2011-04-28 23:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 23:03 [PATCH 1/2] trace: Add trap entry/exit tracepoints Vaibhav Nagarnaik
2011-04-22 23:03 ` [PATCH 2/2] x86: Change trap definitions to enumerated values Vaibhav Nagarnaik
2011-04-28 23:15   ` Vaibhav Nagarnaik
2011-04-28 23:40   ` Steven Rostedt
2011-04-29  0:38   ` Thomas Gleixner
2011-04-25 23:39 ` [PATCH 1/2] trace: Add trap entry/exit tracepoints Vaibhav Nagarnaik
2011-04-28 23:36   ` Steven Rostedt [this message]
2011-04-29  0:33 ` Thomas Gleixner
2011-04-30  0:52   ` Vaibhav Nagarnaik
2011-04-30  0:52 ` [PATCH 1/2] x86: Change trap definitions to enumerated values Vaibhav Nagarnaik
2011-05-03 13:18   ` Don Zickus
2011-05-03 19:00     ` Vaibhav Nagarnaik
2011-05-03 22:41       ` Michael Rubin
2011-05-03 22:54         ` Steven Rostedt
2011-05-03 23:08           ` David Sharp
2011-04-30  0:52 ` [PATCH 2/2] trace: Add trap entry/exit tracepoints Vaibhav Nagarnaik

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=1304033792.18763.214.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=dhsharp@google.com \
    --cc=jiayingz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mrubin@google.com \
    --cc=tglx@linutronix.de \
    --cc=vnagarnaik@google.com \
    --cc=x86@kernel.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