-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracing: Add support for preempt and irq enable/disable events
Preempt and irq trace events can be used for tracing the start and end of an atomic section which can be used by a trace viewer like systrace to graphically view the start and end of an atomic section and correlate them with latencies and scheduling issues. This also serves as a prelude to using synthetic events or probes to rewrite the preempt and irqsoff tracers, along with numerous benefits of using trace events features for these events. Link: http://lkml.kernel.org/r/20171006005432.14244-3-joelaf@google.com Link: http://lkml.kernel.org/r/20171010225137.17370-1-joelaf@google.com Cc: Peter Zilstra <peterz@infradead.org> Cc: kernel-team@android.com Signed-off-by: Joel Fernandes <joelaf@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
- Loading branch information
Joel Fernandes
authored and
Steven Rostedt (VMware)
committed
Oct 10, 2017
1 parent
aaecaa0
commit d591581
Showing
5 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#ifdef CONFIG_PREEMPTIRQ_EVENTS | ||
|
||
#undef TRACE_SYSTEM | ||
#define TRACE_SYSTEM preemptirq | ||
|
||
#if !defined(_TRACE_PREEMPTIRQ_H) || defined(TRACE_HEADER_MULTI_READ) | ||
#define _TRACE_PREEMPTIRQ_H | ||
|
||
#include <linux/ktime.h> | ||
#include <linux/tracepoint.h> | ||
#include <linux/string.h> | ||
#include <asm/sections.h> | ||
|
||
DECLARE_EVENT_CLASS(preemptirq_template, | ||
|
||
TP_PROTO(unsigned long ip, unsigned long parent_ip), | ||
|
||
TP_ARGS(ip, parent_ip), | ||
|
||
TP_STRUCT__entry( | ||
__field(u32, caller_offs) | ||
__field(u32, parent_offs) | ||
), | ||
|
||
TP_fast_assign( | ||
__entry->caller_offs = (u32)(ip - (unsigned long)_stext); | ||
__entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext); | ||
), | ||
|
||
TP_printk("caller=%pF parent=%pF", | ||
(void *)((unsigned long)(_stext) + __entry->caller_offs), | ||
(void *)((unsigned long)(_stext) + __entry->parent_offs)) | ||
); | ||
|
||
#ifndef CONFIG_PROVE_LOCKING | ||
DEFINE_EVENT(preemptirq_template, irq_disable, | ||
TP_PROTO(unsigned long ip, unsigned long parent_ip), | ||
TP_ARGS(ip, parent_ip)); | ||
|
||
DEFINE_EVENT(preemptirq_template, irq_enable, | ||
TP_PROTO(unsigned long ip, unsigned long parent_ip), | ||
TP_ARGS(ip, parent_ip)); | ||
#endif | ||
|
||
#ifdef CONFIG_DEBUG_PREEMPT | ||
DEFINE_EVENT(preemptirq_template, preempt_disable, | ||
TP_PROTO(unsigned long ip, unsigned long parent_ip), | ||
TP_ARGS(ip, parent_ip)); | ||
|
||
DEFINE_EVENT(preemptirq_template, preempt_enable, | ||
TP_PROTO(unsigned long ip, unsigned long parent_ip), | ||
TP_ARGS(ip, parent_ip)); | ||
#endif | ||
|
||
#endif /* _TRACE_PREEMPTIRQ_H */ | ||
|
||
#include <trace/define_trace.h> | ||
|
||
#else /* !CONFIG_PREEMPTIRQ_EVENTS */ | ||
|
||
#define trace_irq_enable(...) | ||
#define trace_irq_disable(...) | ||
#define trace_preempt_enable(...) | ||
#define trace_preempt_disable(...) | ||
#define trace_irq_enable_rcuidle(...) | ||
#define trace_irq_disable_rcuidle(...) | ||
#define trace_preempt_enable_rcuidle(...) | ||
#define trace_preempt_disable_rcuidle(...) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters