Skip to contentSkip to conversation

r1827 seems to have broken PPC with vxworks skin

Xenomai-core Niklaus Giger 2 participants 3 messages Nov 12, 2006

lore
Share & tools
lore
#0 lore raw

Hi Philippe

Your commit 1827 "Make rthal_thread_switch() return the last current task pointer as expected by the vanilla switch code" seems to trigger a failure in my PPC405 vxworks setup.

See http://ngiger.dyndns.org/buildbot/hcu3_vx_q/builds/2/step-xenotest/0
where I got the following error on startup:

I-pipe: Domain Xenomai registered.
Xenomai: hal/powerpc started.
Xenomai: real-time nucleus v2.3-rc1 (Baroque) loaded.
Xenomai: starting native API services.
Xenomai: starting RTDM services.

Oops: kernel access of bad area, sig: 11 [#1]
NIP: C0063384 LR: C0062168 SP: C02CBF50 REGS: c02cbea0 TRAP: 0300    Not 

tainted
MSR: 00021030 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 00000004, DSISR: 00000000
TASK = c02c0b40[1] 'swapper' THREAD: c02ca000
Last syscall: 120
GPR00: 00000001 C02CBF50 C02C0B40 00000000 00000000 C0328320 00000080 00000120
GPR08: 00000000 00000000 C0328240 C022DF80 C0200000 00000000 01FFBB00 00000000
GPR16: 01FFF7C8 FFFFFFFF 00000000 00800000 01FF595C 007FFF00 00200040 C01B0000
GPR24: C02CBF98 C0230000 00000007 00000080 00008000 C0328324 C0328364 FFFFFFFF NIP [c0063384] vrtx_get_id+0x40/0x12c
LR [c0062168] sc_hcreate+0xa4/0x248

Call trace:
 [c0062168] sc_hcreate+0xa4/0x248
 [c006258c] vrtxheap_init+0x60/0xec
 [c0063264] __vrtx_skin_init+0x48/0xd4
 [c000245c] init+0x8c/0x254
 [c0005d0c] kernel_thread+0x44/0x60
Kernel panic - not syncing: Attempted to kill init!

As usual you may find the exact .config in
http://ngiger.dyndns.org/buildbot/hcu3_vx_q/builds/2/step-cfg_kernel/0

I am migrating my whole buildbot setup to use ELDK 4.0 as my cross-compile environment. xeno-test does not work yet as there are some differences between the denx environment and my old home made setup, which I could not yet resolve.

But this problem seems to be in a earlier state of the startup and I just wanted to inform you about it.

Best regards

Signature · 1 line
Niklaus Giger
#1 lore raw
Quoted 5 lines · Niklaus Giger

Hi Philippe

Your commit 1827 "Make rthal_thread_switch() return the last current task pointer as expected by the vanilla switch code" seems to trigger a failure in my PPC405 vxworks setup.

Mm, ok. The thing is that it also fixes the random DSI exception experienced with clock_nanosleep() by a user who has reported the issue over a lite5200. I'm going to try reproducing the VRTX issue here. Thanks.

Quoted 42 lines

See http://ngiger.dyndns.org/buildbot/hcu3_vx_q/builds/2/step-xenotest/0
where I got the following error on startup:

I-pipe: Domain Xenomai registered.
Xenomai: hal/powerpc started.
Xenomai: real-time nucleus v2.3-rc1 (Baroque) loaded.
Xenomai: starting native API services.
Xenomai: starting RTDM services.

Oops: kernel access of bad area, sig: 11 [#1]
NIP: C0063384 LR: C0062168 SP: C02CBF50 REGS: c02cbea0 TRAP: 0300    Not 

tainted
MSR: 00021030 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 00000004, DSISR: 00000000
TASK = c02c0b40[1] 'swapper' THREAD: c02ca000
Last syscall: 120
GPR00: 00000001 C02CBF50 C02C0B40 00000000 00000000 C0328320 00000080 00000120
GPR08: 00000000 00000000 C0328240 C022DF80 C0200000 00000000 01FFBB00 00000000
GPR16: 01FFF7C8 FFFFFFFF 00000000 00800000 01FF595C 007FFF00 00200040 C01B0000
GPR24: C02CBF98 C0230000 00000007 00000080 00008000 C0328324 C0328364 FFFFFFFF NIP [c0063384] vrtx_get_id+0x40/0x12c
LR [c0062168] sc_hcreate+0xa4/0x248

Call trace:
 [c0062168] sc_hcreate+0xa4/0x248
 [c006258c] vrtxheap_init+0x60/0xec
 [c0063264] __vrtx_skin_init+0x48/0xd4
 [c000245c] init+0x8c/0x254
 [c0005d0c] kernel_thread+0x44/0x60
Kernel panic - not syncing: Attempted to kill init!

As usual you may find the exact .config in
http://ngiger.dyndns.org/buildbot/hcu3_vx_q/builds/2/step-cfg_kernel/0

I am migrating my whole buildbot setup to use ELDK 4.0 as my cross-compile environment. xeno-test does not work yet as there are some differences between the denx environment and my old home made setup, which I could not yet resolve.

But this problem seems to be in a earlier state of the startup and I just wanted to inform you about it.

Best regards

Signature · 1 line
Philippe.
#2 lore raw
In reply to Niklaus Giger
Quoted 9 lines · Niklaus Giger

Hi Philippe

Your commit 1827 "Make rthal_thread_switch() return the last current task pointer as expected by the vanilla switch code" seems to trigger a failure in my PPC405 vxworks setup.

See http://ngiger.dyndns.org/buildbot/hcu3_vx_q/builds/2/step-xenotest/0
where I got the following error on startup:

Quoted 8 lines

I-pipe: Domain Xenomai registered.
Xenomai: hal/powerpc started.
Xenomai: real-time nucleus v2.3-rc1 (Baroque) loaded.
Xenomai: starting native API services.
Xenomai: starting RTDM services.

Oops: kernel access of bad area, sig: 11 [#1]
NIP: C0063384 LR: C0062168 SP: C02CBF50 REGS: c02cbea0 TRAP: 0300    Not 

tainted

The bug is not related to #1827, which is ok. Fact is that this must be the first time that someone even tries to load the VRTX skin since I've added the direct syscall interface, because I have introduced a silly and deadly showstopper to its init code while doing so. This patch should fix the problem you encountered:

skins/vrtx/heap.c +11 -9
@@ -104,27 +104,29 @@
 	if (heap0size < 2048)
 		heap0size = 2048;
 
+	vrtx_heap_idmap = vrtx_alloc_idmap(VRTX_MAX_HEAPS, 0);
+
+	if (!vrtx_heap_idmap)
+		return -ENOMEM;
+
 	heap0addr = (char *)xnmalloc(heap0size);
 
-	if (!heap0addr)
+	if (!heap0addr) {
+		vrtx_free_idmap(vrtx_heap_idmap);
 		return -ENOMEM;
+	}
 
-	hid = sc_hcreate(heap0addr, heap0size, 7, &err);	/* Must be #0 */
+	hid = sc_hcreate(heap0addr, heap0size, 7, &err); /* Must be #0 */
 
 	if (err) {
+		vrtx_free_idmap(vrtx_heap_idmap);
+
 		if (err == ER_IIP)
 			return -EINVAL;
 		else
 			return -ENOMEM;
 	}
 
-	vrtx_heap_idmap = vrtx_alloc_idmap(VRTX_MAX_HEAPS, 0);
-
-	if (!vrtx_heap_idmap) {
-		sc_hdelete(hid, 1, &err);
-		return -ENOMEM;
-	}
-
 	return 0;
 }
 
skins/vrtx/module.c +0 -4
Index: ksrc/skins/vrtx/module.c
===================================================================
@@ -101,10 +101,6 @@
 		   the bitmap space which cannot be used to draw ids. */
 
 		hi = ffnz(map->himap & ~map->himask);
-
-		if (!hi)
-			goto unlock_and_exit;
-
 		lo = ffnz(map->lomap[hi]);
 		id = hi * BITS_PER_LONG + lo;
 		++map->usedids;
Signature · 1 line
Philippe.