Here it comes.
I found out that if wait is called inside an IOCTL, there is no hangs at all, 
everything work as expected, except from te fact that it seens a litle bit 
strange (to me) to use ioctl to read or write, I would expect to use the 
correspondent rad and write functions and ioctl to setup something.
I tried to reduce the code, in the tarball there are one Makefile, one c file 
for the module and one c file for the app. There is one define line on the 
module file, comment it ou to get the hangs. The app will simply open the 
device, issue an wait ioctl (dummy if the module is compiled to wait in 
read_rt) and the do the actual reading (it hangs on my system if i tell the 
module to wait on the read_rt function).

Here comes the kernel log from one run that does the error but fortunately 
does not hang the entire system.

[  208.986250] Xenomai: RTDM: RT open handler is deprecated, driver requires 
update.
[  208.986256] Xenomai: RTDM: RT close handler is deprecated, driver requires 
update.
[  215.500264] Open Device RT
[  215.500268] rtdm_timer_start returned 0
[  215.500270] IOCTL Device RT. Request = 9
[  215.600264] timer proc function
[  215.600268] rtdm_timer_start_in_handler returned 0
[  215.600270] Read Device RT
[  215.600272] IOCTL Device RT. Request = 9
[  215.700243] timer proc function
[  215.700246] rtdm_timer_start_in_handler returned 0
[  215.700248] Read Device RT
[  215.700250] IOCTL Device RT. Request = 9
[  215.800223] timer proc function
[  215.800227] rtdm_timer_start_in_handler returned 0
[  215.800229] Read Device RT
[  215.800230] IOCTL Device RT. Request = 9
[  215.900205] timer proc function
[  215.900209] rtdm_timer_start_in_handler returned 0
[  215.900211] Read Device RT
[  215.900213] IOCTL Device RT. Request = 9
[  216.000190] timer proc function
[  216.000194] rtdm_timer_start_in_handler returned 0
[  216.000196] Read Device RT
[  216.000197] IOCTL Device RT. Request = 9
[  216.100165] timer proc function
[  216.100170] rtdm_timer_start_in_handler returned 0
[  216.100172] Read Device RT
[  216.100173] IOCTL Device RT. Request = 9
[  216.200169] timer proc function
[  216.200174] rtdm_timer_start_in_handler returned 0
[  216.200176] Read Device RT
[  216.200177] Close Device RT
[  235.671035] Xenomai: RTDM: RT open handler is deprecated, driver requires 
update.
[  235.671041] Xenomai: RTDM: RT close handler is deprecated, driver requires 
update.
[  237.814763] Open Device RT
[  237.814767] rtdm_timer_start returned 0
[  237.814769] IOCTL Device RT. Request = 9
[  237.814771] Read Device RT
[  237.814803] BUG: unable to handle kernel NULL pointer dereference at 
00000000000000c0
[  237.814808] IP: [<ffffffff811408b8>] rtdm_event_timedwait+0x78/0x1a0
[  237.814819] PGD 4557e067 PUD 4f8e1067 PMD 0 
[  237.814823] Oops: 0000 [#1] SMP 
[  237.814827] last sysfs file: 
/sys/devices/pci0000:00/0000:00:0d.0/0000:04:00.0/local_cpus
[  237.814831] CPU 0 
[  237.814834] Modules linked in: testcase_wait_hang binfmt_misc rfcomm sco 
bnep l2cap dm_crypt snd_hda_codec_realtek vmnet vmblock vsock vmci vmmon ppdev 
snd_hda_intel snd_usb_audio snd_usbmidi_lib snd_hda_codec snd_hwdep snd_pcm 
snd_seq_midi snd_seq_midi_event snd_seq snd_rawmidi amd64_edac_mod btusb 
edac_core uvcvideo bluetooth videodev v4l2_compat_ioctl32 snd_timer 
snd_seq_device parport_pc psmouse k8temp asus_atk0110 snd serio_raw 
i2c_nforce2 edac_mce_amd soundcore snd_page_alloc lp parport uvesafb forcedeth 
ahci libahci pata_amd [last unloaded: testcase_wait_hang]
[  237.814878] 
[  237.814881] Pid: 4553, comm: testcase_wait_h Not tainted 2.6.38.8-
xenomai-01 #1 System manufacturer System Product Name/M2N-X
[  237.814888] RIP: 0010:[<ffffffff811408b8>]  [<ffffffff811408b8>] 
rtdm_event_timedwait+0x78/0x1a0
[  237.814894] RSP: 0018:ffff88003a207d28  EFLAGS: 00010246
[  237.814897] RAX: 00000000ffffffff RBX: 0000000000000000 RCX: 000000000000001f
[  237.814900] RDX: 0000000000000000 RSI: 000000003b9aca00 RDI: 
00000000000000a8
[  237.814903] RBP: ffff88003a207d68 R08: 00007f0905e3a238 R09: 00007fff9f313e50
[  237.814906] R10: 00007fff9f314480 R11: 0000000000000206 R12: 
00000000000000a8
[  237.814909] R13: 000000000000ea60 R14: 0000000000000028 R15: ffff88003a207d80
[  237.814913] FS:  00007f0906864720(0000) GS:ffff88007fc00000(0000) 
knlGS:00000000f5fb6710
[  237.814916] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  237.814919] CR2: 00000000000000c0 CR3: 0000000079773000 CR4: 
00000000000006f0
[  237.814922] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[  237.814925] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  237.814929] Process testcase_wait_h (pid: 4553, threadinfo ffff88003a204000, 
task ffff880041a98000)
[  237.814935] Stack:
[  237.814937]  00007fff9f314720 0000000000000028 ffff88003a207d48 
00007fff9f314720
[  237.814942]  ffffc90010909600 00007fff9f314720 0000000000000028 
ffff880041a98000
[  237.814947]  ffff88003a207d98 ffffffffa0297135 ffff88003a207f58 
0000003a8b52e88e
[  237.814952] Call Trace:
[  237.814959]  [<ffffffffa0297135>] testcase_read_rt+0x45/0x90 
[testcase_wait_hang]
[  237.814964]  [<ffffffff8113dd1a>] __rt_dev_read+0x6a/0xc0
[  237.814968]  [<ffffffff81141266>] sys_rtdm_read+0x26/0x30
[  237.814972]  [<ffffffff81109688>] hisyscall_event+0x1e8/0x4c0
[  237.814978]  [<ffffffff81310e90>] ? rb_insert_color+0x110/0x150
[  237.814983]  [<ffffffff810c5bed>] __ipipe_dispatch_event+0x11d/0x1e0
[  237.814989]  [<ffffffff8101eebf>] __ipipe_syscall_root+0x5f/0x140
[  237.814995]  [<ffffffff815c42c1>] __ipipe_syscall_root_thunk+0x35/0x6a
[  237.815001]  [<ffffffff81002ec4>] ? system_call_after_swapgs+0x54/0x79
[  237.815004] Code: 8f 00 83 e3 01 65 8b 14 25 30 c6 00 00 39 c2 0f 84 8e 00 
00 00 b8 ff ff ff ff f0 0f b1 15 31 22 8f 00 83 f8 ff 0f 85 fd 00 00 00 <49> 8b 
44 
24 18 a9 00 00 00 01 0f 85 e2 00 00 00 a9 00 00 00 02 
[  237.815049] RIP  [<ffffffff811408b8>] rtdm_event_timedwait+0x78/0x1a0
[  237.815053]  RSP <ffff88003a207d28>
[  237.815055] CR2: 00000000000000c0
[  237.815059] ---[ end trace af39d7f5f5df4bfd ]---
[  237.823941] Close Device NRT
[  237.914730] timer proc function
[  237.914735] rtdm_timer_start_in_handler returned 0
[  238.014707] timer proc function
[  238.014711] rtdm_timer_start_in_handler returned 0
[  238.114687] timer proc function
[  238.114690] rtdm_timer_start_in_handler returned 0
... goes on forever as the timer was not shut down properly.



