All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] RTDM-native brushup
@ 2015-06-15 14:39 Michael Haberler
  2015-06-17 18:37 ` Jan Kiszka
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Haberler @ 2015-06-15 14:39 UTC (permalink / raw)
  To: xenomai

ok, so tried to just get RTDM support and rtdmtest build as module and loadable without error, and that works

I did not bother fixing the sk_alloc() etc proto related changes for now
Kernel was 3.2.0-4-rt-686-pae #1 SMP PREEMPT RT Debian 3.2.68-1+deb7u1 i686 GNU/Linux (RT-PREEMPT kernel in debian wheezy)


this is where I am:  https://github.com/mhaberler/rtdm-native/commits/try1

do not expect my API transmogrifications to be correct, those were based on "maximum likelihood" guesstimates


modprobe rtdm
[31537.309416] starting RTDM services.

modprobe rtdmtest
[31540.595708] __rtdmtest_init: registering device rttest0, err=251

mah@nwheezy:~/rtdm-native/ksrc/drivers/testing$ grep rttes /proc/devices 
251 rttest0

rmmod rtdmtest
[31551.675050] rtdm_task_destroy: not allowed on user threads
[31551.675053] rtdm_task_join_nrt: not allowed on user threads
[31551.675056] __rtdmtest_exit: unregistering device rttest0

rmmod rtdm
[31557.916463] stopping RTDM services.

the rtdm_task_destroy ff warning re user threads I cant make much sense of, I guess some underlying change

examples/rtdm-native/rtdmtest fails since /dev/rttest0 doesnt show up, I guess hotplug/udev update required - not sure how to force creation of the /dev entry otherwise

I am unsure where to go from here - I looked over the xenomai-3 rtdm changes and I dont feel I'm qualified to track those

- Michael






^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-15 14:39 [Xenomai] RTDM-native brushup Michael Haberler
@ 2015-06-17 18:37 ` Jan Kiszka
  2015-06-19 10:14   ` Michael Haberler
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-06-17 18:37 UTC (permalink / raw)
  To: Michael Haberler, xenomai

On 2015-06-15 16:39, Michael Haberler wrote:
> ok, so tried to just get RTDM support and rtdmtest build as module and loadable without error, and that works
> 
> I did not bother fixing the sk_alloc() etc proto related changes for now
> Kernel was 3.2.0-4-rt-686-pae #1 SMP PREEMPT RT Debian 3.2.68-1+deb7u1 i686 GNU/Linux (RT-PREEMPT kernel in debian wheezy)
> 
> 
> this is where I am:  https://github.com/mhaberler/rtdm-native/commits/try1
> 
> do not expect my API transmogrifications to be correct, those were based on "maximum likelihood" guesstimates
> 
> 
> modprobe rtdm
> [31537.309416] starting RTDM services.
> 
> modprobe rtdmtest
> [31540.595708] __rtdmtest_init: registering device rttest0, err=251
> 
> mah@nwheezy:~/rtdm-native/ksrc/drivers/testing$ grep rttes /proc/devices 
> 251 rttest0
> 
> rmmod rtdmtest
> [31551.675050] rtdm_task_destroy: not allowed on user threads
> [31551.675053] rtdm_task_join_nrt: not allowed on user threads
> [31551.675056] __rtdmtest_exit: unregistering device rttest0
> 
> rmmod rtdm
> [31557.916463] stopping RTDM services.
> 
> the rtdm_task_destroy ff warning re user threads I cant make much sense of, I guess some underlying change

I would start checking if rtdm_task_has_magic(task) returns false, and
why. But I would also check the current kernel API /wrt kthread
management. There were some changes since then, and likely better
mappings are available now.

> 
> examples/rtdm-native/rtdmtest fails since /dev/rttest0 doesnt show up, I guess hotplug/udev update required - not sure how to force creation of the /dev entry otherwise

mknod?

> 
> I am unsure where to go from here - I looked over the xenomai-3 rtdm changes and I dont feel I'm qualified to track those

I suppose you have a use case / driver in mind. So it would probably be
best for you to fix / revise the native layer along that usage profile,
starting with init/cleanup functions, then extending to runtime services.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-17 18:37 ` Jan Kiszka
@ 2015-06-19 10:14   ` Michael Haberler
  2015-06-19 11:58     ` Gilles Chanteperdrix
  2015-06-19 12:14     ` Jan Kiszka
  0 siblings, 2 replies; 12+ messages in thread
From: Michael Haberler @ 2015-06-19 10:14 UTC (permalink / raw)
  To: Jan Kiska; +Cc: xenomai

Jan - thanks! I made minor progress. duh on the mknod..

I switched to a more recent kernel: http://static.mah.priv.at/public/3.18.13-rt10/
hardware=Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014

mutated to the kthread API  (approximate - no idea if correct, but previous task error gone): https://github.com/mhaberler/rtdm-native/commits/try1 6e13d3


some results - not sure if this is actual progress as I have a hard time telling what the expected output should be

I _think_ mutex and event tests are OK (modulo event rc, see below), sema seems to need more love:



insmod ./rtdm.ko
insmod ./rtdmtest.ko
dmesg
...
[35584.519628] starting RTDM services.
[35596.986261] __rtdmtest_init: registering device rttest0, err=250

mknod /dev/rttest0 c 250 0


--- no option - seems to look good:

root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest
Events 0/0 Sems 0/0 Mutex 0
Events 488/488 Sems 0/0 Mutex 0
Events 979/979 Sems 0/0 Mutex 0
Events 1471/1471 Sems 0/0 Mutex 0
Events 1962/1962 Sems 0/0 Mutex 0
Events 2449/2449 Sems 0/0 Mutex 0
Events 2934/2934 Sems 0/0 Mutex 0
Events 3425/3425 Sems 0/0 Mutex 0
Events 3916/3916 Sems 0/0 Mutex 0
Events 4408/4408 Sems 0/0 Mutex 0
^Csighand: signal=2
Exiting event_signal_thread
Exiting event_wait_thread
Events 4535/4535 Sems 0/0 Mutex 0
Canceling threads
Join wait thread
Join signal thread
Exit...

dmesg
[35684.441898] rtdmtest_close state=0x0


--- mutex test option, good too ?

root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# /home/mah/rtdm-native/examples/rtdm-native/rtdmtest -m -c 10
Events 0/0 Sems 0/0 Mutex 0
Events 0/0 Sems 0/0 Mutex 493
Events 0/0 Sems 0/0 Mutex 986
Events 0/0 Sems 0/0 Mutex 1479
Events 0/0 Sems 0/0 Mutex 1972
Events 0/0 Sems 0/0 Mutex 2465
Events 0/0 Sems 0/0 Mutex 2958
Events 0/0 Sems 0/0 Mutex 3451
^Csighand: signal=2
ioctl MUTEX_TEST: Identifier removed
Events 0/0 Sems 0/0 Mutex 3712
Mutex lock count: 3712 (3712)
Canceling threads
Join wait thread
Join signal thread
Exit...

dmesg
[  392.644744] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
[  392.654617] rtdmtest_close state=0x0


---- event test, close rc looks suspicious:

root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# vi /home/mah/rtdm-native/examples/rtdm-native/rtdmtest.c
root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# /home/mah/rtdm-native/examples/rtdm-native/rtdmtest -e -c 10
ioctl EVENT_WAIT: Identifier removed
Exiting event_signal_thread
Exiting event_wait_thread
Events 10/10 Sems 0/0 Mutex 0
Canceling threads
Join wait thread
Join signal thread
Exit...

dmesg
[  453.515225] rtdmtest_close state=0x4           <--------- 0x4 - suspicious?


---- sema test, oopses and locks up:
---- screenshot  http://snag.gy/GWFDe.jpg


root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# /home/mah/rtdm-native/examples/rtdm-native/rtdmtest -s -c 10

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115390] CPU: 0 PID: 2004 Comm: rtdmtest Tainted: G           O   3.18.13-rt10mah+ #1

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115392] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115396] task: f37de600 ti: f4c8c000 task.ti: f4c8c000

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115418] Stack:

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115438] Call Trace:

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115583] Code: 8b 35 74 d6 53 c1 e8 2d 0a 00 00 31 c9 89 f2 6a 01 89 d8 e8 60 24 d3 ff 5f 85 c0 0f 85 37 01 00 00 8b 43 0c 83 e0 fe 39 c6 75 02 <0f> 0b 8d be dc 04 00 00 89 f8 e8 13 0a 00 00 8b 06 89 46 04 64

Message from syslogd@j1900 at Jun 19 11:58:55 ...
 kernel:[  511.115590] EIP: [<c13270c3>] rt_spin_lock_slowlock+0x54/0x190 SS:ESP 0068:f4c8de1c





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 10:14   ` Michael Haberler
@ 2015-06-19 11:58     ` Gilles Chanteperdrix
  2015-06-19 12:07       ` Jan Kiszka
  2015-06-19 12:14     ` Jan Kiszka
  1 sibling, 1 reply; 12+ messages in thread
From: Gilles Chanteperdrix @ 2015-06-19 11:58 UTC (permalink / raw)
  To: Michael Haberler; +Cc: Jan Kiska, xenomai


Michael Haberler wrote:
> Jan - thanks! I made minor progress. duh on the mknod..

Note that it is possible to get devices to be automatically created by
udev/devtmptfs, I did the exercise once. I think you need the device to be
instances of a "device class", or something like that.

Also note that with the advent of devtmpfs, the complexity of udev, the
slow down it causes to the boot procses, and its entanglement with
systemd, devtmpfs is probably a better choice on embedded systems now. If
you need a larger subset of udev functionality, you can also have a look
at busybox mdev.

-- 
                                            Gilles.
https://click-hack.org



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 11:58     ` Gilles Chanteperdrix
@ 2015-06-19 12:07       ` Jan Kiszka
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2015-06-19 12:07 UTC (permalink / raw)
  To: Gilles Chanteperdrix, Michael Haberler; +Cc: xenomai

On 2015-06-19 13:58, Gilles Chanteperdrix wrote:
> 
> Michael Haberler wrote:
>> Jan - thanks! I made minor progress. duh on the mknod..
> 
> Note that it is possible to get devices to be automatically created by
> udev/devtmptfs, I did the exercise once. I think you need the device to be
> instances of a "device class", or something like that.

Exactly, kernel/cobalt/pipe.c contains that pattern, to name just one
example. mknod is only a quick workaround.

> 
> Also note that with the advent of devtmpfs, the complexity of udev, the
> slow down it causes to the boot procses, and its entanglement with
> systemd, devtmpfs is probably a better choice on embedded systems now. If
> you need a larger subset of udev functionality, you can also have a look
> at busybox mdev.
> 

That should be an independent optimization path.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 10:14   ` Michael Haberler
  2015-06-19 11:58     ` Gilles Chanteperdrix
@ 2015-06-19 12:14     ` Jan Kiszka
  2015-06-19 13:27       ` Michael Haberler
  1 sibling, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-06-19 12:14 UTC (permalink / raw)
  To: Michael Haberler, Wolfgang Grandegger; +Cc: xenomai

On 2015-06-19 12:14, Michael Haberler wrote:
> Jan - thanks! I made minor progress. duh on the mknod..
> 
> I switched to a more recent kernel: http://static.mah.priv.at/public/3.18.13-rt10/
> hardware=Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014
> 
> mutated to the kthread API  (approximate - no idea if correct, but previous task error gone): https://github.com/mhaberler/rtdm-native/commits/try1 6e13d3
> 
> 
> some results - not sure if this is actual progress as I have a hard time telling what the expected output should be
> 
> I _think_ mutex and event tests are OK (modulo event rc, see below), sema seems to need more love:
> 
> 
> 
> insmod ./rtdm.ko
> insmod ./rtdmtest.ko
> dmesg
> ...
> [35584.519628] starting RTDM services.
> [35596.986261] __rtdmtest_init: registering device rttest0, err=250
> 
> mknod /dev/rttest0 c 250 0
> 
> 
> --- no option - seems to look good:
> 
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest
> Events 0/0 Sems 0/0 Mutex 0
> Events 488/488 Sems 0/0 Mutex 0
> Events 979/979 Sems 0/0 Mutex 0
> Events 1471/1471 Sems 0/0 Mutex 0
> Events 1962/1962 Sems 0/0 Mutex 0
> Events 2449/2449 Sems 0/0 Mutex 0
> Events 2934/2934 Sems 0/0 Mutex 0
> Events 3425/3425 Sems 0/0 Mutex 0
> Events 3916/3916 Sems 0/0 Mutex 0
> Events 4408/4408 Sems 0/0 Mutex 0
> ^Csighand: signal=2
> Exiting event_signal_thread
> Exiting event_wait_thread
> Events 4535/4535 Sems 0/0 Mutex 0
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> dmesg
> [35684.441898] rtdmtest_close state=0x0
> 
> 
> --- mutex test option, good too ?
> 
> root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# /home/mah/rtdm-native/examples/rtdm-native/rtdmtest -m -c 10
> Events 0/0 Sems 0/0 Mutex 0
> Events 0/0 Sems 0/0 Mutex 493
> Events 0/0 Sems 0/0 Mutex 986
> Events 0/0 Sems 0/0 Mutex 1479
> Events 0/0 Sems 0/0 Mutex 1972
> Events 0/0 Sems 0/0 Mutex 2465
> Events 0/0 Sems 0/0 Mutex 2958
> Events 0/0 Sems 0/0 Mutex 3451
> ^Csighand: signal=2
> ioctl MUTEX_TEST: Identifier removed
> Events 0/0 Sems 0/0 Mutex 3712
> Mutex lock count: 3712 (3712)
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> dmesg
> [  392.644744] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
> [  392.654617] rtdmtest_close state=0x0
> 
> 
> ---- event test, close rc looks suspicious:
> 
> root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# vi /home/mah/rtdm-native/examples/rtdm-native/rtdmtest.c
> root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# /home/mah/rtdm-native/examples/rtdm-native/rtdmtest -e -c 10
> ioctl EVENT_WAIT: Identifier removed
> Exiting event_signal_thread
> Exiting event_wait_thread
> Events 10/10 Sems 0/0 Mutex 0
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> dmesg
> [  453.515225] rtdmtest_close state=0x4           <--------- 0x4 - suspicious?
> 

Wolfgang, do you have in memory how these tests should look like when
all was fine?

> 
> ---- sema test, oopses and locks up:
> ---- screenshot  http://snag.gy/GWFDe.jpg
> 

Serial logs preferred (the top of the error message is missing)... Or
stick everything into the KVM machine and debug from there.

> 
> root@j1900:/home/mah/rtdm-native/ksrc/drivers/testing# /home/mah/rtdm-native/examples/rtdm-native/rtdmtest -s -c 10
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115390] CPU: 0 PID: 2004 Comm: rtdmtest Tainted: G           O   3.18.13-rt10mah+ #1
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115392] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115396] task: f37de600 ti: f4c8c000 task.ti: f4c8c000
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115418] Stack:
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115438] Call Trace:
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115583] Code: 8b 35 74 d6 53 c1 e8 2d 0a 00 00 31 c9 89 f2 6a 01 89 d8 e8 60 24 d3 ff 5f 85 c0 0f 85 37 01 00 00 8b 43 0c 83 e0 fe 39 c6 75 02 <0f> 0b 8d be dc 04 00 00 89 f8 e8 13 0a 00 00 8b 06 89 46 04 64
> 
> Message from syslogd@j1900 at Jun 19 11:58:55 ...
>  kernel:[  511.115590] EIP: [<c13270c3>] rt_spin_lock_slowlock+0x54/0x190 SS:ESP 0068:f4c8de1c
> 
> 
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 12:14     ` Jan Kiszka
@ 2015-06-19 13:27       ` Michael Haberler
  2015-06-19 13:35         ` Jan Kiszka
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Haberler @ 2015-06-19 13:27 UTC (permalink / raw)
  To: Jan Kiska; +Cc: xenomai


