* [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source
@ 2015-04-24 8:54 Naveen N. Rao
2015-04-24 14:32 ` Steven Rostedt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Naveen N. Rao @ 2015-04-24 8:54 UTC (permalink / raw)
To: linuxppc-dev, rostedt; +Cc: paulus
Add a new powerpc-specific trace clock using the timebase register,
similar to x86-tsc. This gives us
- a fast, monotonic, hardware clock source for trace entries, and
- a clock that can be used to correlate events across cpus as well as across
hypervisor and guests.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
Changes since v1:
- removed unnecessary #ifdef in trace_clock.h
- changed config build dependency for trace_clock.o from TRACE_CLOCK to TRACING
Documentation/trace/ftrace.txt | 5 +++++
arch/powerpc/include/asm/Kbuild | 1 -
arch/powerpc/include/asm/trace_clock.h | 19 +++++++++++++++++++
arch/powerpc/kernel/Makefile | 1 +
arch/powerpc/kernel/trace_clock.c | 15 +++++++++++++++
5 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 arch/powerpc/include/asm/trace_clock.h
create mode 100644 arch/powerpc/kernel/trace_clock.c
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index 572ca92..689f61a 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -346,6 +346,11 @@ of ftrace. Here is a list of some of the key files:
x86-tsc: Architectures may define their own clocks. For
example, x86 uses its own TSC cycle clock here.
+ ppc-tb: This uses the powerpc timebase register value.
+ This is in sync across CPUs and can also be used
+ to correlate events across hypervisor/guest if
+ tb_offset is known.
+
To set a clock, simply echo the clock name into this file.
echo global > trace_clock
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 382b28e..5041c66 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -5,5 +5,4 @@ generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += rwsem.h
generic-y += scatterlist.h
-generic-y += trace_clock.h
generic-y += vtime.h
diff --git a/arch/powerpc/include/asm/trace_clock.h b/arch/powerpc/include/asm/trace_clock.h
new file mode 100644
index 0000000..cf1ee75
--- /dev/null
+++ b/arch/powerpc/include/asm/trace_clock.h
@@ -0,0 +1,19 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
+ */
+
+#ifndef _ASM_PPC_TRACE_CLOCK_H
+#define _ASM_PPC_TRACE_CLOCK_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+extern u64 notrace trace_clock_ppc_tb(void);
+
+#define ARCH_TRACE_CLOCKS { trace_clock_ppc_tb, "ppc-tb", 0 },
+
+#endif /* _ASM_PPC_TRACE_CLOCK_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 502cf69..18e038e 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o
obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
+obj-$(CONFIG_TRACING) += trace_clock.o
ifneq ($(CONFIG_PPC_INDIRECT_PIO),y)
obj-y += iomap.o
diff --git a/arch/powerpc/kernel/trace_clock.c b/arch/powerpc/kernel/trace_clock.c
new file mode 100644
index 0000000..4917069
--- /dev/null
+++ b/arch/powerpc/kernel/trace_clock.c
@@ -0,0 +1,15 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
+ */
+
+#include <asm/trace_clock.h>
+#include <asm/time.h>
+
+u64 notrace trace_clock_ppc_tb(void)
+{
+ return get_tb();
+}
--
2.3.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source
2015-04-24 8:54 [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source Naveen N. Rao
@ 2015-04-24 14:32 ` Steven Rostedt
2015-07-31 5:13 ` Naveen N. Rao
2015-08-10 9:26 ` [v2] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2015-04-24 14:32 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: paulus, linuxppc-dev
On Fri, 24 Apr 2015 14:24:44 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> Add a new powerpc-specific trace clock using the timebase register,
> similar to x86-tsc. This gives us
> - a fast, monotonic, hardware clock source for trace entries, and
> - a clock that can be used to correlate events across cpus as well as across
> hypervisor and guests.
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> Changes since v1:
> - removed unnecessary #ifdef in trace_clock.h
> - changed config build dependency for trace_clock.o from TRACE_CLOCK to TRACING
>
Looks fine to me.
Acked-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
>
> Documentation/trace/ftrace.txt | 5 +++++
> arch/powerpc/include/asm/Kbuild | 1 -
> arch/powerpc/include/asm/trace_clock.h | 19 +++++++++++++++++++
> arch/powerpc/kernel/Makefile | 1 +
> arch/powerpc/kernel/trace_clock.c | 15 +++++++++++++++
> 5 files changed, 40 insertions(+), 1 deletion(-)
> create mode 100644 arch/powerpc/include/asm/trace_clock.h
> create mode 100644 arch/powerpc/kernel/trace_clock.c
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source
2015-04-24 8:54 [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source Naveen N. Rao
2015-04-24 14:32 ` Steven Rostedt
@ 2015-07-31 5:13 ` Naveen N. Rao
2015-08-10 9:26 ` [v2] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Naveen N. Rao @ 2015-07-31 5:13 UTC (permalink / raw)
To: linuxppc-dev, mpe; +Cc: paulus, rostedt
On 2015/04/24 02:24PM, Naveen N Rao wrote:
> Add a new powerpc-specific trace clock using the timebase register,
> similar to x86-tsc. This gives us
> - a fast, monotonic, hardware clock source for trace entries, and
> - a clock that can be used to correlate events across cpus as well as across
> hypervisor and guests.
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> Changes since v1:
> - removed unnecessary #ifdef in trace_clock.h
> - changed config build dependency for trace_clock.o from TRACE_CLOCK to TRACING
Bump.
Michael, can you please pick this up?
- Naveen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [v2] powerpc/ftrace: add powerpc timebase as a trace clock source
2015-04-24 8:54 [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source Naveen N. Rao
2015-04-24 14:32 ` Steven Rostedt
2015-07-31 5:13 ` Naveen N. Rao
@ 2015-08-10 9:26 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2015-08-10 9:26 UTC (permalink / raw)
To: Naveen N. Rao, linuxppc-dev, rostedt; +Cc: paulus
On Fri, 2015-24-04 at 08:54:44 UTC, "Naveen N. Rao" wrote:
> Add a new powerpc-specific trace clock using the timebase register,
> similar to x86-tsc. This gives us
> - a fast, monotonic, hardware clock source for trace entries, and
> - a clock that can be used to correlate events across cpus as well as across
> hypervisor and guests.
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> Acked-by: Steven Rostedt <rostedt@goodmis.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/197165d44925bd0fa892
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-10 9:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24 8:54 [PATCH v2] powerpc/ftrace: add powerpc timebase as a trace clock source Naveen N. Rao
2015-04-24 14:32 ` Steven Rostedt
2015-07-31 5:13 ` Naveen N. Rao
2015-08-10 9:26 ` [v2] " Michael Ellerman
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).