Re: [lttng-dev] [RFC-Patch 1/2] Add page fault trace event definitions
* Francis Deslauriers (fdesl...@gmail.com) wrote: > Add page_fault_entry and page_fault_exit event definitions. It will > allow each architecture to instrument their page faults. > > Signed-off-by: Francis Deslauriers > Reviewed-by: Raphaël Beamonte Reviewed-by: Mathieu Desnoyers > --- > include/trace/events/fault.h | 51 > ++ > 1 file changed, 51 insertions(+) > create mode 100644 include/trace/events/fault.h > > diff --git a/include/trace/events/fault.h b/include/trace/events/fault.h > new file mode 100644 > index 000..522ddee > --- /dev/null > +++ b/include/trace/events/fault.h > @@ -0,0 +1,51 @@ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM fault > + > +#if !defined(_TRACE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_FAULT_H > + > +#include > + > +TRACE_EVENT(page_fault_entry, > + > + TP_PROTO(struct pt_regs *regs, unsigned long address, > + int write_access), > + > + TP_ARGS(regs, address, write_access), > + > + TP_STRUCT__entry( > + __field(unsigned long, ip ) > + __field(unsigned long, addr) > + __field(uint8_t,write ) > + ), > + > + TP_fast_assign( > + __entry->ip = regs ? instruction_pointer(regs) : 0UL; > + __entry->addr = address; > + __entry->write = !!write_access; > + ), > + > + TP_printk("ip=%lu addr=%lu write_access=%d", > + __entry->ip, __entry->addr, __entry->write) > +); > + > +TRACE_EVENT(page_fault_exit, > + > + TP_PROTO(int result), > + > + TP_ARGS(result), > + > + TP_STRUCT__entry( > + __field(int,res ) > + ), > + > + TP_fast_assign( > + __entry->res= result; > + ), > + > + TP_printk("result=%d", __entry->res) > +); > + > +#endif /* _TRACE_FAULT_H */ > +/* This part must be outside protection */ > +#include > -- > 1.7.10.4 > > > ___ > lttng-dev mailing list > lttng-dev@lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com ___ lttng-dev mailing list lttng-dev@lists.lttng.org http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[lttng-dev] [RFC-Patch 1/2] Add page fault trace event definitions
Add page_fault_entry and page_fault_exit event definitions. It will allow each architecture to instrument their page faults. Signed-off-by: Francis Deslauriers Reviewed-by: Raphaël Beamonte --- include/trace/events/fault.h | 51 ++ 1 file changed, 51 insertions(+) create mode 100644 include/trace/events/fault.h diff --git a/include/trace/events/fault.h b/include/trace/events/fault.h new file mode 100644 index 000..522ddee --- /dev/null +++ b/include/trace/events/fault.h @@ -0,0 +1,51 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fault + +#if !defined(_TRACE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FAULT_H + +#include + +TRACE_EVENT(page_fault_entry, + + TP_PROTO(struct pt_regs *regs, unsigned long address, + int write_access), + + TP_ARGS(regs, address, write_access), + + TP_STRUCT__entry( + __field(unsigned long, ip ) + __field(unsigned long, addr) + __field(uint8_t,write ) + ), + + TP_fast_assign( + __entry->ip = regs ? instruction_pointer(regs) : 0UL; + __entry->addr = address; + __entry->write = !!write_access; + ), + + TP_printk("ip=%lu addr=%lu write_access=%d", + __entry->ip, __entry->addr, __entry->write) +); + +TRACE_EVENT(page_fault_exit, + + TP_PROTO(int result), + + TP_ARGS(result), + + TP_STRUCT__entry( + __field(int,res ) + ), + + TP_fast_assign( + __entry->res= result; + ), + + TP_printk("result=%d", __entry->res) +); + +#endif /* _TRACE_FAULT_H */ +/* This part must be outside protection */ +#include -- 1.7.10.4 ___ lttng-dev mailing list lttng-dev@lists.lttng.org http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Re: [lttng-dev] [RFC-Patch 1/2] Add page fault trace event definitions
* Francis Deslauriers (fdesl...@gmail.com) wrote: > Add page_fault_entry and page_fault_exit event definitions. It will > allow each architecture to instrument their page faults. > > Signed-off-by: Francis Deslauriers > Reviewed-by: Raphaël Beamonte > --- > include/trace/events/fault.h | 51 > ++ > 1 file changed, 51 insertions(+) > create mode 100644 include/trace/events/fault.h > > diff --git a/include/trace/events/fault.h b/include/trace/events/fault.h > new file mode 100644 > index 000..7256b40 > --- /dev/null > +++ b/include/trace/events/fault.h > @@ -0,0 +1,51 @@ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM fault > + > +#if !defined(_TRACE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_FAULT_H > + > +#include > + > +TRACE_EVENT(page_fault_entry, > + > + TP_PROTO(struct pt_regs *regs, unsigned long address, > + int write_access), > + > + TP_ARGS(regs, address, write_access), > + > + TP_STRUCT__entry( > + __field(unsigned long, ip ) > + __field(unsigned long, addr) > + __field(int,write ) uint8_t, write will save some space. > + ), > + > + TP_fast_assign( > + __entry->ip = regs ? instruction_pointer(regs) : 0UL; > + __entry->addr = address; > + __entry->write = write_access; Just to be clean, if we use uint8_t: __entry->write = !!write_access; It will map zero/nonzero values to 0 and 1, and thus ensure it can be represented on a uint8_t. Thanks, Mathieu > + ), > + > + TP_printk("ip=%lu addr=%lu write_access=%d", > + __entry->ip, __entry->addr, __entry->write) > +); > + > +TRACE_EVENT(page_fault_exit, > + > + TP_PROTO(int result), > + > + TP_ARGS(result), > + > + TP_STRUCT__entry( > + __field(int,res ) > + ), > + > + TP_fast_assign( > + __entry->res= result; > + ), > + > + TP_printk("result=%d", __entry->res) > +); > + > +#endif /* _TRACE_FAULT_H */ > +/* This part must be outside protection */ > +#include > -- > 1.7.10.4 > > > ___ > lttng-dev mailing list > lttng-dev@lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com ___ lttng-dev mailing list lttng-dev@lists.lttng.org http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[lttng-dev] [RFC-Patch 1/2] Add page fault trace event definitions
Add page_fault_entry and page_fault_exit event definitions. It will allow each architecture to instrument their page faults. Signed-off-by: Francis Deslauriers Reviewed-by: Raphaël Beamonte --- include/trace/events/fault.h | 51 ++ 1 file changed, 51 insertions(+) create mode 100644 include/trace/events/fault.h diff --git a/include/trace/events/fault.h b/include/trace/events/fault.h new file mode 100644 index 000..7256b40 --- /dev/null +++ b/include/trace/events/fault.h @@ -0,0 +1,51 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fault + +#if !defined(_TRACE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FAULT_H + +#include + +TRACE_EVENT(page_fault_entry, + + TP_PROTO(struct pt_regs *regs, unsigned long address, + int write_access), + + TP_ARGS(regs, address, write_access), + + TP_STRUCT__entry( + __field(unsigned long, ip ) + __field(unsigned long, addr) + __field(int,write ) + ), + + TP_fast_assign( + __entry->ip = regs ? instruction_pointer(regs) : 0UL; + __entry->addr = address; + __entry->write = write_access; + ), + + TP_printk("ip=%lu addr=%lu write_access=%d", + __entry->ip, __entry->addr, __entry->write) +); + +TRACE_EVENT(page_fault_exit, + + TP_PROTO(int result), + + TP_ARGS(result), + + TP_STRUCT__entry( + __field(int,res ) + ), + + TP_fast_assign( + __entry->res= result; + ), + + TP_printk("result=%d", __entry->res) +); + +#endif /* _TRACE_FAULT_H */ +/* This part must be outside protection */ +#include -- 1.7.10.4 ___ lttng-dev mailing list lttng-dev@lists.lttng.org http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev