Subject: [Fwd: Kernel panic: Caught reserved exception - should not happen.]

From: Scott A McConnell <[email-masked]>
Date: Thu, 01 Nov 2001 09:09:05 -0500

-- 
Scott A. McConnell

Subject: Re: Kernel panic: Caught reserved exception - should not happen.
From: Scott A McConnell <[email-masked]>
To: Jun Sun <[email-masked]>
Date: Thu, 01 Nov 2001 09:05:52 -0500

Jun Sun wrote:
> 
> Scott A McConnell wrote:
> >
> > I have been getting a fair amount of the above type of errors when
> > compiling on a mipsel box.
> >
> > 2.4.5 kernel on a NEC VR5432 box. Anyone aware of known problems?
> >
> 
> What is the exception vector?  Is it the "watch exception"?

No it is not a watch exception it appears to always be an Interrupt
exception.

I am running the ltp tests.

Status is always 9001f003 and the cause is always 00002000.

epc always points to 80014570 which is in:

ffffffff8001451c T pgd_init
ffffffff80014560 T update_mmu_cache     <------------
ffffffff800146d0 T show_regs

Sometimes my kernel reboots and sometimes it continues on. I get the
error when compiling and also when doing make clean. So just about
anything will make it happen

make[4]: Entering directory `/opt/ltp/testcases/kernel/syscalls/getpgrp'
cc -o getpgrp01 getpgrp01.c -I../../../../include -L../../../../lib
-lltpGot reserved at 80014570.

$0 : 00000000 2ab042cc 81f83ca0 81f83ca0
$4 : 81a23720 2aaae734 2aaae734 00000000
$8 : 802a3510 1000001f 6ffffdff 70000053
$12: 6fffffff 00000063 2ab04268 7fff7510
$16: 8107d6c0 ffffffff 81a23720 81f86260
$20: 81e23ab8 2aaae734 81f83ca0 00000000
$24: 00000000 2aaae734
$28: 812f6000 812f7df8 7fff7420 8002a19c
epc   : 80014570
Status: 9001f003
Cause : 00002000
Kernel panic: Caught reserved exception - should not happen.
Rebooting in 180 seconds..

make[4]: Entering directory `/opt/ltp/testcases/kernel/syscalls/select'
cc -o select01 select01.c -I.Unhandled kernel unaligned access or
invalid instruction:$0 : 00000000 7fff7784 81f94da0 81f94da0
$4 : 813493e0 2aab59bc 2aab59bc 00000000
$8 : 802a3510 1000001f 7fff7720 2aaa84ac
$12: 7fff79f8 7fff79fc ffffffff 00000003
$16: 8107d940 ffffffff 813493e0 81f97260
$20: 81f7dad4 2aab59bc 81f94da0 00000000
$24: 7fff7a10 2aab59bc
$28: 812da000 812dbdf8 7fff76d8 8002a19c
epc   : 80014574
Status: 9001f003
Cause : 00002000
Process cc (pid: 5022, stackpage=812da000)
Stack: 813493e0 00000000 00000000 00000000 2ab041a8 1000001f 7fff7720
7fff7a9c
       01f65603 812dbe68 00000000 81f94da0 00000000 813493e0 2aab59bc
00000000
       00000000 00000097 8002a364 00000097 7fff7a10 2aaa9bc0 812dbe68
8001dd94
       81f7dad4 812dbe80 7fff5b98 8000fd98 812da000 81f94da0 81f94dbc
2aab59bc
       812dbf30 80012f8c 00000000 00000000 8118ab60 00000000 8001dc3c
00030002
       00000000 ...
Call Trace: [<8002a364>] [<8001dd94>] [<8000fd98>] [<80012f8c>]
[<8001dc3c>] [<8001da]Code: 14620055  00a03021  40025000 <00000000>
304700ff  40086000  00000000  35010001  ./../../../include
-L../../../../lib -lltp
make[4]: *** [select01] Segmentation fault

cc -o write01 write01.c -I../../../../include -L../../../../lib -lltp
Unhandled kernel unaligned access or invalid instruction in
unaligned.c:emulate_load_:$0 : 00000000 81ac1000 81f94e20 81f94e20
$4 : 819fc660 2ae55000 2ae55000 00000001
$8 : 1fffffff 1000001f 00000000 00000020
$12: 0000007e 2adfe0cc 00007000 10003b7c
$16: 8106b000 81f94e20 819fc660 81854954
$20: 2ae55000 2ae55000 81f94e20 00000001
$24: 00000000 2ace1c90
$28: 812e2000 812e3dc0 7fff7530 8002a03c
epc   : 80014574
Status: b001f003
Cause : 00008010
Process as (pid: 6081, stackpage=812e2000)
Stack: 00000000 00419cd0 81f9f460 00000089 01083603 01ac0717 01ac0613
8002a140
       00000000 81f94e20 819fc660 00000000 81854954 8002a230 819fc420
00008000
       00000000 806778c0 2ae55000 10002b7c 812e3eb0 80851ad8 0155f603
8002e184
       00000000 81f94e20 00000001 819fc660 2ae55000 00000001 100029ec
00000020
       8002a364 00989680 00000048 1000a3d0 14003fff 00000001 81854954
0007f000
       2ae07000 ...
Call Trace: [<8002a140>] [<8002a230>] [<8002e184>] [<8002a364>]
[<8002b6d8>] [<80012f]Code: 14620055  00a03021  40025000 <00000000>
304700ff  40086000  00000000  35010001  cc: Internal error: Segmentation
fault (program as)
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
make[4]: *** [write01] Error 1

-- 
Scott A. McConnell

---

From: Jun Sun <[email-masked]>
Date: Thu, 1 Nov 2001 09:31:58 -0800

On Thu, Nov 01, 2001 at 09:09:05AM -0500, Scott A McConnell wrote:
> 
> -- 
> Scott A. McConnell
> X-Mozilla-Status2: 00000000
> X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.5-xfs-1.0.1 i686)
> X-Accept-Language: en

Try the following patch.  It is outdated, and it may not apply cleanly.
But you should get an idea about the intention of the fix.

Please let me know the result.

Jun

This is a possible fix for the R5432 cp0/interrupt bug.  Not tested or
verified by NEC engineers.

Not checked in yet.  Pending on more info on this bug.

Jun

diff -Nru linux/arch/mips/kernel/head.S.orig linux/arch/mips/kernel/head.S
--- linux/arch/mips/kernel/head.S.orig	Tue Jun 26 16:15:26 2001
+++ linux/arch/mips/kernel/head.S	Tue Jun 26 16:27:49 2001
@@ -59,6 +59,12 @@
 	.set	noat
 	LEAF(except_vec0_r4000)
 	.set	mips3
+#if defined(CONFIG_CPU_R5432)
+	la 	k0, 1f
+	jr	k0
+	nop
+1:
+#endif
 	mfc0	k0, CP0_BADVADDR		# Get faulting address
 	srl	k0, k0, 22			# get pgd only bits
 	lw	k1, current_pgd			# get pgd pointer
@@ -329,6 +335,12 @@
 	/* Register saving is delayed as long as we don't know
 	 * which registers really need to be saved.
 	 */
+#if defined(CONFIG_CPU_R5432)
+	la 	k0, 1f
+	jr	k0
+	nop
+1:
+#endif
 	mfc0	k1, CP0_CONTEXT
 	dsra	k1, 1
 	lwu	k0,  (k1)		# May cause another exception
@@ -357,6 +369,12 @@
 	 * in the cache, we may not be able to recover.  As a
 	 * first-order desperate measure, turn off KSEG0 cacheing.
 	 */
+#if defined(CONFIG_CPU_R5432)
+	la 	k0, 1f
+	jr	k0
+	nop
+1:
+#endif
 	mfc0	k0,CP0_CONFIG
 	li	k1,~CONF_CM_CMASK
 	and	k0,k0,k1
@@ -374,6 +392,12 @@
 	/* General exception vector R4000 version. */
 	NESTED(except_vec3_r4000, 0, sp)
 	.set	noat
+#if defined(CONFIG_CPU_R5432)
+	la 	k0, 1f
+	jr	k0
+	nop
+1:
+#endif
 	mfc0	k1, CP0_CAUSE
 	andi	k1, k1, 0x7c
 	li	k0, 31<<2
@@ -427,6 +451,12 @@
 	NESTED(except_vec3_generic, 0, sp)
 	.set	noat
 	.set	mips0
+#if defined(CONFIG_CPU_R5432)
+	la 	k0, 1f
+	jr	k0
+	nop
+1:
+#endif
 	mfc0	k1, CP0_CAUSE
 	la	k0, exception_handlers
 	andi	k1, k1, 0x7c

---

From: Scott A McConnell <[email-masked]>
Date: Thu, 01 Nov 2001 17:13:08 -0500

> Please let me know the result.

It looks like a winner to me. I applied the patch compiled, ran and
cleaned up the ltp tests twice. I was getting between 2-6 (exception
errors) for each cycle I did not have a single failure.

You wouldn't happen to have knowledge of some patches that fix pthreads? 

Thanks very much!

-- 
Scott A. McConnell

---

From: Jun Sun <[email-masked]>
Date: Thu, 01 Nov 2001 14:50:40 -0800

Scott A McConnell wrote:
> It looks like a winner to me.

*sigh* We need another ugly #ifdef in the head.S file.

> You wouldn't happen to have knowledge of some patches that fix pthreads?

glibc 2.2 does not have pthread problems, at least not the one in monta vista
journeyman distribution.

There are several problems in glibc 2.0.6.  But I hope you are not looking for
them. :-)

Jun

---

From: "Maciej W. Rozycki" <[email-masked]>
Date: Tue, 6 Nov 2001 17:14:39 +0100 (MET)

> *sigh* We need another ugly #ifdef in the head.S file.

 A better approach would be to define a macro in a header file and only
expand it in head.S.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email-masked], PGP key available        +