* sparc-2.6.git sparc32
@ 2006-07-08 19:40 Raymond Burns
2006-07-08 23:10 ` Bob Breuer
2006-07-11 2:33 ` Raymond Burns
0 siblings, 2 replies; 3+ messages in thread
From: Raymond Burns @ 2006-07-08 19:40 UTC (permalink / raw)
To: sparclinux
[-- Attachment #1: Type: TEXT/PLAIN, Size: 698 bytes --]
Hi
Working with a June 29th pull of davem's tree I found a sequence of
events which poses a problem causing BUG and then Oops.
This impacts platforms with the mostek clock
kernel/main.c calls out time_init() which ultimatly leads to a call
of clock_init() which calls of_register_driver() for the mostek clock.
This occurs prior to the kobject, klist and friends being initialized
which occurs as postcore_initcall(of_bus_driver_init), This leads to
the BUGs and oops.
The clock initialization is needed prior to local_irq_enable
I have not found reasons for the postcore_initcall calls timing but
assume they're concrete for other platforms.
I have not found a work around.
Thanx
Ray
[-- Attachment #2: log of boot --]
[-- Type: TEXT/PLAIN, Size: 2110 bytes --]
SILO boot: sm
Using /dev/ttya as console.
TYPE: SPARCserver 1000E
Ethernet address: 8:0:20:7e:19:ee
Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz). Patching kerne
l for srmmu[TI Viking/MXCC]/io-unit
318MB HIGHMEM available.
PROM: Built device tree with 14005 bytes of memory.
Booting Linux...
Built 1 zonelists. Total pages: 130066
Kernel command line: root=/dev/sdc3 console=ttya
PID hash table entries: 1024 (order: 10, 4096 bytes)
BUG: warning at lib/kref.c:32/kref_get()
[f013df38 : get_bus+0x20/0x50 ] [f013dd04 : bus_add_driver+0x8/0xa8 ] [f025bc74
: sbus_setup_arch_props+0x30/0x54 ] [f02560a4 : found_version+0x5c/0x68 ] [f0255
7c8 : _etext+0x76c20/0x77458 ] [00000000 : __stext+0xfffc000/0x10 ]
BUG: warning at lib/kref.c:32/kref_get()
[f0109d7c : kobject_init+0x38/0x70 ] [f0109f64 : kobject_register+0x10/0x44 ] [f
013dd44 : bus_add_driver+0x48/0xa8 ] [f025bc74 : sbus_setup_arch_props+0x30/0x54
] [f02560a4 : found_version+0x5c/0x68 ] [f02557c8 : _etext+0x76c20/0x77458 ] [0
0000000 : __stext+0xfffc000/0x10 ]
Unable to handle kernel NULL pointer dereference
tsk->{mm,active_mm}->context = ffffffff
tsk->{mm,active_mm}->pgd = fc000000
swapper(0): Oops [#1]
PSR: 40401fc2 PC: f0109ef4 NPC: f0109ef8 Y: 00000000 Not tainted
PC: <kobject_add+0xec/0x14c>
%G: f02177d8 f0110db8 404010e1 40401fe6 f003af34 f027ec00 f0012000 00000100
%O: f02177e0 f0217260 00000000 00000073 ffffffff ffffffff f0013d90 f0109f10
RPC: <kobject_add+0x108/0x14c>
%L: 00000000 f02177ec fffffffd f0217248 00000040 00000000 0000001f f0013d08
%I: f0217244 00000014 f01e8582 f0013eb0 f027f5e0 ffffffff f0013df8 f0109f6c
Caller[f0109f6c]: kobject_register+0x18/0x44
Caller[f013dd44]: bus_add_driver+0x48/0xa8
Caller[f025bc74]: sbus_setup_arch_props+0x30/0x54
Caller[f02560a4]: found_version+0x5c/0x68
Caller[f02557c8]: _etext+0x76c20/0x77458
Caller[00000000]: __stext+0xfffc000/0x10
Instruction DUMP: d4022004 d026201c d2222004 <d2228000> d4226004 d0062028 90
022010 c02a0000 10bfffd5
Program terminated
Type help for more information
<#0> ok
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sparc-2.6.git sparc32
2006-07-08 19:40 sparc-2.6.git sparc32 Raymond Burns
@ 2006-07-08 23:10 ` Bob Breuer
2006-07-11 2:33 ` Raymond Burns
1 sibling, 0 replies; 3+ messages in thread
From: Bob Breuer @ 2006-07-08 23:10 UTC (permalink / raw)
To: sparclinux
[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]
Raymond Burns wrote:
> Hi
>
> Working with a June 29th pull of davem's tree I found a sequence of
> events which poses a problem causing BUG and then Oops.
>
> This impacts platforms with the mostek clock
>
> kernel/main.c calls out time_init() which ultimatly leads to a call
> of clock_init() which calls of_register_driver() for the mostek clock.
>
> This occurs prior to the kobject, klist and friends being initialized
> which occurs as postcore_initcall(of_bus_driver_init), This leads to
> the BUGs and oops.
>
> The clock initialization is needed prior to local_irq_enable
>
> I have not found reasons for the postcore_initcall calls timing but
> assume they're concrete for other platforms.
>
> I have not found a work around.
I'm seeing the same thing.
Based on sparc64, it should be possible to defer the initialization of
the mostek clock until later.
The attached patch gets me past the clock driver, but it ends up with a
watchdog reset after switching to malloc:
io scheduler cfq registered (default)
ioremap: done with statics, switching to malloc
Watchdog Reset
Type help for more information
<#0> ok
Bob
[-- Attachment #2: sparc32-delayed-clock_init.txt --]
[-- Type: text/plain, Size: 3624 bytes --]
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 04eb1ea..845081b 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -225,6 +225,32 @@ static __inline__ int has_low_battery(vo
return (data1 == data2); /* Was the write blocked? */
}
+static void __init mostek_set_system_time(void)
+{
+ unsigned int year, mon, day, hour, min, sec;
+ struct mostek48t02 *mregs;
+
+ mregs = (struct mostek48t02 *)mstk48t02_regs;
+ if(!mregs) {
+ prom_printf("Something wrong, clock regs not mapped yet.\n");
+ prom_halt();
+ }
+ spin_lock_irq(&mostek_lock);
+ mregs->creg |= MSTK_CREG_READ;
+ sec = MSTK_REG_SEC(mregs);
+ min = MSTK_REG_MIN(mregs);
+ hour = MSTK_REG_HOUR(mregs);
+ day = MSTK_REG_DOM(mregs);
+ mon = MSTK_REG_MONTH(mregs);
+ year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
+ xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
+ xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
+ set_normalized_timespec(&wall_to_monotonic,
+ -xtime.tv_sec, -xtime.tv_nsec);
+ mregs->creg &= ~MSTK_CREG_READ;
+ spin_unlock_irq(&mostek_lock);
+}
+
/* Probe for the real time clock chip on Sun4 */
static __inline__ void sun4_clock_probe(void)
{
@@ -273,6 +299,7 @@ #ifdef CONFIG_SUN4
#endif
}
+#ifndef CONFIG_SUN4
static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
{
struct device_node *dp = op->node;
@@ -307,6 +334,8 @@ static int __devinit clock_probe(struct
if (mostek_read(mstk48t02_regs + MOSTEK_SEC) & MSTK_STOP)
kick_start_clock();
+ mostek_set_system_time();
+
return 0;
}
@@ -325,56 +354,37 @@ static struct of_platform_driver clock_d
/* Probe for the mostek real time clock chip. */
-static void clock_init(void)
+static int __init clock_init(void)
{
- of_register_driver(&clock_driver, &of_bus_type);
+ return of_register_driver(&clock_driver, &of_bus_type);
}
+/* Must be after subsys_initcall() so that busses are probed. Must
+ * be before device_initcall() because things like the RTC driver
+ * need to see the clock registers.
+ */
+fs_initcall(clock_init);
+#endif /* !CONFIG_SUN4 */
+
void __init sbus_time_init(void)
{
- unsigned int year, mon, day, hour, min, sec;
- struct mostek48t02 *mregs;
-
-#ifdef CONFIG_SUN4
- int temp;
- struct intersil *iregs;
-#endif
BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM);
btfixup();
if (ARCH_SUN4)
sun4_clock_probe();
- else
- clock_init();
sparc_init_timers(timer_interrupt);
#ifdef CONFIG_SUN4
if(idprom->id_machtype == (SM_SUN4 | SM_4_330)) {
-#endif
- mregs = (struct mostek48t02 *)mstk48t02_regs;
- if(!mregs) {
- prom_printf("Something wrong, clock regs not mapped yet.\n");
- prom_halt();
- }
- spin_lock_irq(&mostek_lock);
- mregs->creg |= MSTK_CREG_READ;
- sec = MSTK_REG_SEC(mregs);
- min = MSTK_REG_MIN(mregs);
- hour = MSTK_REG_HOUR(mregs);
- day = MSTK_REG_DOM(mregs);
- mon = MSTK_REG_MONTH(mregs);
- year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
- xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
- xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
- set_normalized_timespec(&wall_to_monotonic,
- -xtime.tv_sec, -xtime.tv_nsec);
- mregs->creg &= ~MSTK_CREG_READ;
- spin_unlock_irq(&mostek_lock);
-#ifdef CONFIG_SUN4
+ mostek_set_system_time();
} else if(idprom->id_machtype == (SM_SUN4 | SM_4_260) ) {
/* initialise the intersil on sun4 */
+ unsigned int year, mon, day, hour, min, sec;
+ int temp;
+ struct intersil *iregs;
iregs=intersil_clock;
if(!iregs) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: sparc-2.6.git sparc32
2006-07-08 19:40 sparc-2.6.git sparc32 Raymond Burns
2006-07-08 23:10 ` Bob Breuer
@ 2006-07-11 2:33 ` Raymond Burns
1 sibling, 0 replies; 3+ messages in thread
From: Raymond Burns @ 2006-07-11 2:33 UTC (permalink / raw)
To: sparclinux
[-- Attachment #1: Type: TEXT/PLAIN, Size: 666 bytes --]
Hi
Your patch worked well, Thank You
For the sun4d I had to remove the arc specific local_irq_enable() to
allow the mainline initialization to occur, which seems to work.
On Sat, 8 Jul 2006, Bob Breuer wrote:
> I'm seeing the same thing.
>
> Based on sparc64, it should be possible to defer the initialization of
> the mostek clock until later.
>
> The attached patch gets me past the clock driver, but it ends up with a
> watchdog reset after switching to malloc:
>
> io scheduler cfq registered (default)
> ioremap: done with statics, switching to malloc
>
> Watchdog Reset
> Type help for more information
> <#0> ok
>
> Bob
>
Thanx
Ray
[-- Attachment #2: patch remove arch local_irq_enable --]
[-- Type: TEXT/PLAIN, Size: 246 bytes --]
--- time.c.orig Mon Jul 10 17:47:28 2006
+++ time.c Mon Jul 10 17:47:34 2006
@@ -421,7 +421,6 @@
#endif
/* Now that OBP ticker has been silenced, it is safe to enable IRQ. */
- local_irq_enable();
}
void __init time_init(void)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-07-11 2:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-08 19:40 sparc-2.6.git sparc32 Raymond Burns
2006-07-08 23:10 ` Bob Breuer
2006-07-11 2:33 ` Raymond Burns
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.