linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC / PATCH] ftrace support on m68knommu
@ 2008-05-13 16:52 Sebastian Siewior
  2008-05-13 16:52 ` [PATCH] m68knommu: add FTRACE support Sebastian Siewior
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sebastian Siewior @ 2008-05-13 16:52 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Greg Ungerer, uclinux-dev, linux-kernel


Hi Ingo, Greg,

This patch series includes ftrace support on m68knommu and is against
ftrace-devel. 

Ingo: irq flags aren't conditional so I guess this is one of the things
that an arch has to implement (patch #2). In that case you can dump the
status as well couldn't you (patch #3)? I'm not sure but it is possible
that I mixed up the IRQs OFF & ON thing :)

These patches were function tested and compile-only-tested after porting
to ftrace-devel.

Sebastian

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

* [PATCH] m68knommu: add FTRACE support
  2008-05-13 16:52 [RFC / PATCH] ftrace support on m68knommu Sebastian Siewior
@ 2008-05-13 16:52 ` Sebastian Siewior
  2008-05-16 13:02   ` Steven Rostedt
  2008-05-13 16:52 ` [PATCH] m68knommu: add read_barrier_depends() and irqs_disabled_flags() Sebastian Siewior
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Sebastian Siewior @ 2008-05-13 16:52 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Greg Ungerer, uclinux-dev, linux-kernel, Sebastian Siewior

due to a gcc bug or feature, the following patch has to be applied to gcc:

|m68k: remove label generation on -pg
|
|haven't found a reason why this flag is needed. Maybe glibc needs this label.
|However this implementation puts the labels too far away.
|
|Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
|
|--- a/gcc/config/m68k/linux.h
|+++ b/gcc/config/m68k/linux.h
|@@ -143,7 +143,6 @@ along with GCC; see the file COPYING3.
| #undef FUNCTION_PROFILER
| #define FUNCTION_PROFILER(FILE, LABELNO) \
| {                                                                     \
|-  asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO));                \
|   if (flag_pic)                                                               \
|     fprintf (FILE, "\tbsr.l _mcount@PLTPC\n");                                \
|   else                                                                        \
|--- a/gcc/config/m68k/m68k.h
|+++ b/gcc/config/m68k/m68k.h
|@@ -576,7 +576,7 @@ extern enum reg_class regno_reg_class[];
| #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
|
| #define FUNCTION_PROFILER(FILE, LABELNO)  \
|-  asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
|+  asm_fprintf (FILE, "\tjsr mcount\n", (LABELNO))
|
| #define EXIT_IGNORE_STACK 1
|

GCC bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36047

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
---
 arch/m68knommu/Kconfig                   |    1 +
 arch/m68knommu/kernel/process.c          |    2 +
 arch/m68knommu/platform/coldfire/entry.S |   33 ++++++++++++++++++++++++++++++
 kernel/trace/Kconfig                     |    2 +-
 4 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 07eb4c4..90ce97b 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -166,6 +166,7 @@ config M527x
 config COLDFIRE
 	bool
 	depends on (M5206 || M5206e || M520x || M523x || M5249 || M527x || M5272 || M528x || M5307 || M532x || M5407)
+	select HAVE_FTRACE
 	default y
 
 config CLOCK_SET
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 47502d5..57678a5 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -74,7 +74,9 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
+		stop_critical_timings();
 		idle();
+		start_critical_timings();
 		preempt_enable_no_resched();
 		schedule();
 		preempt_disable();
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S
index 111b66d..0301a80 100644
--- a/arch/m68knommu/platform/coldfire/entry.S
+++ b/arch/m68knommu/platform/coldfire/entry.S
@@ -55,6 +55,39 @@ sw_usp:
 .globl inthandler
 .globl fasthandler
 
+#ifdef CONFIG_FTRACE
+ENTRY(_mcount)
+	linkw	%fp, #0
+
+	moveal	ftrace_trace_function, %a0
+	movel	#ftrace_stub, %d0
+	cmpl	%a0@, %d0
+
+	bnew	do_mcount
+
+	unlk	%fp
+	rts
+
+do_mcount:
+
+	movel	%fp, %d0
+	moveal	%d0, %a1
+
+	moveal	%a1@, %a0
+	movel	%a0@(4), %sp@-	/* push parent ip */
+	movel	%a1@(4), %sp@-	/* push ip */
+
+	moveal	ftrace_trace_function, %a0
+	jsr	%a0@
+
+	unlk %fp
+
+.globl ftrace_stub
+ftrace_stub:
+	rts
+END(mcount)
+#endif
+
 enosys:
 	mov.l	#sys_ni_syscall,%d3
 	bra	1f
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index c93446e..deaa9a5 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -101,7 +101,7 @@ config CONTEXT_SWITCH_TRACER
 
 config DYNAMIC_FTRACE
 	bool "enable/disable ftrace tracepoints dynamically"
-	depends on FTRACE
+	depends on FTRACE && !COLDFIRE
 	default y
 	help
          This option will modify all the calls to ftrace dynamically
-- 
1.5.4.3


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

* [PATCH] m68knommu: add read_barrier_depends() and irqs_disabled_flags()
  2008-05-13 16:52 [RFC / PATCH] ftrace support on m68knommu Sebastian Siewior
  2008-05-13 16:52 ` [PATCH] m68knommu: add FTRACE support Sebastian Siewior
@ 2008-05-13 16:52 ` Sebastian Siewior
  2008-05-13 16:52 ` [PATCH] ftrace: also dump the entry->flag field Sebastian Siewior
  2008-05-16 12:59 ` [RFC / PATCH] ftrace support on m68knommu Steven Rostedt
  3 siblings, 0 replies; 6+ messages in thread
From: Sebastian Siewior @ 2008-05-13 16:52 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Greg Ungerer, uclinux-dev, linux-kernel, Sebastian Siewior

/home/bigeasy/git/linux-2.6-ftrace/kernel/trace/trace.c: In function 'tracing_generic_entry_update':
/home/bigeasy/git/linux-2.6-ftrace/kernel/trace/trace.c:802: error: implicit declaration of function 'irqs_disabled_flags'
make[3]: *** [kernel/trace/trace.o] Error 1
/home/bigeasy/git/linux-2.6-ftrace/kernel/trace/ftrace.c: In function 'ftrace_list_func':
/home/bigeasy/git/linux-2.6-ftrace/kernel/trace/ftrace.c:61: error: implicit declaration of function 'read_barrier_depends'

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
---
 include/asm-m68knommu/system.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index 64c6443..40f49de 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -118,6 +118,8 @@ asmlinkage void resume(void);
 #define smp_read_barrier_depends()	do { } while(0)
 #endif
 
+#define read_barrier_depends()  ((void)0)
+
 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
 
 struct __xchg_dummy { unsigned long a[100]; };
@@ -310,4 +312,13 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
 #endif
 #define arch_align_stack(x) (x)
 
+
+static inline int irqs_disabled_flags(unsigned long flags)
+{
+	if (flags & 0x0700)
+		return 0;
+	else
+		return 1;
+}
+
 #endif /* _M68KNOMMU_SYSTEM_H */
-- 
1.5.4.3


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

* [PATCH] ftrace: also dump the entry->flag field
  2008-05-13 16:52 [RFC / PATCH] ftrace support on m68knommu Sebastian Siewior
  2008-05-13 16:52 ` [PATCH] m68knommu: add FTRACE support Sebastian Siewior
  2008-05-13 16:52 ` [PATCH] m68knommu: add read_barrier_depends() and irqs_disabled_flags() Sebastian Siewior
@ 2008-05-13 16:52 ` Sebastian Siewior
  2008-05-16 12:59 ` [RFC / PATCH] ftrace support on m68knommu Steven Rostedt
  3 siblings, 0 replies; 6+ messages in thread
