Kernel oops on posix threads
Hi folks,
I found out that parallel threads using the Posix skin cause kernel oops somewhere between the finishing of the threads and the main thread. I have two threads, say thread A and thread B. Both created as joinable threads and they have both the same priority 99. The main routine hold a semaphore semA to synchronize the threads. After the creation thread A waits on the Semaphore semA, while the thread B runs and releases semA, so that semA can finish. On exiting the thread B I always get a Kernel ooops. The kernerl says:
unable to handle kernel paging request at virtual address 6b6b6b77 etc.......
I scratched some simple code which causes this Kernel Ooops. Packed a tar ball together with the makefile and attached the tar ball it to this mail so that you might have a look at it yourself.
I'm using
Kernel: Vanilla 2.6.12 patched with adeos-linux-2.6.12-i386-r12.patch Distr. Debian 3.1
Testhost: vmware 5.0
compiler gcc 3.3.5
I also wrote some code doing the same tasks in RTAI native context and it ran without problems. Hence I suppose the problem to be in the posix skin.
Am I making any mistakes in the code or have I evtl. found a bug in the posix skin?
Cheers
Luotao Fu
Quoted 11 lines · Luotao Fu
Hi folks,
I found out that parallel threads using the Posix skin cause kernel oops somewhere between the finishing of the threads and the main thread. I have two threads, say thread A and thread B. Both created as joinable threads and they have both the same priority 99. The main routine hold a semaphore semA to synchronize the threads. After the creation thread A waits on the Semaphore semA, while the thread B runs and releases semA, so that semA can finish. On exiting the thread B I always get a Kernel ooops. The kernerl says:
Quoted 2 lines
unable to handle kernel paging request at virtual address
6b6b6b77etc.......
Thanks a lot for your report, it is almost perfect. However, it would be really helpful to have the "etc...." in order to have a stack dump and have a quick look at the code before trying to reproduce the situation here.
Quoted 10 lines
I scratched some simple code which causes this Kernel Ooops. Packed a tar ball together with the makefile and attached the tar ball it to this mail so that you might have a look at it yourself.
I'm using
Kernel: Vanilla 2.6.12 patched with adeos-linux-2.6.12-i386-r12.patch Distr. Debian 3.1
Testhost: vmware 5.0
compiler gcc 3.3.5
Quoted 5 lines
I also wrote some code doing the same tasks in RTAI native context and it ran without problems. Hence I suppose the problem to be in the posix skin.
Am I making any mistakes in the code or have I evtl. found a bug in the posix skin?
A kernel oops is almost always certainly a bug... Could you tell me whether this happens even the first time after insertion of the rtai_posix module ?
Also, why do you link your program with the rtai library, rtai-config --posix-ldflags should be enough ?
Signature · 1 line
Gilles Chanteperdrix.
Quoted 8 lines · Luotao Fu
I scratched some simple code which causes this Kernel Ooops. Packed a tar ball together with the makefile and attached the tar ball it to this mail so that you might have a look at it yourself.
I'm using
Kernel: Vanilla 2.6.12 patched with adeos-linux-2.6.12-i386-r12.patch Distr. Debian 3.1
Testhost: vmware 5.0
compiler gcc 3.3.5
Sorry for the second answer: what version of RTAI/Fusion ? If it is easy for you, could you try with the current version of Xenomai ?
Signature · 1 line
Gilles Chanteperdrix.
Hi,
Quoted 10 lines · Gilles Chanteperdrix
Quoted 8 lines · Luotao Fu
I scratched some simple code which causes this Kernel Ooops. Packed a tar ball together with the makefile and attached the tar ball it to this mail so that you might have a look at it yourself.
I'm using
Kernel: Vanilla 2.6.12 patched with adeos-linux-2.6.12-i386-r12.patch Distr. Debian 3.1
Testhost: vmware 5.0
compiler gcc 3.3.5
Quoted 4 lines
Sorry for the second answer: what version of RTAI/Fusion ? If it is easy for you, could you try with the current version of Xenomai ?
Thanx for you answer.
Sorry for the insufficiency, I forgot to mention it. I use fusion 0.9.1, compiled it just two weeks ago. To the questions in you last mail:
1.Yes I get the oops also the first time after I inserted the posix module.
2. The complete Oops message: see attachment
Hope it helps.
Thanx again
Cheers
Luotao Fu
Unable to handle kernel paging request at virtual address 6b6b6b77 printing eip: c4aaef89 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfs lockd sunrpc rtai_posix rtai_nucleus rtai_hal md5 ipv6 af_packet piix ide_generic intel_agp evdev sd_mod ide_cd cdrom ide_disk ide_core floppy vga16fb vgastate mptscsih mptbase scsi_mod unix CPU: 0 EIP: 0060:[<c4aaef89>] Not tainted VLI EFLAGS: 00010082 (2.6.12.6-adeos-patched)
EIP is at xnpod_schedule+0x754/0x87b [rtai_nucleus]
eax: 6b6b6b6b ebx: c4abf110 ecx: 8005003b edx: c2d5b020
esi: 00000000 edi: c4b58330 ebp: c2d5b540 esp: c2f2bedc
ds: 007b es: 007b ss: 0068
Process test (pid: 1658, threadinfo=c2f2a000 task=c2d5b540)
Stack: 00000000 00200000 00000001 c4abede0 c4abf110 c4b50033 c0100000 00000000
8005003b c4abf460 c4b58330 00000000 00000000 c4aadcf9 00000000 c4abede0
00000100 00000000 c4b58330 c4a5bfa8 c0353868 c4ab1de1 c4b58330 00000100
Call Trace:
[<c4aadcf9>] xnpod_suspend_thread+0x178/0x1d1 [rtai_nucleus]
[<c4ab1de1>] xnshadow_relax+0xa6/0xf4 [rtai_nucleus]
[<c4ab27cd>] hisyscall_event+0x261/0x2af [rtai_nucleus]
[<c0129c76>] __adeos_handle_event+0x70/0x113
[<c010d239>] __adeos_enter_syscall+0x16/0x83
[<c0102851>] system_call+0x25/0x46
Code: 00 74 05 0f ae 08 eb 02 dd 20 8b 54 24 10 8b 44 24 0c 89 90 20 03 00 00 eb 5a 8b 5c 24 10 8b 93 10 02 00 00 85 d2 74 09 8b 42 04 <f6> 40 0c 01 74 43 0f 06 a1 8c d2 2a c0 a9 00 00 00 01 75 35 85
<6>note: test[1658] exited with preempt_count 2Quoted 45 lines · Luotao Fu
Hi,
Quoted 10 lines · Gilles Chanteperdrix
Quoted 8 lines · Luotao Fu
I scratched some simple code which causes this Kernel Ooops. Packed a tar ball together with the makefile and attached the tar ball it to this mail so that you might have a look at it yourself.
I'm using
Kernel: Vanilla 2.6.12 patched with adeos-linux-2.6.12-i386-r12.patch Distr. Debian 3.1
Testhost: vmware 5.0
compiler gcc 3.3.5Quoted 4 lines
Sorry for the second answer: what version of RTAI/Fusion ? If it is easy for you, could you try with the current version of Xenomai ?
Thanx for you answer.
Sorry for the insufficiency, I forgot to mention it. I use fusion 0.9.1, compiled it just two weeks ago. To the questions in you last mail:
1.Yes I get the oops also the first time after I inserted the posix module.
2. The complete Oops message: see attachmentHope it helps.
Thanx again
Cheers
Luotao FuUnable to handle kernel paging request at virtual address 6b6b6b77 printing eip: c4aaef89 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfs lockd sunrpc rtai_posix rtai_nucleus rtai_hal md5 ipv6 af_packet piix ide_generic intel_agp evdev sd_mod ide_cd cdrom ide_disk ide_core floppy vga16fb vgastate mptscsih mptbase scsi_mod unix CPU: 0 EIP: 0060:[<c4aaef89>] Not tainted VLI EFLAGS: 00010082 (2.6.12.6-adeos-patched)EIP is at
xnpod_schedule+0x754/0x87b[rtai_nucleus]
eax:6b6b6b6bebx:c4abf110ecx:8005003bedx:c2d5b020
esi: 00000000 edi:c4b58330ebp:c2d5b540esp:c2f2bedc
ds: 007b es: 007b ss: 0068
Process test (pid: 1658, threadinfo=c2f2a000 task=c2d5b540)
Quoted 13 lines
Stack: 00000000 00200000 00000001 c4abede0 c4abf110 c4b50033 c0100000 00000000
8005003b c4abf460 c4b58330 00000000 00000000 c4aadcf9 00000000 c4abede0
00000100 00000000 c4b58330 c4a5bfa8 c0353868 c4ab1de1 c4b58330 00000100
Call Trace:
[<c4aadcf9>] xnpod_suspend_thread+0x178/0x1d1 [rtai_nucleus]
[<c4ab1de1>] xnshadow_relax+0xa6/0xf4 [rtai_nucleus]
[<c4ab27cd>] hisyscall_event+0x261/0x2af [rtai_nucleus]
[<c0129c76>] __adeos_handle_event+0x70/0x113
[<c010d239>] __adeos_enter_syscall+0x16/0x83
[<c0102851>] system_call+0x25/0x46
Code: 00 74 05 0f ae 08 eb 02 dd 20 8b 54 24 10 8b 44 24 0c 89 90 20 03 00 00 eb 5a 8b 5c 24 10 8b 93 10 02 00 00 85 d2 74 09 8b 42 04 <f6> 40 0c 01 74 43 0f 06 a1 8c d2 2a c0 a9 00 00 00 01 75 35 85
<6>note: test[1658] exited with preempt_count 2Ok, you really ought to try xenomai, because this strangely looks like a bug that was fixed. It was not as reproducible as that in my test cases though...
Signature · 1 line
Gilles Chanteperdrix.
Quoted 3 lines · Gilles Chanteperdrix
Ok, you really ought to try xenomai, because this strangely looks like a bug that was fixed. It was not as reproducible as that in my test cases though...
Instructions to download current revision of xenomai sources may be found here :
https://gna.org/svn/?group=xenomai
Signature · 1 line
Gilles Chanteperdrix.