Skip to contentSkip to conversation

kernel BUG running cyclictest on powerpc 405

Xenomai-core Steven A. Falco 2 participants 5 messages Oct 25, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

I have built a 2.6.23-rc7 kernel (from Denx git) with Xenomai 2.4-rc3. Architecture is powerpc, processor is a 405GP.

I had to make some additions to arch/powerpc/kernel/head_40x.S, and I can submit a patch if someone tells me where to post it.

However, while the kernel boots and runs, the xenomai user apps do not work correctly. Specifically, when running cyclictest, I get the following:

   # ./cyclictest
   0.00 0.00 0.00 1/18 668

T: 0 ( 668) P:99 I: ------------[ cut here ]------------ 0
Avg: 0 Max:-1000000
1000 C: 5kernel BUG at
/n/maytag/home/sfalco/linux/embedded/ppc3/linux/linux-2.6-denx/kernel/ipipe/core.c:314!
Min: 24 AcOops: Exception in kernel mode, sig: 5 [#1]
Netdec

   Modules linked in:
   NIP: c0045dd0 LR: c0015750 CTR: c00121fc
   REGS: c0dbde00 TRAP: 0700   Not tainted  (2.6.23-rc7)
   MSR: 00021030 <ME,IR,DR>  CR: 22000422  XER: 20000000
   TASK = c0fe7420[668] 'cyclictest' THREAD: c0dbc000
   GPR00: 00004900 c0dbdeb0 c0fe7420 00000000 003f0000 c00115dc
   00000000 00000000
   GPR08: 00000000 000048ff c0296090 00000001 00010000 1001c23c
   00ff9900 00000001
   GPR16: 7fbabcb0 10015090 10015068 00000000 0ff81940 00000000
   0000029a 0ff815d0
   GPR24: c02a2fcc 00000280 00000000 c030c200 0000001f 003f0000
   00000010 c028e3bc
   NIP [c0045dd0] __ipipe_restore_root+0x1c/0x50
   LR [c0015750] uic_mask_irq+0x84/0x98
   Call Trace:
   [c0dbdeb0] [c0054cdc] hisyscall_event+0x1fc/0x310 (unreliable)
   [c0dbded0] [c00439fc] __ipipe_ack_level_irq+0x50/0x78
   [c0dbdee0] [c0007b2c] __ipipe_ack_irq+0x28/0x3c
   [c0dbdef0] [c0007e68] __ipipe_handle_irq+0x12c/0x148
   [c0dbdf20] [c00080f8] __ipipe_grab_irq+0x3c/0xc0
   [c0dbdf40] [c000e338] __ipipe_ret_from_except+0x0/0xc
   Instruction dump:
   0.00 0.00 0.00 2/18 66Xenomai: POSIX: destroyed thread c0f803203d20c02c
   8          004a78 3120ffff 7d690110 <0f0b0000> 2f830000 3d60c029
   392b6050
   t:      39 Avg:      29 Max:      39
   T: 0 (  668) P:99 I:    1000 C:       8 Min:      24 Act:      24
   Avg:      29 Max:      39
   Trace/breakpoint trap

The bug is coming from ipipe/core.c:314, which is the BUG_ON here:

   void __ipipe_restore_root(unsigned long x)
   {
       BUG_ON(!ipipe_root_domain_p);
       if (x)
           __ipipe_stall_root();
       else
           __ipipe_unstall_root();

}

How do I debug this? I have done a little kernel hacking, but I am a noob when it comes to Xenomai...

Steve

#1 lore raw
Quoted 6 lines · Steven A. Falco

I have built a 2.6.23-rc7 kernel (from Denx git) with Xenomai 2.4-rc3. Architecture is powerpc, processor is a 405GP.

I had to make some additions to arch/powerpc/kernel/head_40x.S, and I can submit a patch if someone tells me where to post it.

Here would be nice, or to the Adeos list, indifferently - I would pick it from both anyway.

Quoted 3 lines

However, while the kernel boots and runs, the xenomai user apps do not work correctly. Specifically, when running cyclictest, I get the following:

This patch should fix this issue.

arch/powerpc/sysdev/uic.c +1 -1
index eeb38e2..5a38086 100644
@@ -48,7 +48,7 @@ struct uic {
 	int index;
 	int dcrbase;
 
-	spinlock_t lock;
+	ipipe_spinlock_t lock;
 
 	/* The remapper for this UIC */
 	struct irq_host	*irqhost;
Quoted 4 lines

How do I debug this? I have done a little kernel hacking, but I am a noob when it comes to Xenomai...

Well, actually, it's shame on me. I did not notice that the universal interrupt controller code was missing some bits in post-2.6.21 I-pipe patches.

Signature · 1 line
Philippe.
#2 lore raw

Thanks! I'll try your patch and report if I still have trouble.

I've attached my patch for PPC405.

Steve

Quoted 34 lines · Philippe Gerum
Quoted 6 lines · Steven A. Falco

I have built a 2.6.23-rc7 kernel (from Denx git) with Xenomai 2.4-rc3. Architecture is powerpc, processor is a 405GP.

I had to make some additions to arch/powerpc/kernel/head_40x.S, and I can submit a patch if someone tells me where to post it.

Here would be nice, or to the Adeos list, indifferently - I would pick it from both anyway.

Quoted 4 lines

However, while the kernel boots and runs, the xenomai user apps do not work correctly. Specifically, when running cyclictest, I get the following:

This patch should fix this issue.

arch/powerpc/sysdev/uic.c +1 -1
index eeb38e2..5a38086 100644
@@ -48,7 +48,7 @@ struct uic {
 	int index;
 	int dcrbase;
 
-	spinlock_t lock;
+	ipipe_spinlock_t lock;
 
 	/* The remapper for this UIC */
 	struct irq_host	*irqhost;
Quoted 10 lines
Quoted 4 lines

How do I debug this? I have done a little kernel hacking, but I am a noob when it comes to Xenomai...

Well, actually, it's shame on me. I did not notice that the universal interrupt controller code was missing some bits in post-2.6.21 I-pipe patches.

arch/powerpc/kernel/head_40x.S +14 -0
@@ -227,6 +227,12 @@
 	EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
 			  ret_from_except_full)
 
+#ifdef CONFIG_IPIPE
+#define EXC_XFER_IPIPE(n, hdlr)		\
+	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
+			  __ipipe_ret_from_except)
+#endif /* CONFIG_IPIPE */
+
 #define EXC_XFER_LITE(n, hdlr)		\
 	EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
 			  ret_from_except)
