Subject: hardclock(9) for cobalt
To: None <tech-kern@netbsd.org>
From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
List: port-cobalt
Date: 07/29/2004 02:44:18
hi all!

I use firewire(4) of FreeBSD it enables it to use by NetBSD. Although it
moved by i386, macppc, the problem has occurred in cobalt.

firewire(4) onto attach scsibus(4) took time, it has noticed.
# However, it is not related to firewire(4).


As for cobalt, hardclock(9) is called before initclock() is called. Since
softclock_si is NULL if callout_reset(9) (or etc...) is called at this
time, it will carry out panic.


Ex ---
avail memory = 246 MB
sysctl_createv: sysctl_create(kern) returned 17
sysctl_createv: sysctl_create(kern) returned 17
sysctl_createv: sysctl_create(kern) returned 17
mainbus0 (root)
com0 at mainbus0 addr 0x1c800000 level 3: st16650a, working fifo
com0: console
cpu0 at mainbus0: QED RM5200 CPU (0x28a0) Rev. 10.0 with built-in FPU Rev. 10.0
cpu0: 32KB/32B 2-way set-associative L1 Instruction cache, 48 TLB entries
cpu0: 32KB/32B 2-way set-associative write-back L1 Data cache
panel0 at mainbus0 addr 0x1f000000
gt0 at mainbus0 addr 0x14000000
pci0 at gt0

  .. snip ..

tlp1 at pci0 dev 12 function 0: DECchip 21143 Ethernet, pass 4.1
tlp1: interrupting at level 2
tlp1: Ethernet address 00:10:e0:00:55:b6
lxtphy1 at tlp1 phy 1: LXT970 10/100 media interface, rev. 3
lxtphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
hardclock() call 1st			  <--- hardclock(9) called
softclock_si=0x0
Dangerrrrrrrrrrrrrrrrr!!
initclock() in!!			  <--- initclock() called
IPsec: Initialized Security Association Processing.

  .. snip ..

--


Index: kern_clock.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_clock.c,v
retrieving revision 1.90
diff -c -r1.90 kern_clock.c
*** kern_clock.c        13 Feb 2004 11:36:22 -0000      1.90
--- kern_clock.c        28 Jul 2004 17:40:23 -0000
***************
*** 355,360 ****
--- 355,361 ----
  {
        int i;
  
+ printf("initclock() in!!\n");
  #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
        softclock_si = softintr_establish(IPL_SOFTCLOCK, softclock, NULL);
        if (softclock_si == NULL)
***************
*** 466,471 ****
--- 467,480 ----
        int ltemp;
  #endif

+ static int calledflag = 0;
+ if (!calledflag) {
+   calledflag = 1;
+   printf("hardclock() call 1st\n");
+   printf("softclock_si=%p\n", softclock_si);
+   if (softclock_si == NULL)
+     printf("Dangerrrrrrrrrrrrrrrrr!!\n");
+ }
        l = curlwp;
        if (l) {
                p = l->l_proc;
---
kiyohara