Subject: port-sparc/13644: 1.5X panics on sun4c with SUN4C-only kernel
To: None <gnats-bugs@gnats.netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 08/06/2001 23:44:17
>Number:         13644
>Category:       port-sparc
>Synopsis:       1.5X panics on sun4c with SUN4C-only kernel
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-sparc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 06 14:42:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Manuel Bouyer
>Release:        -current as of 2 days ago
>Organization:

>Environment:

System: NetBSD 1.5X (CORDOUAN) #1: Sun Aug  5 15:39:58 MEST 2001
    bouyer@horn.antioche.eu.org:/home/bouyer/1.5X/src/sys/arch/sparc/compile/CORDOUAN
Architecture: sparc
Machine: sparc
>Description:
	Trying to boot a -current custom kernel on a sparc IPC (tried 2
	different machines), I get the following panic a few seconds after
	'RETURN for sh':
Enter pathname of shell or RETURN for sh: data fault: pc=0xf0008188 addr=0x0 ser=8080<WRITE,INVAL>
panic: kernel fault
Stopped in pid 0 (swapper) at   cpu_Debugger+0x4:       jmpl            [%o7 + 0x8], %g0
mem_access_fault(0xf018f068, 0x8080, 0x0, 0xf0008188, 0x40, 0xf016b768) at mem_a
ccess_fault+0x2d8
normal_mem_fault(0x0, 0x30000000, 0x3a71f6f0, 0xe0ad0, 0x110, 0x31a) at normal_m
em_fault+0x28
mi_switch(0xf018d800, 0x8, 0xf0137150, 0x0, 0x8, 0xf0190f0c) at mi_switch+0x1b0
mi_switch(0xf24e8938, 0x3, 0xf2cf9220, 0xf0191348, 0xffffffff, 0x3) at mi_switch
+0x1a4
ltsleep(0x0, 0x204, 0xf0144de0, 0x0, 0x20000000, 0xf0179400) at ltsleep+0x214
uvm_aiodone_daemon(0xf24e8938, 0x30000000, 0xf0178400, 0xf0199bfc, 0xf018f400, 0
xf016e400) at uvm_aiodone_daemon+0x58
proc_trampoline(0x0, 0x0, 0x0, 0x0, 0x0, 0x0) at proc_trampoline+0x10

horn:/home/bouyer/1.5X/src/sys/arch/sparc/compile/CORDOUAN>gdb netbsd.gdb 
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc--netbsd"...
(gdb) l *(proc_trampoline+0x10)
No source file for address 0xf0007814.
(gdb) l *(uvm_aiodone_daemon+0x58)
0xf00ed108 is in uvm_aiodone_daemon (../../../../uvm/uvm_pdaemon.c:300).
295     
296                     s = splbio();
297                     simple_lock(&uvm.aiodoned_lock);
298                     if (TAILQ_FIRST(&uvm.aio_done) == NULL) {
299                             UVMHIST_LOG(pdhist,"  <<SLEEPING>>",0,0,0,0);
300                             UVM_UNLOCK_AND_WAIT(&uvm.aiodoned,
301                                 &uvm.aiodoned_lock, FALSE, "aiodoned", 0);
302                             UVMHIST_LOG(pdhist,"  <<WOKE UP>>",0,0,0,0);
303     
304                             /* relock aiodoned_lock, still at splbio */
(gdb) l *(ltsleep+0x214)
0xf002c7f8 is in ltsleep (../../../../kern/kern_synch.c:466).
461                     sig = 0;
462             p->p_stat = SSLEEP;
463             p->p_stats->p_ru.ru_nvcsw++;
464     
465             SCHED_ASSERT_LOCKED();
466             mi_switch(p);
467     
468     #if     defined(DDB) && !defined(GPROF)
469             /* handy breakpoint location after process "wakes" */
470             asm(".globl bpendtsleep ; bpendtsleep:");
(gdb) l *(mi_switch+0x1a4)
0xf002cfb4 is in mi_switch (../../../../kern/kern_synch.c:855).
850             /*
851              * Pick a new current process and switch to it.  When we
852              * run again, we'll return back here.
853              */
854             uvmexp.swtch++;
855             cpu_switch(p);
856     
857             /*
858              * Make sure that MD code released the scheduler lock before
859              * resuming us.
(gdb) l *(mi_switch+0x1b0)
0xf002cfc0 is in mi_switch (../../../../kern/kern_synch.c:870).
865              * be running on a new CPU now, so don't use the cache'd
866              * schedstate_percpu pointer.
867              */
868             KDASSERT(p->p_cpu != NULL);
869             KDASSERT(p->p_cpu == curcpu());
870             microtime(&p->p_cpu->ci_schedstate.spc_runtime);
871     
872     #if defined(MULTIPROCESSOR)
873             /*
874              * Reacquire the kernel_lock now.  We do this after we've

It looks like p->p_cpu isn't properly initialised.
With only these changes to my config file, the kernel runs fine:
--- CORDOUAN.old        Sun Nov 21 18:23:01 1999
+++ CORDOUAN    Mon Aug  6 23:08:20 2001
@@ -9,9 +9,9 @@
 
 # Options for variants of the Sun SPARC architecure.
 # We currently support three architecture types; at least one is required.
-#options       SUN4            # sun4/100, sun4/200, sun4/300
+options        SUN4            # sun4/100, sun4/200, sun4/300
 options        SUN4C           # sun4c - SS1, 1+, 2, ELC, SLC, IPC, IPX, etc.
-#options       SUN4M           # sun4m - SS10, SS20, Classic, etc.
+options        SUN4M           # sun4m - SS10, SS20, Classic, etc.
 
 #options       SUN4_MMU3L      # 3-level MMU on sun4/400; (incomplete)
 
@@ -177,9 +177,9 @@
 #### Bus types found on SPARC systems.
 
 sbus0  at mainbus0                             # sun4c
-#obio0 at mainbus0                             # sun4 and sun4m
+obio0  at mainbus0                             # sun4 and sun4m
 #vme0  at mainbus0                             # sun4
-#iommu0        at mainbus0                             # sun4m
+iommu0 at mainbus0                             # sun4m
 #sbus0 at iommu0                               # sun4m
 #vme0  at iommu0                               # sun4m
 
@@ -207,8 +207,8 @@
 #clock0        at obio0 addr 0xf2000000                # sun4/300
 
 ## Intersil clock found on 4/100 and 4/200 systems.
-#oclock0       at obio0 addr 0xf3000000                # sun4/200
-#oclock0       at obio0 addr 0x03000000                # sun4/100
+oclock0        at obio0 addr 0xf3000000                # sun4/200
+oclock0        at obio0 addr 0x03000000                # sun4/100
 
 ## Memory error registers.
 memreg0        at mainbus0                             # sun4c


I'll try a SUN4+SUN4C only kernel, and a SUN4C+SUN4M only tomorow (need to
rebuild the kernel from scratch for this, and it takes to much time for this
evening)
>How-To-Repeat:
	Boot a -current SUN4C-only kernel on a sparc IPC. 
>Fix:
	unknown
>Release-Note:
>Audit-Trail:
>Unformatted: