ftrace support on m68knommu
RFC PATCH 1/1 ftrace support on m68knommu
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
PATCH 1/1 m68knommu: add FTRACE support
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 <[email protected]> | |--- 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
--- 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(-)
arch/m68knommu/Kconfig +1 -0
@@ -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
arch/m68knommu/kernel/process.c +2 -0
@@ -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 ();
arch/m68knommu/platform/coldfire/entry.S +33 -0
@@ -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
kernel/trace/Kconfig +1 -1
@@ -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
Signature · 1 line
1.5.4.3
Steven Rostedt
maintainerRe: [PATCH] m68knommu: add FTRACE support
kernel/trace/Kconfig config CONTEXT_SWITCH_TRACER · line 104
Quoted 5 lines · Sebastian Siewior
config
DYNAMIC_FTRACEkernel/trace/Kconfig +1
-1bool "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
Quoted 3 lines
kernel/trace/Kconfig +0
-0default y help This option will modify all the calls to ftrace dynamically
PATCH 1/1 m68knommu: add read_barrier_depends() and irqs_disabled_flags()
In reply to 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'
--- include/asm-m68knommu/system.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
include/asm-m68knommu/system.h +11 -0
@@ -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 */
Signature · 1 line
1.5.4.3
PATCH 1/1 ftrace: also dump the entry->flag field
In reply to Sebastian SiewiorThe data is collected anyway so why not print it?
--- kernel/trace/trace.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
kernel/trace/trace.c +8 -1
@@ -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 ;
Signature · 1 line
1.5.4.3
Steven Rostedt
maintainerQuoted 2 lines · Sebastian Siewior
This patch series includes ftrace support on m68knommu and is against ftrace-devel.
Hi Sebastian,
These patches look good! Nice work.
-- Steve