All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] LTTng patches for MIPS CPUs.
@ 2010-04-20  0:19 David Daney
  2010-04-20  0:19 ` [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing David Daney
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: David Daney @ 2010-04-20  0:19 UTC (permalink / raw)
  To: ltt-dev; +Cc: linux-mips, David Daney

After speaking with Mathieu at the Linux Collaboration Summit, I
worked up these patches.  Thanks Mathieu, for helping me with this.

They should be fairly straight forward, the first one enables syscall
entry tracing, the second gives us system call names in lttv, and the
third fixes up the trace clock to work better on Octeon CPUs.

The base of the patch set is the patch-2.6.32.9-lttng-0.198.tar.gz
bundle from the download page on the web site.  The patches are really
only tested on a 64-bit kernel running on a 12 CPU Octeon SOC.  I
think the 32-bit code will compile and is correct, but I have not
tested it.

David Daney (3):
  lttng: MIPS: Fix syscall entry tracing.
  lttng: MIPS: Dump MIPS system call tables.
  lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs.

 arch/mips/Kconfig                   |    5 ++-
 arch/mips/include/asm/trace-clock.h |   39 +++++++++++++++++++++++-
 arch/mips/kernel/scall32-o32.S      |    2 +-
 arch/mips/kernel/scall64-64.S       |    5 ++-
 arch/mips/kernel/scall64-n32.S      |    4 ++-
 arch/mips/kernel/scall64-o32.S      |   10 +++---
 arch/mips/kernel/smp.c              |    2 +
 arch/mips/kernel/syscall.c          |   58 +++++++++++++++++++++++++++++++++++
 8 files changed, 113 insertions(+), 12 deletions(-)

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

* [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing.
  2010-04-20  0:19 [PATCH 0/3] LTTng patches for MIPS CPUs David Daney
@ 2010-04-20  0:19 ` David Daney
  2010-04-20 13:55   ` [ltt-dev] " Mathieu Desnoyers
  2010-04-20  0:19 ` [PATCH 2/3] lttng: MIPS: Dump MIPS system call tables David Daney
  2010-04-20  0:19 ` [PATCH 3/3] lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs David Daney
  2 siblings, 1 reply; 7+ messages in thread
From: David Daney @ 2010-04-20  0:19 UTC (permalink / raw)
  To: ltt-dev; +Cc: linux-mips, David Daney

For the 32-bit kernel and all three ABIs of the 64-bit kernel, we need
to test the _TIF_KERNEL_TRACE flag on syscall entry.  Otherwise, no
syscall entry tracing for you!

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/kernel/scall32-o32.S |    2 +-
 arch/mips/kernel/scall64-64.S  |    2 +-
 arch/mips/kernel/scall64-n32.S |    2 +-
 arch/mips/kernel/scall64-o32.S |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index fd2a9bb..28f262d 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -52,7 +52,7 @@ NESTED(handle_sys, PT_SIZE, sp)
 
 stack_done:
 	lw	t0, TI_FLAGS($28)	# syscall tracing enabled?
-	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
 	and	t0, t1
 	bnez	t0, syscall_trace_entry	# -> yes
 
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 18bf7f3..38c0c95 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -54,7 +54,7 @@ NESTED(handle_sys64, PT_SIZE, sp)
 
 	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
 
-	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
 	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
 	and	t0, t1, t0
 	bnez	t0, syscall_trace_entry
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 3541fd3..fbecc01 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -53,7 +53,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
 
 	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
 
-	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
 	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
 	and	t0, t1, t0
 	bnez	t0, n32_syscall_trace_entry
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 14dde4c..0db5589 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -81,7 +81,7 @@ NESTED(handle_sys, PT_SIZE, sp)
 	PTR	4b, bad_stack
 	.previous
 
-	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
 	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
 	and	t0, t1, t0
 	bnez	t0, trace_a_syscall
-- 
1.6.6.1

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

* [PATCH 2/3] lttng: MIPS: Dump MIPS system call tables.
  2010-04-20  0:19 [PATCH 0/3] LTTng patches for MIPS CPUs David Daney
  2010-04-20  0:19 ` [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing David Daney
@ 2010-04-20  0:19 ` David Daney
  2010-04-20 13:56   ` [ltt-dev] " Mathieu Desnoyers
  2010-04-20  0:19 ` [PATCH 3/3] lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs David Daney
  2 siblings, 1 reply; 7+ messages in thread
From: David Daney @ 2010-04-20  0:19 UTC (permalink / raw)
  To: ltt-dev; +Cc: linux-mips, David Daney

The 64-bit kernel may support all three ABIs, so we iterate the
sys_call_tables of all of enabled ABIs.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/Kconfig              |    1 +
 arch/mips/kernel/scall64-64.S  |    3 +-
 arch/mips/kernel/scall64-n32.S |    2 +
 arch/mips/kernel/scall64-o32.S |    8 +++---
 arch/mips/kernel/syscall.c     |   58 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 5e1133f..a690e9b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -8,6 +8,7 @@ config MIPS
 	# Horrible source of confusion.  Die, die, die ...
 	select EMBEDDED
 	select RTC_LIB if !LEMOTE_FULOONG2E
+	select HAVE_LTT_DUMP_TABLES
 
 mainmenu "Linux/MIPS Kernel Configuration"
 
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 38c0c95..f437a01 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -125,7 +125,8 @@ illegal_syscall:
 	END(handle_sys64)
 
 	.align	3
-sys_call_table:
+	.type	sys_call_table,@object
+EXPORT(sys_call_table)	
 	PTR	sys_read			/* 5000 */
 	PTR	sys_write
 	PTR	sys_open
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index fbecc01..49ab15a 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -119,6 +119,8 @@ not_n32_scall:
 
 	END(handle_sysn32)
 
+	.align	3
+	.type	sysn32_call_table,@object
 EXPORT(sysn32_call_table)
 	PTR	sys_read			/* 6000 */
 	PTR	sys_write
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 0db5589..01500cb 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -53,7 +53,7 @@ NESTED(handle_sys, PT_SIZE, sp)
 	sll	a3, a3, 0
 
 	dsll	t0, v0, 3		# offset into table
-	ld	t2, (sys_call_table - (__NR_O32_Linux * 8))(t0)
+	ld	t2, (syso32_call_table - (__NR_O32_Linux * 8))(t0)
 
 	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
 
@@ -179,7 +179,7 @@ LEAF(sys32_syscall)
 	beqz	t0, einval		# do not recurse
 	dsll	t1, t0, 3
 	beqz	v0, einval
-	ld	t2, sys_call_table(t1)		# syscall routine
+	ld	t2, syso32_call_table(t1)	# syscall routine
 
 	move	a0, a1			# shift argument registers
 	move	a1, a2
@@ -201,8 +201,8 @@ einval:	li	v0, -ENOSYS
 	END(sys32_syscall)
 
 	.align	3
-	.type	sys_call_table,@object
-sys_call_table:
+	.type	syso32_call_table,@object
+EXPORT(syso32_call_table)
 	PTR	sys32_syscall			/* 4000 */
 	PTR	sys_exit
 	PTR	sys_fork
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 1452e2f..996ef29 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/ipc.h>
 #include <linux/uaccess.h>
+#include <linux/kallsyms.h>
 #include <trace/ipc.h>
 
 #include <asm/asm.h>
@@ -560,3 +561,60 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
 
 	return -__v0;
 }
+
+void ltt_dump_sys_call_table(void *call_data)
+{
+	int i;
+	char namebuf[KSYM_NAME_LEN];
+
+#ifdef CONFIG_32BIT
+	extern struct {
+		unsigned long ptr;
+		long j;
+	} sys_call_table[];
+	for (i = 0; i < __NR_O32_Linux_syscalls; i++) {
+		sprint_symbol(namebuf, sys_call_table[i].ptr);
+		__trace_mark(0, syscall_state, sys_call_table, call_data,
+			"id %d address %p symbol %s",
+			i + __NR_O32_Linux, (void*)sys_call_table[i].ptr, namebuf);
+	}
+#endif
+#ifdef CONFIG_64BIT
+# ifdef CONFIG_MIPS32_O32
+	for (i = 0; i < __NR_O32_Linux_syscalls; i++) {
+		extern unsigned long syso32_call_table[];
+		sprint_symbol(namebuf, syso32_call_table[i]);
+		__trace_mark(0, syscall_state, sys_call_table, call_data,
+			"id %d address %p symbol %s",
+			i + __NR_O32_Linux, (void*)syso32_call_table[i], namebuf);
+	}
+# endif
+
+	for (i = 0; i < __NR_64_Linux_syscalls; i++) {
+		extern unsigned long sys_call_table[];
+		sprint_symbol(namebuf, sys_call_table[i]);
+		__trace_mark(0, syscall_state, sys_call_table, call_data,
+			"id %d address %p symbol %s",
+			i + __NR_64_Linux, (void*)sys_call_table[i], namebuf);
+	}
+
+# ifdef CONFIG_MIPS32_N32
+	for (i = 0; i < __NR_N32_Linux_syscalls; i++) {
+		extern unsigned long sysn32_call_table[];
+		sprint_symbol(namebuf, sysn32_call_table[i]);
+		__trace_mark(0, syscall_state, sys_call_table, call_data,
+			"id %d address %p symbol %s",
+			i + __NR_N32_Linux, (void*)sysn32_call_table[i], namebuf);
+	}
+# endif
+#endif
+
+}
+EXPORT_SYMBOL_GPL(ltt_dump_sys_call_table);
+
+void ltt_dump_idt_table(void *call_data)
+{
+	/* No IDT information yet.  */
+	return;
+}
+EXPORT_SYMBOL_GPL(ltt_dump_idt_table);
-- 
1.6.6.1

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

* [PATCH 3/3] lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs.
  2010-04-20  0:19 [PATCH 0/3] LTTng patches for MIPS CPUs David Daney
  2010-04-20  0:19 ` [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing David Daney
  2010-04-20  0:19 ` [PATCH 2/3] lttng: MIPS: Dump MIPS system call tables David Daney
@ 2010-04-20  0:19 ` David Daney
  2010-04-20 13:56   ` [ltt-dev] " Mathieu Desnoyers
  2 siblings, 1 reply; 7+ messages in thread
From: David Daney @ 2010-04-20  0:19 UTC (permalink / raw)
  To: ltt-dev; +Cc: linux-mips, David Daney

Cavium Octeon CPUs have a 64-bit cycle counter that is synchronized
when the CPUs are brought on-line.  So for this case we don't need any
fancy stuff.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/Kconfig                   |    4 +-
 arch/mips/include/asm/trace-clock.h |   39 ++++++++++++++++++++++++++++++++++-
 arch/mips/kernel/smp.c              |    2 +
 3 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a690e9b..9e91e8c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1782,8 +1782,8 @@ config HAVE_GET_CYCLES_32
 	def_bool y
 	depends on !CPU_R4400_WORKAROUNDS
 	select HAVE_TRACE_CLOCK
-	select HAVE_TRACE_CLOCK_32_TO_64
-	select HAVE_UNSYNCHRONIZED_TSC
+	select HAVE_TRACE_CLOCK_32_TO_64 if (!CPU_CAVIUM_OCTEON)
+	select HAVE_UNSYNCHRONIZED_TSC if (!CPU_CAVIUM_OCTEON)
 
 #
 # Use the generic interrupt handling code in kernel/irq/:
diff --git a/arch/mips/include/asm/trace-clock.h b/arch/mips/include/asm/trace-clock.h
index 3d8cb0f..a052f42 100644
--- a/arch/mips/include/asm/trace-clock.h
+++ b/arch/mips/include/asm/trace-clock.h
@@ -12,6 +12,43 @@
 
 #define TRACE_CLOCK_MIN_PROBE_DURATION 200
 
+#ifdef CONFIG_CPU_CAVIUM_OCTEON
+
+#include <asm/octeon/octeon.h>
+
+#define TC_HW_BITS			64
+
+static inline u32 trace_clock_read32(void)
+{
+	return (u32)read_c0_cvmcount(); /* only need the 32 LSB */
+}
+
+static inline u64 trace_clock_read64(void)
+{
+	return read_c0_cvmcount();
+}
+
+static inline u64 trace_clock_frequency(void)
+{
+	return octeon_get_clock_rate();
+}
+
+static inline u32 trace_clock_freq_scale(void)
+{
+	return 1;
+}
+
+static inline void get_trace_clock(void)
+{
+	return;
+}
+
+static inline void put_trace_clock(void)
+{
+	return;
+}
+
+#else /* !CONFIG_CPU_CAVIUM_OCTEON */
 /*
  * Number of hardware clock bits. The higher order bits are expected to be 0.
  * If the hardware clock source has more than 32 bits, the bits higher than the
@@ -65,7 +102,7 @@ static inline void put_trace_clock(void)
 {
 	put_synthetic_tsc();
 }
-
+#endif /* CONFIG_CPU_CAVIUM_OCTEON */
 static inline void set_trace_clock_is_sync(int state)
 {
 }
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index f8c50d1..42083eb 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -159,7 +159,9 @@ void __init smp_cpus_done(unsigned int max_cpus)
 {
 	mp_ops->cpus_done();
 	synchronise_count_master();
+#ifdef CONFIG_HAVE_UNSYNCHRONIZED_TSC
 	test_tsc_synchronization();
+#endif
 }
 
 /* called from main before smp_init() */
-- 
1.6.6.1

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

* Re: [ltt-dev] [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing.
  2010-04-20  0:19 ` [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing David Daney
@ 2010-04-20 13:55   ` Mathieu Desnoyers
  0 siblings, 0 replies; 7+ messages in thread
From: Mathieu Desnoyers @ 2010-04-20 13:55 UTC (permalink / raw)
  To: David Daney; +Cc: ltt-dev, linux-mips

* David Daney (ddaney@caviumnetworks.com) wrote:
> For the 32-bit kernel and all three ABIs of the 64-bit kernel, we need
> to test the _TIF_KERNEL_TRACE flag on syscall entry.  Otherwise, no
> syscall entry tracing for you!

Merged into the LTTng tree, thanks !

Mathieu

> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
>  arch/mips/kernel/scall32-o32.S |    2 +-
>  arch/mips/kernel/scall64-64.S  |    2 +-
>  arch/mips/kernel/scall64-n32.S |    2 +-
>  arch/mips/kernel/scall64-o32.S |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
> index fd2a9bb..28f262d 100644
> --- a/arch/mips/kernel/scall32-o32.S
> +++ b/arch/mips/kernel/scall32-o32.S
> @@ -52,7 +52,7 @@ NESTED(handle_sys, PT_SIZE, sp)
>  
>  stack_done:
>  	lw	t0, TI_FLAGS($28)	# syscall tracing enabled?
> -	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
> +	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
>  	and	t0, t1
>  	bnez	t0, syscall_trace_entry	# -> yes
>  
> diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
> index 18bf7f3..38c0c95 100644
> --- a/arch/mips/kernel/scall64-64.S
> +++ b/arch/mips/kernel/scall64-64.S
> @@ -54,7 +54,7 @@ NESTED(handle_sys64, PT_SIZE, sp)
>  
>  	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
>  
> -	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
> +	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
>  	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
>  	and	t0, t1, t0
>  	bnez	t0, syscall_trace_entry
> diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
> index 3541fd3..fbecc01 100644
> --- a/arch/mips/kernel/scall64-n32.S
> +++ b/arch/mips/kernel/scall64-n32.S
> @@ -53,7 +53,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
>  
>  	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
>  
> -	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
> +	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
>  	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
>  	and	t0, t1, t0
>  	bnez	t0, n32_syscall_trace_entry
> diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
> index 14dde4c..0db5589 100644
> --- a/arch/mips/kernel/scall64-o32.S
> +++ b/arch/mips/kernel/scall64-o32.S
> @@ -81,7 +81,7 @@ NESTED(handle_sys, PT_SIZE, sp)
>  	PTR	4b, bad_stack
>  	.previous
>  
> -	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
> +	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_KERNEL_TRACE
>  	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
>  	and	t0, t1, t0
>  	bnez	t0, trace_a_syscall
> -- 
> 1.6.6.1
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev@lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

* Re: [ltt-dev] [PATCH 2/3] lttng: MIPS: Dump MIPS system call tables.
  2010-04-20  0:19 ` [PATCH 2/3] lttng: MIPS: Dump MIPS system call tables David Daney
@ 2010-04-20 13:56   ` Mathieu Desnoyers
  0 siblings, 0 replies; 7+ messages in thread
From: Mathieu Desnoyers @ 2010-04-20 13:56 UTC (permalink / raw)
  To: David Daney; +Cc: ltt-dev, linux-mips

* David Daney (ddaney@caviumnetworks.com) wrote:
> The 64-bit kernel may support all three ABIs, so we iterate the
> sys_call_tables of all of enabled ABIs.

Merged into the LTTng tree, with some coding style cleanups. Thanks!

Mathieu

> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
>  arch/mips/Kconfig              |    1 +
>  arch/mips/kernel/scall64-64.S  |    3 +-
>  arch/mips/kernel/scall64-n32.S |    2 +
>  arch/mips/kernel/scall64-o32.S |    8 +++---
>  arch/mips/kernel/syscall.c     |   58 ++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 67 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 5e1133f..a690e9b 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -8,6 +8,7 @@ config MIPS
>  	# Horrible source of confusion.  Die, die, die ...
>  	select EMBEDDED
>  	select RTC_LIB if !LEMOTE_FULOONG2E
> +	select HAVE_LTT_DUMP_TABLES
>  
>  mainmenu "Linux/MIPS Kernel Configuration"
>  
> diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
> index 38c0c95..f437a01 100644
> --- a/arch/mips/kernel/scall64-64.S
> +++ b/arch/mips/kernel/scall64-64.S
> @@ -125,7 +125,8 @@ illegal_syscall:
>  	END(handle_sys64)
>  
>  	.align	3
> -sys_call_table:
> +	.type	sys_call_table,@object
> +EXPORT(sys_call_table)	
>  	PTR	sys_read			/* 5000 */
>  	PTR	sys_write
>  	PTR	sys_open
> diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
> index fbecc01..49ab15a 100644
> --- a/arch/mips/kernel/scall64-n32.S
> +++ b/arch/mips/kernel/scall64-n32.S
> @@ -119,6 +119,8 @@ not_n32_scall:
>  
>  	END(handle_sysn32)
>  
> +	.align	3
> +	.type	sysn32_call_table,@object
>  EXPORT(sysn32_call_table)
>  	PTR	sys_read			/* 6000 */
>  	PTR	sys_write
> diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
> index 0db5589..01500cb 100644
> --- a/arch/mips/kernel/scall64-o32.S
> +++ b/arch/mips/kernel/scall64-o32.S
> @@ -53,7 +53,7 @@ NESTED(handle_sys, PT_SIZE, sp)
>  	sll	a3, a3, 0
>  
>  	dsll	t0, v0, 3		# offset into table
> -	ld	t2, (sys_call_table - (__NR_O32_Linux * 8))(t0)
> +	ld	t2, (syso32_call_table - (__NR_O32_Linux * 8))(t0)
>  
>  	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
>  
> @@ -179,7 +179,7 @@ LEAF(sys32_syscall)
>  	beqz	t0, einval		# do not recurse
>  	dsll	t1, t0, 3
>  	beqz	v0, einval
> -	ld	t2, sys_call_table(t1)		# syscall routine
> +	ld	t2, syso32_call_table(t1)	# syscall routine
>  
>  	move	a0, a1			# shift argument registers
>  	move	a1, a2
> @@ -201,8 +201,8 @@ einval:	li	v0, -ENOSYS
>  	END(sys32_syscall)
>  
>  	.align	3
> -	.type	sys_call_table,@object
> -sys_call_table:
> +	.type	syso32_call_table,@object
> +EXPORT(syso32_call_table)
>  	PTR	sys32_syscall			/* 4000 */
>  	PTR	sys_exit
>  	PTR	sys_fork
> diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
> index 1452e2f..996ef29 100644
> --- a/arch/mips/kernel/syscall.c
> +++ b/arch/mips/kernel/syscall.c
> @@ -29,6 +29,7 @@
>  #include <linux/module.h>
>  #include <linux/ipc.h>
>  #include <linux/uaccess.h>
> +#include <linux/kallsyms.h>
>  #include <trace/ipc.h>
>  
>  #include <asm/asm.h>
> @@ -560,3 +561,60 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
>  
>  	return -__v0;
>  }
> +
> +void ltt_dump_sys_call_table(void *call_data)
> +{
> +	int i;
> +	char namebuf[KSYM_NAME_LEN];
> +
> +#ifdef CONFIG_32BIT
> +	extern struct {
> +		unsigned long ptr;
> +		long j;
> +	} sys_call_table[];
> +	for (i = 0; i < __NR_O32_Linux_syscalls; i++) {
> +		sprint_symbol(namebuf, sys_call_table[i].ptr);
> +		__trace_mark(0, syscall_state, sys_call_table, call_data,
> +			"id %d address %p symbol %s",
> +			i + __NR_O32_Linux, (void*)sys_call_table[i].ptr, namebuf);
> +	}
> +#endif
> +#ifdef CONFIG_64BIT
> +# ifdef CONFIG_MIPS32_O32
> +	for (i = 0; i < __NR_O32_Linux_syscalls; i++) {
> +		extern unsigned long syso32_call_table[];
> +		sprint_symbol(namebuf, syso32_call_table[i]);
> +		__trace_mark(0, syscall_state, sys_call_table, call_data,
> +			"id %d address %p symbol %s",
> +			i + __NR_O32_Linux, (void*)syso32_call_table[i], namebuf);
> +	}
> +# endif
> +
> +	for (i = 0; i < __NR_64_Linux_syscalls; i++) {
> +		extern unsigned long sys_call_table[];
> +		sprint_symbol(namebuf, sys_call_table[i]);
> +		__trace_mark(0, syscall_state, sys_call_table, call_data,
> +			"id %d address %p symbol %s",
> +			i + __NR_64_Linux, (void*)sys_call_table[i], namebuf);
> +	}
> +
> +# ifdef CONFIG_MIPS32_N32
> +	for (i = 0; i < __NR_N32_Linux_syscalls; i++) {
> +		extern unsigned long sysn32_call_table[];
> +		sprint_symbol(namebuf, sysn32_call_table[i]);
> +		__trace_mark(0, syscall_state, sys_call_table, call_data,
> +			"id %d address %p symbol %s",
> +			i + __NR_N32_Linux, (void*)sysn32_call_table[i], namebuf);
> +	}
> +# endif
> +#endif
> +
> +}
> +EXPORT_SYMBOL_GPL(ltt_dump_sys_call_table);
> +
> +void ltt_dump_idt_table(void *call_data)
> +{
> +	/* No IDT information yet.  */
> +	return;
> +}
> +EXPORT_SYMBOL_GPL(ltt_dump_idt_table);
> -- 
> 1.6.6.1
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev@lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

* Re: [ltt-dev] [PATCH 3/3] lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs.
  2010-04-20  0:19 ` [PATCH 3/3] lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs David Daney
@ 2010-04-20 13:56   ` Mathieu Desnoyers
  0 siblings, 0 replies; 7+ messages in thread
From: Mathieu Desnoyers @ 2010-04-20 13:56 UTC (permalink / raw)
  To: David Daney; +Cc: ltt-dev, linux-mips

* David Daney (ddaney@caviumnetworks.com) wrote:
> Cavium Octeon CPUs have a 64-bit cycle counter that is synchronized
> when the CPUs are brought on-line.  So for this case we don't need any
> fancy stuff.

Merged into the LTTng tree, with refactoring of the Octeon-specific
header file code into a new arch/mips/include/asm/octeon/trace-clock.h
file.

Thanks!

Mathieu

> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
>  arch/mips/Kconfig                   |    4 +-
>  arch/mips/include/asm/trace-clock.h |   39 ++++++++++++++++++++++++++++++++++-
>  arch/mips/kernel/smp.c              |    2 +
>  3 files changed, 42 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index a690e9b..9e91e8c 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -1782,8 +1782,8 @@ config HAVE_GET_CYCLES_32
>  	def_bool y
>  	depends on !CPU_R4400_WORKAROUNDS
>  	select HAVE_TRACE_CLOCK
> -	select HAVE_TRACE_CLOCK_32_TO_64
> -	select HAVE_UNSYNCHRONIZED_TSC
> +	select HAVE_TRACE_CLOCK_32_TO_64 if (!CPU_CAVIUM_OCTEON)
> +	select HAVE_UNSYNCHRONIZED_TSC if (!CPU_CAVIUM_OCTEON)
>  
>  #
>  # Use the generic interrupt handling code in kernel/irq/:
> diff --git a/arch/mips/include/asm/trace-clock.h b/arch/mips/include/asm/trace-clock.h
> index 3d8cb0f..a052f42 100644
> --- a/arch/mips/include/asm/trace-clock.h
> +++ b/arch/mips/include/asm/trace-clock.h
> @@ -12,6 +12,43 @@
>  
>  #define TRACE_CLOCK_MIN_PROBE_DURATION 200
>  
> +#ifdef CONFIG_CPU_CAVIUM_OCTEON
> +
> +#include <asm/octeon/octeon.h>
> +
> +#define TC_HW_BITS			64
> +
> +static inline u32 trace_clock_read32(void)
> +{
> +	return (u32)read_c0_cvmcount(); /* only need the 32 LSB */
> +}
> +
> +static inline u64 trace_clock_read64(void)
> +{
> +	return read_c0_cvmcount();
> +}
> +
> +static inline u64 trace_clock_frequency(void)
> +{
> +	return octeon_get_clock_rate();
> +}
> +
> +static inline u32 trace_clock_freq_scale(void)
> +{
> +	return 1;
> +}
> +
> +static inline void get_trace_clock(void)
> +{
> +	return;
> +}
> +
> +static inline void put_trace_clock(void)
> +{
> +	return;
> +}
> +
> +#else /* !CONFIG_CPU_CAVIUM_OCTEON */
>  /*
>   * Number of hardware clock bits. The higher order bits are expected to be 0.
>   * If the hardware clock source has more than 32 bits, the bits higher than the
> @@ -65,7 +102,7 @@ static inline void put_trace_clock(void)
>  {
>  	put_synthetic_tsc();
>  }
> -
> +#endif /* CONFIG_CPU_CAVIUM_OCTEON */
>  static inline void set_trace_clock_is_sync(int state)
>  {
>  }
> diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> index f8c50d1..42083eb 100644
> --- a/arch/mips/kernel/smp.c
> +++ b/arch/mips/kernel/smp.c
> @@ -159,7 +159,9 @@ void __init smp_cpus_done(unsigned int max_cpus)
>  {
>  	mp_ops->cpus_done();
>  	synchronise_count_master();
> +#ifdef CONFIG_HAVE_UNSYNCHRONIZED_TSC
>  	test_tsc_synchronization();
> +#endif
>  }
>  
>  /* called from main before smp_init() */
> -- 
> 1.6.6.1
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev@lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

end of thread, other threads:[~2010-04-20 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-20  0:19 [PATCH 0/3] LTTng patches for MIPS CPUs David Daney
2010-04-20  0:19 ` [PATCH 1/3] lttng: MIPS: Fix syscall entry tracing David Daney
2010-04-20 13:55   ` [ltt-dev] " Mathieu Desnoyers
2010-04-20  0:19 ` [PATCH 2/3] lttng: MIPS: Dump MIPS system call tables David Daney
2010-04-20 13:56   ` [ltt-dev] " Mathieu Desnoyers
2010-04-20  0:19 ` [PATCH 3/3] lttng: MIPS: Use 64 bit counter for trace clock on Octeon CPUs David Daney
2010-04-20 13:56   ` [ltt-dev] " Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.