Skip to contentSkip to conversation

tracing: Minor updates

PATCH New Steven Rostedt 1 participant 5 messages May 14, 2015

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover tracing: Minor updates

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: f267caab44451baa70d25fa3191a68bb79ad1b08

Drew Richardson (1):
ftrace: Provide trace clock monotonic raw

Jerry Snitselaar (1):
tracing: Export tracing clock functions

Nicolas Iooss (1):
tracing: remove unused ftrace_output_event() prototype

Steven Rostedt (Red Hat) (1):
tracing: Remove unused prototype ftrace_event_define_field()

----

 include/linux/ftrace_event.h | 11 -----------
 kernel/trace/trace.c         |  1 +
 kernel/trace/trace_clock.c   |  3 +++
 3 files changed, 4 insertions(+), 11 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 tracing: remove unused ftrace_output_event() prototype

From: Nicolas Iooss <[email protected]>

The prototype of ftrace_output_event was added by commit 1d6bae966e90 ("tracing: Move raw output code from macro to standalone function") but this function was not defined anywhere, and is still nowhere to be found.

---
 include/linux/ftrace_event.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/ftrace_event.h +0 -3
index f9ecf63d47f1..65ce6de91307 100644
@@ -219,9 +219,6 @@ struct ftrace_event_class {
 extern int ftrace_event_reg(struct ftrace_event_call *event,
 			    enum trace_reg type, void *data);
 
-int ftrace_output_event(struct trace_iterator *iter, struct ftrace_event_call *event,
-			char *fmt, ...);
-
 int ftrace_event_define_field(struct ftrace_event_call *call,
 			      char *type, int len, char *item, int offset,
 			      int field_size, int sign, int filter);
Signature · 1 line
2.1.4
author maintainer
#2 lore raw

PATCH 2/4 tracing: Export tracing clock functions

In reply to Steven Rostedt

From: Jerry Snitselaar <[email protected]>

Critical tracepoint hooks should never call anything that takes a lock, so they are unable to call getrawmonotonic() or ktime_get().

Export the rest of the tracing clock functions so can be used in tracepoint hooks.

Background: We have a customer that adds their own module and registers a tracepoint hook to sched_wakeup. They were using ktime_get() for a time source, but it grabs a seq lock and caused a deadlock to occur.

---
 kernel/trace/trace_clock.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/trace/trace_clock.c +3 -0
index 57b67b1f24d1..0f06532a755b 100644
@@ -56,6 +56,7 @@ u64 notrace trace_clock(void)
 {
 	return local_clock();
 }
+EXPORT_SYMBOL_GPL(trace_clock);
 
 /*
  * trace_jiffy_clock(): Simply use jiffies as a clock counter.
@@ -68,6 +69,7 @@ u64 notrace trace_clock_jiffies(void)
 {
 	return jiffies_64_to_clock_t(jiffies_64 - INITIAL_JIFFIES);
 }
+EXPORT_SYMBOL_GPL(trace_clock_jiffies);
 
 /*
  * trace_clock_global(): special globally coherent trace clock
@@ -123,6 +125,7 @@ u64 notrace trace_clock_global(void)
 
 	return now;
 }
+EXPORT_SYMBOL_GPL(trace_clock_global);
 
 static atomic64_t trace_counter;
 
Signature · 1 line
2.1.4
author maintainer
#3 lore raw

PATCH 3/4 ftrace: Provide trace clock monotonic raw

In reply to Steven Rostedt

From: Drew Richardson <[email protected]>

Expose the NMI safe accessor to the monotonic raw clock to the tracer. The mono clock was added with commit 1b3e5c0936046e7e023149ddc8946d21c2ea20eb. The advantage of the monotonic raw clock is that it will advance more constantly than the monotonic clock.

Imagine someone is trying to optimize a particular program to reduce instructions executed for a given workload while minimizing the effect on runtime. Also suppose that NTP is running and potentially making larger adjustments to the monotonic clock. If NTP is adjusting the monotonic clock to advance more rapidly, the program will appear to use fewer instructions per second but run longer than if the monotonic raw clock had been used. The total number of instructions observed would be the same regardless of the clock source used, but how it's attributed to time would be affected.

Conversely if NTP is adjusting the monotonic clock to advance more slowly, the program will appear to use more instructions per second but run more quickly. Of course there are many sources that can cause jitter in performance measurements on modern processors, but let's remove NTP from the list.

The monotonic raw clock can also be useful for tracing early boot, e.g. when debugging issues with NTP.

---
 kernel/trace/trace.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace.c +1 -0
index 05330494a0df..458031c31a37 100644
@@ -876,6 +876,7 @@ static struct {
 	{ trace_clock_jiffies,		"uptime",	0 },
 	{ trace_clock,			"perf",		1 },
 	{ ktime_get_mono_fast_ns,	"mono",		1 },
+	{ ktime_get_raw_fast_ns,	"mono_raw",	1 },
 	ARCH_TRACE_CLOCKS
 };
 
Signature · 1 line
2.1.4
author maintainer
#4 lore raw

PATCH 4/4 tracing: Remove unused prototype ftrace_event_define_field()

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

ftrace_event_define_field() has a prototype defined but never used. Remove it.

---
 include/linux/ftrace_event.h | 8 --------
 1 file changed, 8 deletions(-)
include/linux/ftrace_event.h +0 -8
index 65ce6de91307..f8465d65f3c7 100644
@@ -219,10 +219,6 @@ struct ftrace_event_class {
 extern int ftrace_event_reg(struct ftrace_event_call *event,
 			    enum trace_reg type, void *data);
 
-int ftrace_event_define_field(struct ftrace_event_call *call,
-			      char *type, int len, char *item, int offset,
-			      int field_size, int sign, int filter);
-
 struct ftrace_event_buffer {
 	struct ring_buffer		*buffer;
 	struct ring_buffer_event	*event;
@@ -238,10 +234,6 @@ void *ftrace_event_buffer_reserve(struct ftrace_event_buffer *fbuffer,
 
 void ftrace_event_buffer_commit(struct ftrace_event_buffer *fbuffer);
 
-int ftrace_event_define_field(struct ftrace_event_call *call,
-			      char *type, int len, char *item, int offset,
-			      int field_size, int sign, int filter);
-
 enum {
 	TRACE_EVENT_FL_FILTERED_BIT,
 	TRACE_EVENT_FL_CAP_ANY_BIT,
Signature · 1 line
2.1.4