From 1fda83d83c664ad74bfec8ce093a86d4d962f093 Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Fri, 9 May 2008 16:13:36 +0200 Subject: m68knommu: m68knommu: add old stack trace method The old method is used when frame pointers are not available. Also fix formating with CONFIG_KALLSYMS=n which eliminates \n. Signed-off-by: Sebastian Siewior Signed-off-by: Greg Ungerer --- arch/m68knommu/kernel/traps.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'arch/m68knommu/kernel') diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c index ec9aea652e7..46f8f9d0c40 100644 --- a/arch/m68knommu/kernel/traps.c +++ b/arch/m68knommu/kernel/traps.c @@ -103,12 +103,28 @@ asmlinkage void buserr_c(struct frame *fp) force_sig(SIGSEGV, current); } +static void print_this_address(unsigned long addr, int i) +{ +#ifdef CONFIG_KALLSYMS + printk(KERN_EMERG " [%08lx] ", addr); + print_symbol(KERN_CONT "%s\n", addr); +#else + if (i % 5) + printk(KERN_CONT " [%08lx] ", addr); + else + printk(KERN_CONT "\n" KERN_EMERG " [%08lx] ", addr); + i++; +#endif +} + int kstack_depth_to_print = 48; static void __show_stack(struct task_struct *task, unsigned long *stack) { unsigned long *endstack, addr; +#ifdef CONFIG_FRAME_POINTER unsigned long *last_stack; +#endif int i; if (!stack) @@ -126,6 +142,7 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) printk(" %08lx", *(stack + i)); } printk("\n"); + i = 0; #ifdef CONFIG_FRAME_POINTER printk(KERN_EMERG "Call Trace:\n"); @@ -134,15 +151,30 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) while (stack <= endstack && stack > last_stack) { addr = *(stack + 1); - printk(KERN_EMERG " [%08lx] ", addr); - print_symbol(KERN_CONT "%s\n", addr); + print_this_address(addr, i); + i++; last_stack = stack; stack = (unsigned long *)*stack; } printk("\n"); #else - printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n"); + printk(KERN_EMERG "Call Trace with CONFIG_FRAME_POINTER disabled:\n"); + while (stack <= endstack) { + addr = *stack++; + /* + * If the address is either in the text segment of the kernel, + * or in a region which is occupied by a module then it *may* + * be the address of a calling routine; if so, print it so that + * someone tracing down the cause of the crash will be able to + * figure out the call path that was taken. + */ + if (__kernel_text_address(addr)) { + print_this_address(addr, i); + i++; + } + } + printk(KERN_CONT "\n"); #endif } -- cgit v1.2.3 From 0df185f5a1430ab8b437be402d286ee0728ef9f8 Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Mon, 28 Apr 2008 11:43:00 +0200 Subject: m68knommu: move code within time.c This patch creates two functions do_set_rtc() and read_rtc_mmss() based on allready available code. Signed-off-by: Sebastian Siewior Signed-off-by: Greg Ungerer --- arch/m68knommu/kernel/time.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'arch/m68knommu/kernel') diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index 0ccfb2ad638..d33ed9a84cc 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c @@ -33,22 +33,11 @@ static inline int set_rtc_mmss(unsigned long nowtime) return -1; } -/* - * timer_interrupt() needs to keep up the real-time clock, - * as well as call the "do_timer()" routine every clocktick - */ -irqreturn_t arch_timer_interrupt(int irq, void *dummy) +static inline void do_set_rtc(void) { /* last time the cmos clock got updated */ static long last_rtc_update=0; - if (current->pid) - profile_tick(CPU_PROFILING); - - write_seqlock(&xtime_lock); - - do_timer(1); - /* * If we have an externally synchronized Linux clock, then update * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be @@ -63,6 +52,23 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } +} + +/* + * timer_interrupt() needs to keep up the real-time clock, + * as well as call the "do_timer()" routine every clocktick + */ +irqreturn_t arch_timer_interrupt(int irq, void *dummy) +{ + + if (current->pid) + profile_tick(CPU_PROFILING); + + write_seqlock(&xtime_lock); + + do_timer(1); + + do_set_rtc(); write_sequnlock(&xtime_lock); @@ -72,7 +78,7 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) return(IRQ_HANDLED); } -void time_init(void) +static unsigned long read_rtc_mmss(void) { unsigned int year, mon, day, hour, min, sec; @@ -83,7 +89,13 @@ void time_init(void) if ((year += 1900) < 1970) year += 100; - xtime.tv_sec = mktime(year, mon, day, hour, min, sec); + + return mktime(year, mon, day, hour, min, sec);; +} + +void time_init(void) +{ + xtime.tv_sec = read_rtc_mmss(); xtime.tv_nsec = 0; wall_to_monotonic.tv_sec = -xtime.tv_sec; -- cgit v1.2.3 From 95469bd64a7a9ab405b566deb8c81d4aaf67ed9e Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Mon, 28 Apr 2008 11:43:01 +0200 Subject: m68knommu: complete generic time do_set_rtc() isn't required because the work that is handled is allready served if read_persistent_clock() & update_persistent_clock() are implemented and CONFIG_GENERIC_CMOS_UPDATE is. sync_cmos_clock() looks very familiar :) Signed-off-by: Sebastian Siewior Signed-off-by: Greg Ungerer --- arch/m68knommu/kernel/time.c | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'arch/m68knommu/kernel') diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index d33ed9a84cc..67944aa2728 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c @@ -33,27 +33,6 @@ static inline int set_rtc_mmss(unsigned long nowtime) return -1; } -static inline void do_set_rtc(void) -{ - /* last time the cmos clock got updated */ - static long last_rtc_update=0; - - /* - * If we have an externally synchronized Linux clock, then update - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be - * called as close as possible to 500 ms before the new second starts. - */ - if (ntp_synced() && - xtime.tv_sec > last_rtc_update + 660 && - (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && - (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { - if (set_rtc_mmss(xtime.tv_sec) == 0) - last_rtc_update = xtime.tv_sec; - else - last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ - } -} - /* * timer_interrupt() needs to keep up the real-time clock, * as well as call the "do_timer()" routine every clocktick @@ -68,8 +47,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) do_timer(1); - do_set_rtc(); - write_sequnlock(&xtime_lock); #ifndef CONFIG_SMP @@ -93,12 +70,17 @@ static unsigned long read_rtc_mmss(void) return mktime(year, mon, day, hour, min, sec);; } -void time_init(void) +unsigned long read_persistent_clock(void) +{ + return read_rtc_mmss(); +} + +int update_persistent_clock(struct timespec now) { - xtime.tv_sec = read_rtc_mmss(); - xtime.tv_nsec = 0; - wall_to_monotonic.tv_sec = -xtime.tv_sec; + return set_rtc_mmss(now.tv_sec); +} +void time_init(void) +{ hw_timer_init(); } - -- cgit v1.2.3 From 2b9a69861c39ae4c232385def833816acc07a0a4 Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Mon, 28 Apr 2008 11:43:04 +0200 Subject: m68knommu: MCF5307 PIT GENERIC_CLOCKEVENTS support The PIT code has been changed in order to suppport GENERIC_CLOCKEVENTS. The priority of the PIT clocksource has been decreased in favor of the DMA timer. pit_cycles_per_jiffy become a constant (PIT_CYCLES_PER_JIFFY) because it is known at compile time and does not change afterwards. Signed-off-by: Benedikt Spranger Signed-off-by: Sebastian Siewior Signed-off-by: Greg Ungerer --- arch/m68knommu/kernel/time.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/m68knommu/kernel') diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index 67944aa2728..d182b2f7221 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c @@ -33,6 +33,7 @@ static inline int set_rtc_mmss(unsigned long nowtime) return -1; } +#ifndef CONFIG_GENERIC_CLOCKEVENTS /* * timer_interrupt() needs to keep up the real-time clock, * as well as call the "do_timer()" routine every clocktick @@ -54,6 +55,7 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) #endif return(IRQ_HANDLED); } +#endif static unsigned long read_rtc_mmss(void) { -- cgit v1.2.3 From 9b0e74102494971ca37a425c63031fea68bb5b79 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Fri, 11 Jul 2008 15:29:36 +1000 Subject: m68knommu: put ColdFire head code into .text.head section Switch the ColdFire head start up code to be in the .text.head segment. And make sure that segment is at the start of the final linked text segment. Fixes the linker warnings about section use mis-matches: WARNING: vmlinux.o(.text+0xa8): Section mismatch in reference from the variable _clear_bss to the function .init.text:start_kernel() The function _clear_bss() references the function __init start_kernel(). This is often because _clear_bss lacks a __init annotation or the annotation of start_kernel is wrong. Signed-off-by: Greg Ungerer --- arch/m68knommu/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/m68knommu/kernel') diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S index 93e69236ed6..69ba9b10767 100644 --- a/arch/m68knommu/kernel/vmlinux.lds.S +++ b/arch/m68knommu/kernel/vmlinux.lds.S @@ -62,6 +62,7 @@ SECTIONS { .text : { _text = .; _stext = . ; + HEAD_TEXT TEXT_TEXT SCHED_TEXT LOCK_TEXT -- cgit v1.2.3