> Am 19.06.2015 um 14:14 schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
..

> Serial logs preferred (the top of the error message is missing)...

(wild guess: spinlocks around here: https://github.com/mhaberler/rtdm-native/blob/6e13d330b69608cc6480a21cf0a2458aeeae86b9/ksrc/skins/rtdm/native/drvlib.c#L215-L260)

a systemd configuration safari later - serial console output:

root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -s -c 10

console:

> j1900 login: [  595.174003] starting RTDM services.
> [  600.472950] __rtdmtest_init: registering device rttest0, err=250
> [  678.281348] rtdmtest_close state=0x4
> [  697.224846] ------------[ cut here ]------------
> [  697.224850] kernel BUG at kernel/locking/rtmutex.c:996!
> [  697.224855] invalid opcode: 0000 [#1] PREEMPT SMP
> [  697.224919] Modules linked in: rtdmtest(O) rtdm(O) rpcsec_gss_krb5 nfsv4 binfmt_misc cfg80211 rfkill hid_generic nfsd iTCO_wdt iTCO_vendor_support auth_rpcgss oid_registry nfs_acl evdev nfs ppdev lockd grace fscache sunrpc usbhid hid coretemp kvm_intel kvm snd_hda_codec_hdmi snd_hda_codec_realtek psmouse serio_raw snd_hda_codec_generic pcspkr snd_hda_intel snd_hda_controller snd_hda_codec lpc_ich i2c_i801 snd_hwdep mfd_core snd_pcm snd_timer snd shpchp soundcore battery parport_pc parport i915 video drm_kms_helper acpi_cpufreq drm i2c_algo_bit button i2c_core processor loop fuse autofs4 ext4 crc16 jbd2 mbcache microcode sg sd_mod xhci_pci xhci_hcd crc32c_intel ahci libahci libata r8169 usbcore fan thermal mii usb_common scsi_mod thermal_sys
> [  697.224925] CPU: 2 PID: 1495 Comm: rtdmtest Tainted: G           O   3.18.13-rt10mah+ #1
> [  697.224927] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014
> [  697.224931] task: f18a8660 ti: f18f2000 task.ti: f18f2000
> [  697.224934] EIP: 0060:[<c13270c3>] EFLAGS: 00010246 CPU: 2
> [  697.224942] EIP is at rt_spin_lock_slowlock+0x54/0x190
> [  697.224944] EAX: f18a8660 EBX: f353fec0 ECX: 00000000 EDX: f18a8660
> [  697.224947] ESI: f18a8660 EDI: 00000001 EBP: f18f3e28 ESP: f18f3e1c
> [  697.224949]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
> [  697.224952] CR0: 8005003b CR2: 08156be0 CR3: 3089d000 CR4: 001007d0
> [  697.224953] Stack:
> [  697.224960]  c1049433 f4cbb960 00000002 f18f3e28 00000046 c153ece4 f18f3e34 00000691
> [  697.224966]  f18a8660 00000000 c153e8e0 00000001 c1030d9b f353fec0 f18f3e78 f353feb8
> [  697.224972]  f18a8660 c1055bb3 f353feb4 f353fec0 f86b9834 00000691 00000000 00000001
> [  697.224973] Call Trace:
> [  697.224980]  [<c1049433>] ? ttwu_do_wakeup+0x36/0xf7
> [  697.224986]  [<c1030d9b>] ? pin_current_cpu+0x1c/0x12b
> [  697.224992]  [<c1055bb3>] ? add_wait_queue_exclusive+0x15/0x37
> [  697.225000]  [<f86b9834>] ? _rtdm_sem_down+0x57/0x122 [rtdm]
> [  697.225005]  [<c104bd2f>] ? wake_up_state+0x7/0x7
> [  697.225011]  [<f86fb5ec>] ? rtdmtest_ioctl+0x318/0x4fd [rtdmtest]
> [  697.225018]  [<c1022ab0>] ? smp_apic_timer_interrupt+0x22/0x2b
> [  697.225023]  [<c1328979>] ? apic_timer_interrupt+0x2d/0x34
> [  697.225030]  [<f86b9c48>] ? _rtdm_chrdev_ioctl+0x23/0x3e [rtdm]
> [  697.225035]  [<f86b9c25>] ? rtdm_context_get+0x3/0x3 [rtdm]
> [  697.225041]  [<c10fde26>] ? do_vfs_ioctl+0x384/0x440
> [  697.225045]  [<c104af4a>] ? _sched_setscheduler+0x6a/0x71
> [  697.225050]  [<c1104a52>] ? __fget+0x4c/0x52
> [  697.225054]  [<c10fdf26>] ? SyS_ioctl+0x44/0x66
> [  697.225059]  [<c13280f0>] ? sysenter_do_call+0x12/0x12
> [  697.225100] Code: 8b 35 74 d6 53 c1 e8 2d 0a 00 00 31 c9 89 f2 6a 01 89 d8 e8 60 24 d3 ff 5f 85 c0 0f 85 37 01 00 00 8b 43 0c 83 e0 fe 39 c6 75 02 <0f> 0b 8d be dc 04 00 00 89 f8 e8 13 0a 00 00 8b 06 89 46 04 64
> [  697.225106] EIP: [<c13270c3>] rt_spin_lock_slowlock+0x54/0x190 SS:ESP 0068:f18f3e1c



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 13:27       ` Michael Haberler
@ 2015-06-19 13:35         ` Jan Kiszka
  2015-06-19 17:51           ` Michael Haberler
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-06-19 13:35 UTC (permalink / raw)
  To: Michael Haberler; +Cc: xenomai

On 2015-06-19 15:27, Michael Haberler wrote:
> 
>> Am 19.06.2015 um 14:14 schrieb Jan Kiszka <jan.kiszka@siemens.com>:
>>
> ..
> 
>> Serial logs preferred (the top of the error message is missing)...
> 
> (wild guess: spinlocks around here: https://github.com/mhaberler/rtdm-native/blob/6e13d330b69608cc6480a21cf0a2458aeeae86b9/ksrc/skins/rtdm/native/drvlib.c#L215-L260)
> 
> a systemd configuration safari later - serial console output:
> 
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -s -c 10
> 
> console:
> 
>> j1900 login: [  595.174003] starting RTDM services.
>> [  600.472950] __rtdmtest_init: registering device rttest0, err=250
>> [  678.281348] rtdmtest_close state=0x4
>> [  697.224846] ------------[ cut here ]------------
>> [  697.224850] kernel BUG at kernel/locking/rtmutex.c:996!

This line of code should tell you what is disliked. Probably that
interrupts are off (spin_lock_irqsave).

>> [  697.224855] invalid opcode: 0000 [#1] PREEMPT SMP
>> [  697.224919] Modules linked in: rtdmtest(O) rtdm(O) rpcsec_gss_krb5 nfsv4 binfmt_misc cfg80211 rfkill hid_generic nfsd iTCO_wdt iTCO_vendor_support auth_rpcgss oid_registry nfs_acl evdev nfs ppdev lockd grace fscache sunrpc usbhid hid coretemp kvm_intel kvm snd_hda_codec_hdmi snd_hda_codec_realtek psmouse serio_raw snd_hda_codec_generic pcspkr snd_hda_intel snd_hda_controller snd_hda_codec lpc_ich i2c_i801 snd_hwdep mfd_core snd_pcm snd_timer snd shpchp soundcore battery parport_pc parport i915 video drm_kms_helper acpi_cpufreq drm i2c_algo_bit button i2c_core processor loop fuse autofs4 ext4 crc16 jbd2 mbcache microcode sg sd_mod xhci_pci xhci_hcd crc32c_intel ahci libahci libata r8169 usbcore fan thermal mii usb_common scsi_mod thermal_sys
>> [  697.224925] CPU: 2 PID: 1495 Comm: rtdmtest Tainted: G           O   3.18.13-rt10mah+ #1
>> [  697.224927] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014
>> [  697.224931] task: f18a8660 ti: f18f2000 task.ti: f18f2000
>> [  697.224934] EIP: 0060:[<c13270c3>] EFLAGS: 00010246 CPU: 2
>> [  697.224942] EIP is at rt_spin_lock_slowlock+0x54/0x190
>> [  697.224944] EAX: f18a8660 EBX: f353fec0 ECX: 00000000 EDX: f18a8660
>> [  697.224947] ESI: f18a8660 EDI: 00000001 EBP: f18f3e28 ESP: f18f3e1c
>> [  697.224949]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
>> [  697.224952] CR0: 8005003b CR2: 08156be0 CR3: 3089d000 CR4: 001007d0
>> [  697.224953] Stack:
>> [  697.224960]  c1049433 f4cbb960 00000002 f18f3e28 00000046 c153ece4 f18f3e34 00000691
>> [  697.224966]  f18a8660 00000000 c153e8e0 00000001 c1030d9b f353fec0 f18f3e78 f353feb8
>> [  697.224972]  f18a8660 c1055bb3 f353feb4 f353fec0 f86b9834 00000691 00000000 00000001
>> [  697.224973] Call Trace:
>> [  697.224980]  [<c1049433>] ? ttwu_do_wakeup+0x36/0xf7
>> [  697.224986]  [<c1030d9b>] ? pin_current_cpu+0x1c/0x12b
>> [  697.224992]  [<c1055bb3>] ? add_wait_queue_exclusive+0x15/0x37
>> [  697.225000]  [<f86b9834>] ? _rtdm_sem_down+0x57/0x122 [rtdm]
>> [  697.225005]  [<c104bd2f>] ? wake_up_state+0x7/0x7
>> [  697.225011]  [<f86fb5ec>] ? rtdmtest_ioctl+0x318/0x4fd [rtdmtest]
>> [  697.225018]  [<c1022ab0>] ? smp_apic_timer_interrupt+0x22/0x2b
>> [  697.225023]  [<c1328979>] ? apic_timer_interrupt+0x2d/0x34
>> [  697.225030]  [<f86b9c48>] ? _rtdm_chrdev_ioctl+0x23/0x3e [rtdm]
>> [  697.225035]  [<f86b9c25>] ? rtdm_context_get+0x3/0x3 [rtdm]
>> [  697.225041]  [<c10fde26>] ? do_vfs_ioctl+0x384/0x440
>> [  697.225045]  [<c104af4a>] ? _sched_setscheduler+0x6a/0x71
>> [  697.225050]  [<c1104a52>] ? __fget+0x4c/0x52
>> [  697.225054]  [<c10fdf26>] ? SyS_ioctl+0x44/0x66
>> [  697.225059]  [<c13280f0>] ? sysenter_do_call+0x12/0x12
>> [  697.225100] Code: 8b 35 74 d6 53 c1 e8 2d 0a 00 00 31 c9 89 f2 6a 01 89 d8 e8 60 24 d3 ff 5f 85 c0 0f 85 37 01 00 00 8b 43 0c 83 e0 fe 39 c6 75 02 <0f> 0b 8d be dc 04 00 00 89 f8 e8 13 0a 00 00 8b 06 89 46 04 64
>> [  697.225106] EIP: [<c13270c3>] rt_spin_lock_slowlock+0x54/0x190 SS:ESP 0068:f18f3e1c

You probably want to enable frame pointers in order to make the
backtraces more reliable.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 13:35         ` Jan Kiszka
@ 2015-06-19 17:51           ` Michael Haberler
  2015-06-22 15:34             ` Michael Haberler
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Haberler @ 2015-06-19 17:51 UTC (permalink / raw)
  To: Jan Kiska; +Cc: xenomai

rebuilt kernel with CONFIG_FRAME_POINTER; in fact different traceback:

> You probably want to enable frame pointers in order to make the
> backtraces more reliable.

# ./rtdmtest -s -c 10

[   47.872760] starting RTDM services.
[   52.376895] __rtdmtest_init: registering device rttest0, err=250
[  112.437502] ------------[ cut here ]------------
[  112.437505] kernel BUG at kernel/locking/rtmutex.c:996!
[  112.437511] invalid opcode: 0000 [#1] PREEMPT SMP
[  112.437577] Modules linked in: rtdmtest(O) rtdm(O) rpcsec_gss_krb5 nfsv4 binfmt_misc cfg80211 rfkill hid_generic iTCO_wdt iTCO_vendor_support ppdev evdev nfsd auth_rpcgss oid_registry nfs_acl usbhid nfs hid lockd grace fscache sunrpc coretemp kvm_intel kvm snd_hda_codec_hdmi psmouse serio_raw snd_hda_codec_realtek snd_hda_codec_generic pcspkr i2c_i801 snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_pcm snd_timer lpc_ich snd mfd_core shpchp soundcore battery parport_pc parport i915 video drm_kms_helper acpi_cpufreq drm i2c_algo_bit i2c_core button processor loop fuse autofs4 ext4 crc16 jbd2 mbcache microcode sg sd_mod xhci_pci xhci_hcd crc32c_intel ahci libahci libata r8169 mii usbcore fan thermal usb_common scsi_mod thermal_sys
[  112.437584] CPU: 0 PID: 1512 Comm: rtdmtest Tainted: G           O   3.18.13-rt10mah+ #2
[  112.437586] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./J1900N-D3V, BIOS F3 04/29/2014
[  112.437589] task: f0877920 ti: f08a2000 task.ti: f08a2000
[  112.437593] EIP: 0060:[<c133f9a5>] EFLAGS: 00010246 CPU: 0
[  112.437601] EIP is at rt_spin_lock_slowlock+0x50/0x178
[  112.437604] EAX: f0877920 EBX: f6db2ec0 ECX: f0877920 EDX: f0877920
[  112.437607] ESI: 00000001 EDI: f0877920 EBP: f08a3e44 ESP: f08a3e04
[  112.437609]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  112.437612] CR0: 8005003b CR2: b74f2a2a CR3: 308d5000 CR4: 001007d0
[  112.437613] Stack:
[  112.437620]  f52f9a60 00000002 00000001 f08a3e10 00000000 000003ff f08a3e1c f4d3e100
[  112.437627]  00000000 00000000 c15578e0 c1557801 f08a3e3c f6db2ec0 f08a3e74 f6db2eb8
[  112.437634]  f08a3e4c c105cd1d f08a3e54 c134060c f08a3e64 c1058c08 f6db2eb4 f6db2ec0
[  112.437635] Call Trace:
[  112.437645]  [<c105cd1d>] rt_spin_lock_fastlock.constprop.31+0x1e/0x20
[  112.437650]  [<c134060c>] rt_spin_lock+0x8/0xa
[  112.437655]  [<c1058c08>] add_wait_queue_exclusive+0x18/0x3c
[  112.437664]  [<f82f8834>] _rtdm_sem_down+0x57/0x122 [rtdm]
[  112.437670]  [<c104ea24>] ? wake_up_state+0xc/0xc
[  112.437676]  [<f83c75ec>] ? rtdmtest_ioctl+0x318/0x4fd [rtdmtest]
[  112.437680]  [<c104cbcf>] ? get_parent_ip+0xb/0x31
[  112.437685]  [<c104cc5f>] ? preempt_count_add+0x6a/0x7c
[  112.437689]  [<c13404f1>] ? _raw_spin_lock_irqsave+0x14/0x3d
[  112.437694]  [<c1340561>] ? _raw_spin_unlock_irqrestore+0x12/0x36
[  112.437698]  [<c105cf6c>] ? rt_mutex_adjust_pi+0x39/0x6d
[  112.437703]  [<c104dae4>] ? __sched_setscheduler+0x5e9/0x643
[  112.437709]  [<c10b634b>] ? perf_swevent_start_hrtimer.part.39+0x89/0x89
[  112.437715]  [<c1081bbc>] ? smp_call_function_single+0x74/0xa1
[  112.437722]  [<f82f8c48>] ? _rtdm_chrdev_ioctl+0x23/0x3e [rtdm]
[  112.437728]  [<f82f8c25>] ? rtdm_context_get+0x3/0x3 [rtdm]
[  112.437734]  [<c11055a2>] ? do_vfs_ioctl+0x371/0x41a
[  112.437739]  [<c110c7f3>] ? __fget+0x4f/0x56
[  112.437744]  [<c110568e>] ? SyS_ioctl+0x43/0x64
[  112.437749]  [<c1340ab0>] ? sysenter_do_call+0x12/0x12
[  112.437798] Code: 00 00 c6 45 ec 01 e8 63 0a 00 00 31 c9 89 fa 6a 01 89 d8 e8 80 cd d1 ff 5e 85 c0 0f 85 23 01 00 00 8b 43 0c 83 e0 fe 39 c7 75 02 <0f> 0b 8d 87 dc 04 00 00 89 45 c8 e8 4d 0a 00 00 8b 07 89 47 04
[  112.437805] EIP: [<c133f9a5>] rt_spin_lock_slowlock+0x50/0x178 SS:ESP 0068:f08a3e04
[  112.752423] ---[ end trace 0000000000000002 ]---
[  112.752428] note: rtdmtest[1512] exited with preempt_count 1



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-19 17:51           ` Michael Haberler
@ 2015-06-22 15:34             ` Michael Haberler
  2015-06-22 15:50               ` Jan Kiszka
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Haberler @ 2015-06-22 15:34 UTC (permalink / raw)
  To: Jan Kiska; +Cc: xenomai

I now get all tests to pass (as far as I can tell), see below

Has anybody ever gone beyond running rtdmtest with this, like building an actual driver? 

before I spend time on it - did the can and serial drivers actually work?

- Michael

---

Fixed by changing  add_wait_queue_exclusive_locked() to __add_wait_queue_tail_excl()  and
remove_wait_queue_locked() to  __remove_wait_queue() as outlined here: http://permalink.gmane.org/gmane.linux.file-systems/40051

the error message I reported earlier on is simply an result of the rtdmtest driver calling rtdm_task_destroy(&task)  and rtdm_task_join_nrt(&task, 100) on module exit without having actually created an rtdm task, so  pretty sure this already existed

[  154.523718] rtdm_task_destroy: not allowed on user threads
[  154.529468] rtdm_task_join_nrt: not allowed on user threads

status: https://github.com/mhaberler/rtdm-native/commit/2de7f03fa2682af63f2d6e1ea321761f7277d64f

execution logs:

root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest
Events 0/0 Sems 0/0 Mutex 0
Events 483/483 Sems 0/0 Mutex 0
Events 966/966 Sems 0/0 Mutex 0
Events 1448/1448 Sems 0/0 Mutex 0
Events 1932/1932 Sems 0/0 Mutex 0
Events 2423/2423 Sems 0/0 Mutex 0
Events 2914/2914 Sems 0/0 Mutex 0
Events 3400/3400 Sems 0/0 Mutex 0
Events 3884/3884 Sems 0/0 Mutex 0
Events 4367/4367 Sems 0/0 Mutex 0
Events 4854/4854 Sems 0/0 Mutex 0
Events 5345/5345 Sems 0/0 Mutex 0
Events 5832/5832 Sems 0/0 Mutex 0
Events 6321/6321 Sems 0/0 Mutex 0
Events 6812/6812 Sems 0/0 Mutex 0
Events 7303/7303 Sems 0/0 Mutex 0
Events 7793/7793 Sems 0/0 Mutex 0
Events 8284/8284 Sems 0/0 Mutex 0
Events 8775/8775 Sems 0/0 Mutex 0
Events 9266/9266 Sems 0/0 Mutex 0
^Csighand: signal=2
Exiting event_signal_thread
Exiting event_wait_thread
Events 9347/9347[94398.084126] rtdmtest_close state=0x0
 Sems 0/0 Mutex 0
Canceling threads
Join wait thread
Join signal thread
Exit...


root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -m -c 10
Events 0/0 Sems 0/0 Mutex 0
Events 0/0 Sems 0/0 Mutex 492
Events 0/0 Sems 0/0 Mutex 985
Events 0/0 Sems 0/0 Mutex 1477
Events 0/0 Sems 0/0 Mutex 1970
Events 0/0 Sems 0/0 Mutex 2462
Events 0/0 Sems 0/0 Mutex 2955
Events 0/0 Sems 0/0 Mutex 3447
Events 0/0 Sems 0/0 Mutex 3940
Events 0/0 Sems 0/0 Mutex 4433
Events 0/0 Sems 0/0 Mutex 4925
Events 0/0 Sems 0/0 Mutex 5418
Events 0/0 Sems 0/0 Mutex 5910
Events 0/0 Sems 0/0 Mutex 6403
Events 0/0 Sems 0/0 Mutex 6896
^Csighand: signal=2
ioctl MUTEX_TEST: Identifier removed
[94428.098513] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
Events 0/0 Sems [94428.103216] rtdmtest_close state=0x0
0/0 Mutex 7083
Mutex lock count: 7083 (7083)
Canceling threads
Join wait thread
Join signal thread
Exit...


root@j1900:/home/mah/rtdm-native/examples/rtdm-native# dmesg 
[94398.084126] rtdmtest_close state=0x0
[94428.098513] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
[94428.103216] rtdmtest_close state=0x0
root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -e -c 10
ioctl EVENT_WAIT: Identifier removed
Exiting event_wait_thread
Exiting event_signal_thread
[94466.305761] rtdmtest_close state=0x4
Events 10/10 Sems 0/0 Mutex 0
Canceling threads
Join wait thread
Join signal thread
Exit...


root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -s -c 10
ioctl SEM_DOWN: [94547.555904] rtdm_nrtsig_handler called
Identifier removed
[94548.546266] rtdmtest_close state=0x0
Events 0/0 Sems 10/10 Mutex 0
Canceling threads
Join wait thread
Join signal thread
Exit...


dmesg after above runs:

root@j1900:~# dmesg 
[   89.364268] starting RTDM services.
[   93.597113] __rtdmtest_init: registering device rttest0, err=250
[  177.201902] rtdmtest_close state=0x0
[  190.092607] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
[  190.097406] rtdmtest_close state=0x0
[  199.686598] rtdmtest_close state=0x4
[  207.570485] rtdm_nrtsig_handler called
[  208.561437] rtdmtest_close state=0x0



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-22 15:34             ` Michael Haberler
@ 2015-06-22 15:50               ` Jan Kiszka
  2015-06-22 22:46                 ` Michael Haberler
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-06-22 15:50 UTC (permalink / raw)
  To: Michael Haberler, Wolfgang Grandegger; +Cc: xenomai

On 2015-06-22 17:34, Michael Haberler wrote:
> I now get all tests to pass (as far as I can tell), see below

Nice!

> 
> Has anybody ever gone beyond running rtdmtest with this, like building an actual driver? 
> 
> before I spend time on it - did the can and serial drivers actually work?

Did you search the archive / announcements in this regard? Also adding
Wolfgang once again.

Jan

> 
> - Michael
> 
> ---
> 
> Fixed by changing  add_wait_queue_exclusive_locked() to __add_wait_queue_tail_excl()  and
> remove_wait_queue_locked() to  __remove_wait_queue() as outlined here: http://permalink.gmane.org/gmane.linux.file-systems/40051
> 
> the error message I reported earlier on is simply an result of the rtdmtest driver calling rtdm_task_destroy(&task)  and rtdm_task_join_nrt(&task, 100) on module exit without having actually created an rtdm task, so  pretty sure this already existed
> 
> [  154.523718] rtdm_task_destroy: not allowed on user threads
> [  154.529468] rtdm_task_join_nrt: not allowed on user threads
> 
> status: https://github.com/mhaberler/rtdm-native/commit/2de7f03fa2682af63f2d6e1ea321761f7277d64f
> 
> execution logs:
> 
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest
> Events 0/0 Sems 0/0 Mutex 0
> Events 483/483 Sems 0/0 Mutex 0
> Events 966/966 Sems 0/0 Mutex 0
> Events 1448/1448 Sems 0/0 Mutex 0
> Events 1932/1932 Sems 0/0 Mutex 0
> Events 2423/2423 Sems 0/0 Mutex 0
> Events 2914/2914 Sems 0/0 Mutex 0
> Events 3400/3400 Sems 0/0 Mutex 0
> Events 3884/3884 Sems 0/0 Mutex 0
> Events 4367/4367 Sems 0/0 Mutex 0
> Events 4854/4854 Sems 0/0 Mutex 0
> Events 5345/5345 Sems 0/0 Mutex 0
> Events 5832/5832 Sems 0/0 Mutex 0
> Events 6321/6321 Sems 0/0 Mutex 0
> Events 6812/6812 Sems 0/0 Mutex 0
> Events 7303/7303 Sems 0/0 Mutex 0
> Events 7793/7793 Sems 0/0 Mutex 0
> Events 8284/8284 Sems 0/0 Mutex 0
> Events 8775/8775 Sems 0/0 Mutex 0
> Events 9266/9266 Sems 0/0 Mutex 0
> ^Csighand: signal=2
> Exiting event_signal_thread
> Exiting event_wait_thread
> Events 9347/9347[94398.084126] rtdmtest_close state=0x0
>  Sems 0/0 Mutex 0
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> 
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -m -c 10
> Events 0/0 Sems 0/0 Mutex 0
> Events 0/0 Sems 0/0 Mutex 492
> Events 0/0 Sems 0/0 Mutex 985
> Events 0/0 Sems 0/0 Mutex 1477
> Events 0/0 Sems 0/0 Mutex 1970
> Events 0/0 Sems 0/0 Mutex 2462
> Events 0/0 Sems 0/0 Mutex 2955
> Events 0/0 Sems 0/0 Mutex 3447
> Events 0/0 Sems 0/0 Mutex 3940
> Events 0/0 Sems 0/0 Mutex 4433
> Events 0/0 Sems 0/0 Mutex 4925
> Events 0/0 Sems 0/0 Mutex 5418
> Events 0/0 Sems 0/0 Mutex 5910
> Events 0/0 Sems 0/0 Mutex 6403
> Events 0/0 Sems 0/0 Mutex 6896
> ^Csighand: signal=2
> ioctl MUTEX_TEST: Identifier removed
> [94428.098513] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
> Events 0/0 Sems [94428.103216] rtdmtest_close state=0x0
> 0/0 Mutex 7083
> Mutex lock count: 7083 (7083)
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> 
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# dmesg 
> [94398.084126] rtdmtest_close state=0x0
> [94428.098513] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
> [94428.103216] rtdmtest_close state=0x0
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -e -c 10
> ioctl EVENT_WAIT: Identifier removed
> Exiting event_wait_thread
> Exiting event_signal_thread
> [94466.305761] rtdmtest_close state=0x4
> Events 10/10 Sems 0/0 Mutex 0
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> 
> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -s -c 10
> ioctl SEM_DOWN: [94547.555904] rtdm_nrtsig_handler called
> Identifier removed
> [94548.546266] rtdmtest_close state=0x0
> Events 0/0 Sems 10/10 Mutex 0
> Canceling threads
> Join wait thread
> Join signal thread
> Exit...
> 
> 
> dmesg after above runs:
> 
> root@j1900:~# dmesg 
> [   89.364268] starting RTDM services.
> [   93.597113] __rtdmtest_init: registering device rttest0, err=250
> [  177.201902] rtdmtest_close state=0x0
> [  190.092607] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
> [  190.097406] rtdmtest_close state=0x0
> [  199.686598] rtdmtest_close state=0x4
> [  207.570485] rtdm_nrtsig_handler called
> [  208.561437] rtdmtest_close state=0x0
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai] RTDM-native brushup
  2015-06-22 15:50               ` Jan Kiszka
@ 2015-06-22 22:46                 ` Michael Haberler
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Haberler @ 2015-06-22 22:46 UTC (permalink / raw)
  To: Jan Kiska; +Cc: xenomai


> Am 22.06.2015 um 17:50 schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
> On 2015-06-22 17:34, Michael Haberler wrote:
>> I now get all tests to pass (as far as I can tell), see below
> 
> Nice!

I _think_ the rtdm_task API is now functional as well: https://github.com/mhaberler/rtdm-native

tested on 3.16 vanilla and 3.18.13-rt

> 
>> 
>> Has anybody ever gone beyond running rtdmtest with this, like building an actual driver? 
>> 
>> before I spend time on it - did the can and serial drivers actually work?
> 
> Did you search the archive / announcements in this regard? Also adding
> Wolfgang once again.

I'll see if I can make the gpio-rtdm-irq driver (xenomail2 so far) run on a BB with vanilla and rt-preempt

-Michael

> 
> Jan
> 
>> 
>> - Michael
>> 
>> ---
>> 
>> Fixed by changing  add_wait_queue_exclusive_locked() to __add_wait_queue_tail_excl()  and
>> remove_wait_queue_locked() to  __remove_wait_queue() as outlined here: http://permalink.gmane.org/gmane.linux.file-systems/40051
>> 
>> the error message I reported earlier on is simply an result of the rtdmtest driver calling rtdm_task_destroy(&task)  and rtdm_task_join_nrt(&task, 100) on module exit without having actually created an rtdm task, so  pretty sure this already existed
>> 
>> [  154.523718] rtdm_task_destroy: not allowed on user threads
>> [  154.529468] rtdm_task_join_nrt: not allowed on user threads
>> 
>> status: https://github.com/mhaberler/rtdm-native/commit/2de7f03fa2682af63f2d6e1ea321761f7277d64f
>> 
>> execution logs:
>> 
>> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest
>> Events 0/0 Sems 0/0 Mutex 0
>> Events 483/483 Sems 0/0 Mutex 0
>> Events 966/966 Sems 0/0 Mutex 0
>> Events 1448/1448 Sems 0/0 Mutex 0
>> Events 1932/1932 Sems 0/0 Mutex 0
>> Events 2423/2423 Sems 0/0 Mutex 0
>> Events 2914/2914 Sems 0/0 Mutex 0
>> Events 3400/3400 Sems 0/0 Mutex 0
>> Events 3884/3884 Sems 0/0 Mutex 0
>> Events 4367/4367 Sems 0/0 Mutex 0
>> Events 4854/4854 Sems 0/0 Mutex 0
>> Events 5345/5345 Sems 0/0 Mutex 0
>> Events 5832/5832 Sems 0/0 Mutex 0
>> Events 6321/6321 Sems 0/0 Mutex 0
>> Events 6812/6812 Sems 0/0 Mutex 0
>> Events 7303/7303 Sems 0/0 Mutex 0
>> Events 7793/7793 Sems 0/0 Mutex 0
>> Events 8284/8284 Sems 0/0 Mutex 0
>> Events 8775/8775 Sems 0/0 Mutex 0
>> Events 9266/9266 Sems 0/0 Mutex 0
>> ^Csighand: signal=2
>> Exiting event_signal_thread
>> Exiting event_wait_thread
>> Events 9347/9347[94398.084126] rtdmtest_close state=0x0
>> Sems 0/0 Mutex 0
>> Canceling threads
>> Join wait thread
>> Join signal thread
>> Exit...
>> 
>> 
>> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -m -c 10
>> Events 0/0 Sems 0/0 Mutex 0
>> Events 0/0 Sems 0/0 Mutex 492
>> Events 0/0 Sems 0/0 Mutex 985
>> Events 0/0 Sems 0/0 Mutex 1477
>> Events 0/0 Sems 0/0 Mutex 1970
>> Events 0/0 Sems 0/0 Mutex 2462
>> Events 0/0 Sems 0/0 Mutex 2955
>> Events 0/0 Sems 0/0 Mutex 3447
>> Events 0/0 Sems 0/0 Mutex 3940
>> Events 0/0 Sems 0/0 Mutex 4433
>> Events 0/0 Sems 0/0 Mutex 4925
>> Events 0/0 Sems 0/0 Mutex 5418
>> Events 0/0 Sems 0/0 Mutex 5910
>> Events 0/0 Sems 0/0 Mutex 6403
>> Events 0/0 Sems 0/0 Mutex 6896
>> ^Csighand: signal=2
>> ioctl MUTEX_TEST: Identifier removed
>> [94428.098513] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
>> Events 0/0 Sems [94428.103216] rtdmtest_close state=0x0
>> 0/0 Mutex 7083
>> Mutex lock count: 7083 (7083)
>> Canceling threads
>> Join wait thread
>> Join signal thread
>> Exit...
>> 
>> 
>> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# dmesg 
>> [94398.084126] rtdmtest_close state=0x0
>> [94428.098513] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
>> [94428.103216] rtdmtest_close state=0x0
>> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -e -c 10
>> ioctl EVENT_WAIT: Identifier removed
>> Exiting event_wait_thread
>> Exiting event_signal_thread
>> [94466.305761] rtdmtest_close state=0x4
>> Events 10/10 Sems 0/0 Mutex 0
>> Canceling threads
>> Join wait thread
>> Join signal thread
>> Exit...
>> 
>> 
>> root@j1900:/home/mah/rtdm-native/examples/rtdm-native# ./rtdmtest -s -c 10
>> ioctl SEM_DOWN: [94547.555904] rtdm_nrtsig_handler called
>> Identifier removed
>> [94548.546266] rtdmtest_close state=0x0
>> Events 0/0 Sems 10/10 Mutex 0
>> Canceling threads
>> Join wait thread
>> Join signal thread
>> Exit...
>> 
>> 
>> dmesg after above runs:
>> 
>> root@j1900:~# dmesg 
>> [   89.364268] starting RTDM services.
>> [   93.597113] __rtdmtest_init: registering device rttest0, err=250
>> [  177.201902] rtdmtest_close state=0x0
>> [  190.092607] RTTST_RTIOC_RTDMTEST_MUTEX_GETSTAT
>> [  190.097406] rtdmtest_close state=0x0
>> [  199.686598] rtdmtest_close state=0x4
>> [  207.570485] rtdm_nrtsig_handler called
>> [  208.561437] rtdmtest_close state=0x0
>> 
> 
> -- 
> Siemens AG, Corporate Technology, CT RTC ITP SES-DE
> Corporate Competence Center Embedded Linux



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-22 22:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-15 14:39 [Xenomai] RTDM-native brushup Michael Haberler
2015-06-17 18:37 ` Jan Kiszka
2015-06-19 10:14   ` Michael Haberler
2015-06-19 11:58     ` Gilles Chanteperdrix
2015-06-19 12:07       ` Jan Kiszka
2015-06-19 12:14     ` Jan Kiszka
2015-06-19 13:27       ` Michael Haberler
2015-06-19 13:35         ` Jan Kiszka
2015-06-19 17:51           ` Michael Haberler
2015-06-22 15:34             ` Michael Haberler
2015-06-22 15:50               ` Jan Kiszka
2015-06-22 22:46                 ` Michael Haberler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.