@@ -395,7 +401,11 @@
 	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* 0x0500 - External Interrupt Exception */
+#ifdef CONFIG_IPIPE
+	EXCEPTION(0x0500, HardwareInterrupt, __ipipe_grab_irq, EXC_XFER_IPIPE)
+#else /* !CONFIG_IPIPE */
 	EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
+#endif /* CONFIG_IPIPE */
 
 /* 0x0600 - Alignment Exception */
 	START_EXCEPTION(0x0600, Alignment)
@@ -433,7 +443,11 @@
 	lis	r0,TSR_PIS@h
 	mtspr	SPRN_TSR,r0		/* Clear the PIT exception */
 	addi	r3,r1,STACK_FRAME_OVERHEAD
+#ifdef CONFIG_IPIPE
+	EXC_XFER_IPIPE(0x1000, __ipipe_grab_timer)
+#else /* !CONFIG_IPIPE */
 	EXC_XFER_LITE(0x1000, timer_interrupt)
+#endif /* CONFIG_IPIPE */
 
 #if 0
 /* NOTE:
#3 lore raw
Quoted 4 lines · Steven A. Falco

Thanks! I'll try your patch and report if I still have trouble.

I've attached my patch for PPC405.

Thanks. You may also want to upgrade to this I-pipe patch; it should apply properly against -rc7:

http://download.gna.org/adeos/patches/v2.6/powerpc/adeos-ipipe-2.6.23-powerpc-DENX-2.0-02.patch

You would still need the quick fix for the UIC on top of that one, though.

Quoted 48 lines

Steve

Quoted 45 lines · Philippe Gerum
Quoted 7 lines · Steven A. Falco

I have built a 2.6.23-rc7 kernel (from Denx git) with Xenomai 2.4-rc3. Architecture is powerpc, processor is a 405GP.

I had to make some additions to arch/powerpc/kernel/head_40x.S, and I can submit a patch if someone tells me where to post it.

Here would be nice, or to the Adeos list, indifferently - I would pick it from both anyway.

Quoted 4 lines

However, while the kernel boots and runs, the xenomai user apps do not work correctly. Specifically, when running cyclictest, I get the following:

This patch should fix this issue.

arch/powerpc/sysdev/uic.c +1 -1
index eeb38e2..5a38086 100644
@@ -48,7 +48,7 @@ struct uic {
 	int index;
 	int dcrbase;
 
-	spinlock_t lock;
+	ipipe_spinlock_t lock;
 
 	/* The remapper for this UIC */
 	struct irq_host	*irqhost;