Em qui 11 ago 2011, às 04:39:16, Gilles Chanteperdrix escreveu:
> On 08/10/2011 11:10 PM, Carlos Eduardo de Brito Novaes wrote:
> > Hello again.
> > I traced the errors down and now dicovered that calling printf (as it
> > would be) turns a real time task in a non real time one. so I chaged the
> > code and it is almost working as expected, except for something that now
> > seens to be some kind of bug. If I use any sord of
> > rtdm_event_[timed,]wait, the app returns and there is a trace on kernel
> > about a null pointer, just after the call to wait. It seens similar with
> > <http://www.mail-archive.com/xenomai-help@gna.org/msg04427.html>
> > And I there is no other references on google. So I will try to recompile
> > with some changes and maybe test with another kernel. Hope you can point
> > something I am running in a AMD Athlon(tm) 64 X2 Dual Core Processor
> > 4000+, kernel 2.6.38-8, ubuntu natty 11.04 and latest stable xenomai
> > source.
> > If it will help, I can send the code.
> 
> Please try and reduce the code to a simple, self-contained test case
> which we can run to reproduce the issue. It is the only way we can help.

Attachment: testcase_wait_hang.tar.bz2
Description: application/bzip-compressed-tar

_______________________________________________
Xenomai-help mailing list
Xenomai-help@gna.org
https://mail.gna.org/listinfo/xenomai-help

Reply via email to