linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Export tracing clock functions
@ 2015-04-30 14:36 Jerry Snitselaar
  2015-04-30 14:48 ` Steven Rostedt
  2015-04-30 15:10 ` [PATCH v2] " Jerry Snitselaar
  0 siblings, 2 replies; 3+ messages in thread
From: Jerry Snitselaar @ 2015-04-30 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Ingo Molnar

Critical tracepoint hooks shoud 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.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 kernel/trace/trace_clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
index 57b67b1..0f06532 100644
--- a/kernel/trace/trace_clock.c
+++ b/kernel/trace/trace_clock.c
@@ -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;
 
-- 
2.4.0.rc3.3.g6eb1401


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Export tracing clock functions
  2015-04-30 14:36 [PATCH] tracing: Export tracing clock functions Jerry Snitselaar
@ 2015-04-30 14:48 ` Steven Rostedt
  2015-04-30 15:10 ` [PATCH v2] " Jerry Snitselaar
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2015-04-30 14:48 UTC (permalink / raw)
  To: Jerry Snitselaar; +Cc: linux-kernel, Ingo Molnar

On Thu, 30 Apr 2015 07:36:40 -0700
Jerry Snitselaar <jsnitsel@redhat.com> wrote:

> Critical tracepoint hooks shoud 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.

A little background needs to be explained here.

A customer adds their own module to do some analysis and hooks to
tracepoints to do so. They were using ktime_get() as their time source,
but as that grabs a seq lock, it was causing deadlocks.

The tracing clocks were made for this purpose, and I find nothing wrong
with letting users add their own modules (GPL of course) and adding
their own hooks to the tracepoint code. I created it for that purpose.
But if they need to do any timings, they must use lockless clocks,
which the trace clocks are good for.

-- Steve


> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
> ---

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] tracing: Export tracing clock functions
  2015-04-30 14:36 [PATCH] tracing: Export tracing clock functions Jerry Snitselaar
  2015-04-30 14:48 ` Steven Rostedt
@ 2015-04-30 15:10 ` Jerry Snitselaar
  1 sibling, 0 replies; 3+ messages in thread
From: Jerry Snitselaar @ 2015-04-30 15:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Ingo Molnar

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.

v2: added background info and fixed typo

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 kernel/trace/trace_clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
index 57b67b1..0f06532 100644
--- a/kernel/trace/trace_clock.c
+++ b/kernel/trace/trace_clock.c
@@ -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;
 
-- 
2.4.0.rc3.3.g6eb1401


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-30 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30 14:36 [PATCH] tracing: Export tracing clock functions Jerry Snitselaar
2015-04-30 14:48 ` Steven Rostedt
2015-04-30 15:10 ` [PATCH v2] " Jerry Snitselaar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).