Quoted 5 lines

How do I debug this? I have done a little kernel hacking, but I am a noob when it comes to Xenomai...

Well, actually, it's shame on me. I did not notice that the universal interrupt controller code was missing some bits in post-2.6.21 I-pipe patches.

Signature · 1 line
Philippe.
#4 lore raw

I upgraded to the new ipipe patch and your uic fix. Attached is a new patch I needed - without it, I get the error message:

.../include/linux/ipipe.h:298: warning: 'struct mm_struct' declared inside parameter list .../include/linux/ipipe.h:298: warning: its scope is only this definition or declaration, which is probably not what you want

Also, there is a problem with the uic fix. It now gives this compile-time error:

CC arch/powerpc/sysdev/uic.o
.../arch/powerpc/sysdev/uic.c: In function 'uic_init_one':
.../arch/powerpc/sysdev/uic.c:234: error: incompatible types in assignment

I believe this is caused by the definition in spinlock.h:

# define spin_lock_init(lock)                    \
   do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)

The SPIN_LOCK_UNLOCKED should perhaps be IPIPE_SPIN_LOCK_UNLOCKED, but I don't know if this is the right way to fix it.

Steve

Quoted 8 lines · Philippe Gerum
Quoted 5 lines · Steven A. Falco

Thanks! I'll try your patch and report if I still have trouble.

I've attached my patch for PPC405.

Quoted 63 lines

Thanks. You may also want to upgrade to this I-pipe patch; it should apply properly against -rc7:

http://download.gna.org/adeos/patches/v2.6/powerpc/adeos-ipipe-2.6.23-powerpc-DENX-2.0-02.patch

You would still need the quick fix for the UIC on top of that one, though.

Quoted 52 lines

Steve

Quoted 48 lines · Philippe Gerum
Quoted 7 lines · Steven A. Falco

I have built a 2.6.23-rc7 kernel (from Denx git) with Xenomai 2.4-rc3. Architecture is powerpc, processor is a 405GP.

I had to make some additions to arch/powerpc/kernel/head_40x.S, and I can submit a patch if someone tells me where to post it.

Here would be nice, or to the Adeos list, indifferently - I would pick it from both anyway.

Quoted 5 lines

However, while the kernel boots and runs, the xenomai user apps do not work correctly. Specifically, when running cyclictest, I get the following:

This patch should fix this issue.

arch/powerpc/sysdev/uic.c +1 -1
index eeb38e2..5a38086 100644
@@ -48,7 +48,7 @@ struct uic {
 	int index;
 	int dcrbase;
 
-	spinlock_t lock;
+	ipipe_spinlock_t lock;
 
 	/* The remapper for this UIC */
 	struct irq_host	*irqhost;
Quoted 7 lines

How do I debug this? I have done a little kernel hacking, but I am a noob when it comes to Xenomai...

Well, actually, it's shame on me. I did not notice that the universal interrupt controller code was missing some bits in post-2.6.21 I-pipe patches.

linux/ipipe.h renamed from home/sfalco/ipipe.h +2 -0
@@ -31,6 +31,8 @@
 #include <linux/ipipe_compat.h>
 #include <asm/ipipe.h>
 
+struct mm_struct;
+
 #ifdef CONFIG_IPIPE
 
 #define IPIPE_VERSION_STRING	IPIPE_ARCH_STRING