From: Sebastian Siewior @ 2008-05-13 16:52 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Greg Ungerer, uclinux-dev, linux-kernel, Sebastian Siewior

The data is collected anyway so why not print it?

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
---
 kernel/trace/trace.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 06c85b3..0b0e996 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1514,7 +1514,14 @@ static int print_trace_fmt(struct trace_iterator *iter)
 	ret = trace_seq_printf(s, "[%02d] ", iter->cpu);
 	if (!ret)
 		return 0;
-	ret = trace_seq_printf(s, "%5lu.%06lu: ", secs, usec_rem);
+	ret = trace_seq_printf(s, "%5lu.%06lu ", secs, usec_rem);
+	if (!ret)
+		return 0;
+	ret = trace_seq_printf(s, "{%2u|%c%c%c%c}: ", entry->preempt_count,
+			entry->flags & TRACE_FLAG_IRQS_OFF      ? '.' : 'I',
+			entry->flags & TRACE_FLAG_NEED_RESCHED  ? 'R' : '.',
+			entry->flags & TRACE_FLAG_HARDIRQ       ? 'H' : '.',
+			entry->flags & TRACE_FLAG_SOFTIRQ       ? 'S' : '.');
 	if (!ret)
 		return 0;
 
-- 
1.5.4.3


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

* Re: [RFC / PATCH] ftrace support on m68knommu
  2008-05-13 16:52 [RFC / PATCH] ftrace support on m68knommu Sebastian Siewior
                   ` (2 preceding siblings ...)
  2008-05-13 16:52 ` [PATCH] ftrace: also dump the entry->flag field Sebastian Siewior
@ 2008-05-16 12:59 ` Steven Rostedt
  3 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-16 12:59 UTC (permalink / raw)
  To: Sebastian Siewior; +Cc: Ingo Molnar, Greg Ungerer, uclinux-dev, linux-kernel

On Tue, May 13, 2008 at 06:52:42PM +0200, Sebastian Siewior wrote:
> This patch series includes ftrace support on m68knommu and is against
> ftrace-devel. 

Hi Sebastian,

These patches look good!  Nice work.

-- Steve


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

* Re: [PATCH] m68knommu: add FTRACE support
  2008-05-13 16:52 ` [PATCH] m68knommu: add FTRACE support Sebastian Siewior
@ 2008-05-16 13:02   ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-16 13:02 UTC (permalink / raw)
  To: Sebastian Siewior; +Cc: Ingo Molnar, Greg Ungerer, uclinux-dev, linux-kernel

On Tue, May 13, 2008 at 06:52:43PM +0200, Sebastian Siewior wrote:
>  
>  config DYNAMIC_FTRACE
>  	bool "enable/disable ftrace tracepoints dynamically"
> -	depends on FTRACE
> +	depends on FTRACE && !COLDFIRE

I think we really need to add a HAVE_DYNAMIC_FTRACE config for archs to
say that this is supported. Otherwise I imagine that we'll have a list
of archs here.

I'll write up a patch today.

-- Steve



>  	default y
>  	help
>           This option will modify all the calls to ftrace dynamically

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

end of thread, other threads:[~2008-05-16 13:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-13 16:52 [RFC / PATCH] ftrace support on m68knommu Sebastian Siewior
2008-05-13 16:52 ` [PATCH] m68knommu: add FTRACE support Sebastian Siewior
2008-05-16 13:02   ` Steven Rostedt
2008-05-13 16:52 ` [PATCH] m68knommu: add read_barrier_depends() and irqs_disabled_flags() Sebastian Siewior
2008-05-13 16:52 ` [PATCH] ftrace: also dump the entry->flag field Sebastian Siewior
2008-05-16 12:59 ` [RFC / PATCH] ftrace support on m68knommu Steven Rostedt

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).