mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	akpm@linux-foundation.org, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Paul Mundt <lethal@linux-sh.org>,
	linux-sh@vger.kernel.org
Subject: [RFC patch 11/18] LTTng timestamp sh
Date: Fri, 07 Nov 2008 00:23:47 -0500	[thread overview]
Message-ID: <20081107053350.364655339@polymtl.ca> (raw)
In-Reply-To: <20081107052336.652868737@polymtl.ca>

[-- Attachment #1: sh-trace-clock.patch --]
[-- Type: text/plain, Size: 3779 bytes --]

This patch adds the timestamping mechanism in the trace-clock.h arch header
file. The new timestamp functions use the TMU channel 1.

This code only works if the TMU channel 1 is initialized during the kernel boot.

Big fat warning(TM) from Mathieu Desnoyers :

This patch seems to assume TMU channel 1 is setup at boot. Is it always true on
all SuperH boards ? Is there some Kconfig selection that should be done here ?
Make sure this patch does not break get_cycles on SuperH before merging.

From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Paul Mundt <lethal@linux-sh.org>
CC: linux-sh@vger.kernel.org
---
 arch/sh/Kconfig                   |    2 +
 arch/sh/include/asm/timex.h       |    7 +++-
 arch/sh/include/asm/trace-clock.h |   61 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 2 deletions(-)

Index: linux.trees.git/arch/sh/include/asm/timex.h
===================================================================
--- linux.trees.git.orig/arch/sh/include/asm/timex.h	2008-09-30 11:38:51.000000000 -0400
+++ linux.trees.git/arch/sh/include/asm/timex.h	2008-11-07 00:12:47.000000000 -0500
@@ -6,13 +6,16 @@
 #ifndef __ASM_SH_TIMEX_H
 #define __ASM_SH_TIMEX_H
 
-#define CLOCK_TICK_RATE		(CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */
+#include <linux/io.h>
+#include <asm/cpu/timer.h>
+
+#define CLOCK_TICK_RATE		(HZ * 100000UL)
 
 typedef unsigned long long cycles_t;
 
 static __inline__ cycles_t get_cycles (void)
 {
-	return 0;
+	return 0xffffffff - ctrl_inl(TMU1_TCNT);
 }
 
 #endif /* __ASM_SH_TIMEX_H */
Index: linux.trees.git/arch/sh/Kconfig
===================================================================
--- linux.trees.git.orig/arch/sh/Kconfig	2008-11-07 00:06:06.000000000 -0500
+++ linux.trees.git/arch/sh/Kconfig	2008-11-07 00:12:47.000000000 -0500
@@ -11,6 +11,8 @@ config SUPERH
 	select HAVE_CLK
 	select HAVE_IDE
 	select HAVE_OPROFILE
+	select HAVE_TRACE_CLOCK
+	select HAVE_TRACE_CLOCK_32_TO_64
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_IOREMAP_PROT if MMU
 	help
Index: linux.trees.git/arch/sh/include/asm/trace-clock.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.trees.git/arch/sh/include/asm/trace-clock.h	2008-11-07 00:12:47.000000000 -0500
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2007,2008 Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ *                         Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * Trace clock definitions for SuperH.
+ */
+
+#ifndef _ASM_SH_TRACE_CLOCK_H
+#define _ASM_SH_TRACE_CLOCK_H
+
+#include <linux/timer.h>
+#include <asm/clock.h>
+
+extern u64 trace_clock_read_synthetic_tsc(void);
+
+static inline u32 trace_clock_get_timestamp32(void)
+{
+	return get_cycles();
+}
+
+static inline u64 trace_clock_get_timestamp64(void)
+{
+	return trace_clock_read_synthetic_tsc();
+}
+
+static inline void trace_clock_add_timestamp(unsigned long ticks)
+{ }
+
+static inline unsigned int trace_clock_frequency(void)
+{
+	unsigned long rate;
+	struct clk *tmu1_clk;
+
+	tmu1_clk = clk_get(NULL, "tmu1_clk");
+	rate = clk_get_rate(tmu1_clk);
+
+	return (unsigned int)rate;
+}
+
+static inline u32 trace_clock_freq_scale(void)
+{
+	return 1;
+}
+
+extern void get_synthetic_tsc(void);
+extern void put_synthetic_tsc(void);
+
+static inline void get_trace_clock(void)
+{
+	get_synthetic_tsc();
+}
+
+static inline void put_trace_clock(void)
+{
+	put_synthetic_tsc();
+}
+
+static inline void set_trace_clock_is_sync(int state)
+{
+}
+#endif /* _ASM_SH_TRACE_CLOCK_H */

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  parent reply	other threads:[~2008-11-07  5:46 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07  5:23 [RFC patch 00/18] Trace Clock v2 Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 01/18] get_cycles() : kconfig HAVE_GET_CYCLES Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 02/18] get_cycles() : x86 HAVE_GET_CYCLES Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 03/18] get_cycles() : sparc64 HAVE_GET_CYCLES Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 04/18] get_cycles() : powerpc64 HAVE_GET_CYCLES Mathieu Desnoyers
2008-11-07 14:56   ` Josh Boyer
2008-11-07 18:14     ` Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 05/18] get_cycles() : MIPS HAVE_GET_CYCLES_32 Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 06/18] Trace clock generic Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 07/18] Trace clock core Mathieu Desnoyers
2008-11-07  5:52   ` Andrew Morton
2008-11-07  6:16     ` Mathieu Desnoyers
2008-11-07  6:26       ` Andrew Morton
2008-11-07 16:12         ` Mathieu Desnoyers
2008-11-07 16:19           ` Andrew Morton
2008-11-07 18:16             ` Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 08/18] cnt32_to_63 should use smp_rmb() Mathieu Desnoyers
2008-11-07  6:05   ` Andrew Morton
2008-11-07  8:12     ` Nicolas Pitre
2008-11-07  8:38       ` Andrew Morton
2008-11-07 11:20       ` David Howells
2008-11-07 15:01         ` Nicolas Pitre
2008-11-07 15:50           ` Andrew Morton
2008-11-07 16:47             ` Nicolas Pitre
2008-11-07 17:21               ` Andrew Morton
2008-11-07 20:03                 ` Nicolas Pitre
2008-11-07 16:55             ` David Howells
2008-11-07 16:21           ` David Howells
2008-11-07 16:29             ` Andrew Morton
2008-11-07 17:10             ` David Howells
2008-11-07 17:26               ` Andrew Morton
2008-11-07 18:00                 ` Mathieu Desnoyers
2008-11-07 18:21                   ` Andrew Morton
2008-11-07 18:30                     ` Harvey Harrison
2008-11-07 18:42                       ` Mathieu Desnoyers
2008-11-07 18:33                     ` Mathieu Desnoyers
2008-11-07 18:36                     ` Linus Torvalds
2008-11-07 18:45                       ` Andrew Morton
2008-11-07 16:07         ` David Howells
2008-11-07 16:47         ` Mathieu Desnoyers
2008-11-07 20:11           ` Russell King
2008-11-07 21:36             ` Mathieu Desnoyers
2008-11-07 22:18               ` Russell King
2008-11-07 22:36                 ` Mathieu Desnoyers
2008-11-07 23:41               ` David Howells
2008-11-08  0:15                 ` Russell King
2008-11-08 15:24                   ` Nicolas Pitre
2008-11-08 23:20                     ` [PATCH] clarify usage expectations for cnt32_to_63() Nicolas Pitre
2008-11-09  2:25                       ` Mathieu Desnoyers
2008-11-09  2:54                         ` Nicolas Pitre
2008-11-09  5:06                           ` Nicolas Pitre
2008-11-09  5:27                             ` [PATCH v2] " Nicolas Pitre
2008-11-09  6:48                               ` Mathieu Desnoyers
2008-11-09 13:34                                 ` Nicolas Pitre
2008-11-09 13:43                                   ` Russell King
2008-11-09 16:22                                   ` Mathieu Desnoyers
2008-11-10  4:20                                     ` Nicolas Pitre
2008-11-10  4:42                                       ` Andrew Morton
2008-11-10 21:34                                         ` Nicolas Pitre
2008-11-10 21:58                                           ` Andrew Morton
2008-11-10 23:15                                             ` Nicolas Pitre
2008-11-10 23:22                                               ` Andrew Morton
2008-11-10 23:38                                                 ` Steven Rostedt
2008-11-11  0:26                                                 ` Nicolas Pitre
2008-11-11 18:28                                                   ` [PATCH] convert cnt32_to_63 to inline Mathieu Desnoyers
2008-11-11 19:13                                                     ` Russell King
2008-11-11 20:11                                                       ` Mathieu Desnoyers
2008-11-11 21:51                                                         ` Russell King
2008-11-12  3:48                                                           ` Mathieu Desnoyers
2008-11-11 21:00                                                     ` Nicolas Pitre
2008-11-11 21:13                                                       ` Russell King
2008-11-11 22:31                                                   ` David Howells
2008-11-11 22:37                                                     ` Peter Zijlstra
2008-11-12  1:13                                                       ` Steven Rostedt
2008-11-08  0:45                 ` [RFC patch 08/18] cnt32_to_63 should use smp_rmb() David Howells
2008-11-07 17:04         ` David Howells
2008-11-07 17:17           ` Mathieu Desnoyers
2008-11-07 23:27           ` David Howells
2008-11-07 11:03     ` David Howells
2008-11-07 16:51       ` Mathieu Desnoyers
2008-11-07 20:18         ` Nicolas Pitre
2008-11-07 23:55         ` David Howells
2008-11-07 10:59   ` David Howells
2008-11-07  5:23 ` [RFC patch 09/18] Powerpc : Trace clock Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 10/18] Sparc64 " Mathieu Desnoyers
2008-11-07  5:45   ` David Miller
2008-11-07  5:23 ` Mathieu Desnoyers [this message]
2008-11-07  5:23 ` [RFC patch 12/18] LTTng - TSC synchronicity test Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 13/18] x86 : remove arch-specific tsc_sync.c Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 14/18] MIPS use tsc_sync.c Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 15/18] MIPS : export hpt frequency for trace_clock Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 16/18] MIPS create empty sync_core() Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 17/18] MIPS : Trace clock Mathieu Desnoyers
2008-11-07 11:53   ` Peter Zijlstra
2008-11-07 17:44     ` Mathieu Desnoyers
2008-11-07  5:23 ` [RFC patch 18/18] x86 trace clock Mathieu Desnoyers
2008-11-07 10:55 ` [RFC patch 08/18] cnt32_to_63 should use smp_rmb() David Howells
2008-11-07 17:09   ` Mathieu Desnoyers
2008-11-07 17:33     ` Steven Rostedt
2008-11-07 19:18       ` Mathieu Desnoyers
2008-11-07 19:32         ` Peter Zijlstra
2008-11-07 20:02           ` Mathieu Desnoyers
2008-11-07 20:45             ` Mathieu Desnoyers
2008-11-07 20:54               ` Paul E. McKenney
2008-11-07 21:04                 ` Steven Rostedt
2008-11-08  0:34                   ` Paul E. McKenney
2008-11-07 21:16                 ` Mathieu Desnoyers
2008-11-07 20:08     ` Steven Rostedt
2008-11-07 20:55       ` Paul E. McKenney
2008-11-07 21:27       ` Mathieu Desnoyers
2008-11-07 20:36     ` Nicolas Pitre
2008-11-07 20:55       ` Mathieu Desnoyers
2008-11-07 21:22         ` Nicolas Pitre
2008-11-07 23:50     ` David Howells
2008-11-08  0:55       ` Steven Rostedt
2008-11-09 11:51       ` David Howells
2008-11-09 14:31         ` Steven Rostedt
2008-11-09 16:18         ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081107053350.364655339@polymtl.ca \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peppe.cavallaro@st.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome