Skip to contentSkip to conversation

Help on analogy_ni_pcimio (Alexis Berlemont?)

Xenomai-help Ettore Pedretti 5 participants 35 messages Nov 22, 2009 – Feb 10, 2010 1 message not in the archive x86

lore
Share & tools
lore
#0 lore raw

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
	 subdevices count = 0
	 read subdevice index = 0
	 write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f39000-b7f3a000 r--p 00155000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3a000-b7f3c000 rw-p 00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5a000-b7f5b000 rw-p 00001000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5b000-b7f5c000 rw-p 00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119   /usr/lib/libnative.so.3.0.0
b7f63000-b7f64000 rw-p 00006000 08:01 10808119   /usr/lib/libnative.so.3.0.0
b7f64000-b7f67000 r-xp 00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio
xeno_analogy           40220  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mite
xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy
astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio

analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d
<0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001
<0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030
Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8
CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Can anyone help?

Best regards
Ettore Pedretti

#1 lore raw

Hi,

Quoted 244 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f39000-b7f3a000 r--p 00155000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3a000-b7f3c000 rw-p 00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5a000-b7f5b000 rw-p 00001000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5b000-b7f5c000 rw-p 00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119  
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01 10808119
   /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp 00000000 08:01
 10808112   /usr/lib/libanalogy.so.1.0.0 b7f67000-b7f68000 rw-p 00002000
 08:01 10808112   /usr/lib/libanalogy.so.1.0.0 b7f69000-b7f6a000 rw-p
 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mit
e xeno_rtdm 28436 2 analogy_ni_mio,xeno_analogy

astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins =
2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio

analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d
<0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001
<0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030
Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55
Quoted 5 lines

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP
0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example: xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

        rtdm_printk("irq_test: INTERRUPT!\n");

        return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

        int err;

        rtdm_printk("irq_test: before rtdm_irq_request\n");

        err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", 

NULL);

        rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);      

        rtdm_printk("irq_test: before rtdm_irq_enable\n");

        err = rtdm_irq_enable(&handle);

        rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);


        return err;
}

static void __exit __test_exit(void)
{

        rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 5 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio
xeno_analogy           38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mite
xeno_rtdm              24244  3 xeno_irqbench,analogy_ni_mio,xeno_analogy
astropci               10968  0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 332 lines

Hi,

Quoted 244 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f39000-b7f3a000 r--p 00155000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3a000-b7f3c000 rw-p 00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5a000-b7f5b000 rw-p 00001000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5b000-b7f5c000 rw-p 00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01 10808119
   /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp 00000000 08:01
 10808112   /usr/lib/libanalogy.so.1.0.0 b7f67000-b7f68000 rw-p 00002000
 08:01 10808112   /usr/lib/libanalogy.so.1.0.0 b7f69000-b7f6a000 rw-p
 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio

analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d
<0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001
<0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030
Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55
Quoted 5 lines

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example: xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 5 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#4 lore raw

Hi,

Quoted 77 lines · Ettore Pedretti

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
       rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio
xeno_analogy           38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mite
xeno_rtdm              24244  3 xeno_irqbench,analogy_ni_mio,xeno_analogy
astropci               10968  0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 6 lines

Cheers
Ettore

Quoted 331 lines

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 330 lines

Hi,

Quoted 244 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f39000-b7f3a000 r--p 00155000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3a000-b7f3c000 rw-p 00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5a000-b7f5b000 rw-p 00001000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5b000-b7f5c000 rw-p 00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01 10808119
   /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp 00000000 08:01
 10808112   /usr/lib/libanalogy.so.1.0.0 b7f67000-b7f68000 rw-p 00002000
 08:01 10808112   /usr/lib/libanalogy.so.1.0.0 b7f69000-b7f6a000 rw-p
 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio

analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d
<0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001
<0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030
Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55
Quoted 5 lines

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example: xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 5 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

#5 lore raw

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

Attached are a complete call-stack dump and my present kernel configuration.

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 443 lines

Hi,

Quoted 77 lines · Ettore Pedretti

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
       rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio
xeno_analogy           38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mite
xeno_rtdm              24244  3 xeno_irqbench,analogy_ni_mio,xeno_analogy
astropci               10968  0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 6 lines

Cheers
Ettore

Quoted 331 lines

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 330 lines

Hi,

Quoted 244 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f39000-b7f3a000 r--p 00155000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3a000-b7f3c000 rw-p 00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5a000-b7f5b000 rw-p 00001000 08:01 10808118   /usr/lib/librtdm.so.1.0.0
b7f5b000-b7f5c000 rw-p 00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01 10808119
   /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp 00000000 08:01
 10808112   /usr/lib/libanalogy.so.1.0.0 b7f67000-b7f68000 rw-p 00002000
 08:01 10808112   /usr/lib/libanalogy.so.1.0.0 b7f69000-b7f6a000 rw-p
 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio

analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d
<0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001
<0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030
Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55
Quoted 5 lines

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example: xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 5 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#6 lore raw

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 435 lines · wrote:
Quoted 435 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy          
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_
mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci               10968
 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 1 line

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 335 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 331 lines

Hi,

Quoted 246 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250  
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p 00156000
08:01 6144250    /lib/i686/cmov/libc-2.7.so b7f3c000-b7f3f000 rw-p
00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118  
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p 00000000
00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp 00000000
08:01 10808112   /usr/lib/libanalogy.so.1.0.0 b7f67000-b7f68000 rw-p
00002000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_n
i_mit e xeno_rtdm 28436 2 analogy_ni_mio,xeno_analogy

astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked
in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP
0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq",

NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

#7 lore raw

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 478 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 435 lines · wrote:
Quoted 435 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
       rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ni_
mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci               10968
 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 1 line

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 335 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 331 lines

Hi,

Quoted 246 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p 00156000
08:01 6144250    /lib/i686/cmov/libc-2.7.so b7f3c000-b7f3f000 rw-p
00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p 00000000
00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp 00000000
08:01 10808112   /usr/lib/libanalogy.so.1.0.0 b7f67000-b7f68000 rw-p
00002000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded.
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_n i_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked
in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:

 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#8 lore raw

Hi,

Quoted 9 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Cheers
Ettore

Please, find the patch attached (this patch is against the tag v2.5-rc4).

Many thanks for your time.

Quoted 484 lines

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 482 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 440 lines · wrote:
Quoted 440 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci              
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 338 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 334 lines

Hi,

Quoted 249 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112  
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

Alexis.

include/analogy/device.h +10 -0
index 27a3bd0..2a2f7bc 100644
@@ -58,6 +58,16 @@ struct a4l_device {
 };
 typedef struct a4l_device a4l_dev_t;
 
+#if 1 /* debug */
+static inline void debug_dump_irq(a4l_dev_t *dev, char *s)
+{
+	a4l_irq_desc_t *dsc = &dev->transfer.irq_desc;
+	rtdm_printk("debug_dump_irq: %s\n", s);
+	rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n", 
+		    dsc->handler, dsc->irq, dsc->cookie);
+}
+#endif /* debug */
+
 #endif /* __KERNEL__ */
 
 /* DEVCFG ioctl argument structure */
ksrc/drivers/analogy/national_instruments/mio_common.c +12 -0
index d23ee12..6586563 100644
@@ -4746,6 +4746,10 @@ int ni_E_init(a4l_dev_t *dev)
 		a4l_err(dev, "bug! boardtype.n_aochan > MAX_N_AO_CHAN\n");
 		return -EINVAL;
 	}
+
+#if 1 /* debug */
+	debug_dump_irq(dev, "ni_E_init start");
+#endif /* debug */
 	
 	/* analog input subdevice */
 
@@ -5145,6 +5149,10 @@ int ni_E_init(a4l_dev_t *dev)
 	if(ret != NI_FREQ_OUT_SUBDEV)
 		return ret;
 
+#if 1 /* debug */
+	debug_dump_irq(dev, "ni_E_init before config");
+#endif /* debug */
+
 	/* ai configuration */
 	ni_ai_reset(a4l_get_subd(dev, NI_AI_SUBDEV));
 	if ((boardtype.reg_type & ni_reg_6xxx_mask) == 0) {
@@ -5193,6 +5201,10 @@ int ni_E_init(a4l_dev_t *dev)
 		ni_writeb(0x0, M_Offset_AO_Calibration);
 	}
 
+#if 1 /* debug */
+	debug_dump_irq(dev, "ni_E_init after config");
+#endif /* debug */
+
 	return 0;
 }
 
ksrc/drivers/analogy/national_instruments/pcimio.c +13 -0
index 2c03112..ef3f58a 100644
@@ -1532,6 +1532,10 @@ static int pcimio_attach(a4l_dev_t *dev, a4l_lnkdesc_t *arg)
 
 	irq = mite_irq(devpriv->mite);
 
+#if 1 /* debug */
+	debug_dump_irq(dev, "before request");
+#endif /* debug */
+
 	if(irq == 0){
 		a4l_warn(dev, "pcimio_attach: unknown irq (bad)\n\n");
 	}else{
@@ -1543,7 +1547,16 @@ static int pcimio_attach(a4l_dev_t *dev, a4l_lnkdesc_t *arg)
 			a4l_err(dev, "pcimio_attach: irq not available\n");
 	}
 
+#if 1 /* debug */
+	debug_dump_irq(dev, "after request");
+#endif /* debug */
+
 	ret = ni_E_init(dev);
+
+#if 1 /* debug */
+	debug_dump_irq(dev, "after ni_E_init");
+#endif /* debug */
+
 	if(ret < 0)
 		return ret;
 
#9 lore raw
In reply to Ettore Pedretti
Quoted 5 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 487 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 482 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 440 lines · wrote:
Quoted 440 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci              
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 338 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 334 lines

Hi,

Quoted 249 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112  
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

#10 lore raw

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
       rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---

I hope this is what you wanted me to try. Please let me know.

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 503 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 487 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 482 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 440 lines · wrote:
Quoted 440 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
       rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 338 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 334 lines

Hi,

Quoted 249 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio analogy_8255            3900  1 analogy_ni_mio analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog y_n i_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0 ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:

 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#11 lore raw
Quoted 101 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ... kernel:Oops: 0000 [#1] PREEMPT SMP fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ... kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ... kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ... kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Code:  Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ... kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ... kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?
Which irq did you try to request ? 48 or 5 ?

Which CPU are you using ?

Thank you for your time.

Quoted 511 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 495 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 485 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 481 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 446 lines · wrote:
Quoted 446 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
       rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 342 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 338 lines

Hi,

Quoted 249 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio analogy_8255            3900  1 analogy_ni_mio analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog y_n i_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0 ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:

 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Quoted 9 lines

--
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532

Alexis.

#12 lore raw
Quoted 72 lines · Alexis Berlemont
Quoted 71 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Quoted 4 lines
Quoted 4 lines

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1 EIP is at 0x0
EAX: 00000030

This is likely IRQ 48, with rthal_irq_enable jumping to address zero.

Quoted 33 lines

EBX: 00000000 ECX: 00000030 EDX: c1250b80

Quoted 26 lines

ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Quoted 6 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

The IRQ requested does not seem to have been associated with any chip controller, which is likely the basic issue.

Quoted 5 lines

What is your kernel configuration ? no IO_APIC ?
Which irq did you try to request ? 48 or 5 ?

Which CPU are you using ?

Looks like something being used in x86_32 mode.

Quoted 528 lines

Thank you for your time.

Quoted 511 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 495 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 485 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 481 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 446 lines · wrote:
Quoted 446 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 342 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 338 lines

Hi,

Quoted 249 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Quoted 9 lines

--
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#13 lore raw

Hi Philippe,

Quoted 115 lines · Philippe Gerum
Quoted 72 lines · Alexis Berlemont
Quoted 71 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Quoted 4 lines
Quoted 4 lines

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1 EIP is at 0x0
EAX: 00000030

This is likely IRQ 48, with rthal_irq_enable jumping to address zero.

Quoted 35 lines

EBX: 00000000 ECX: 00000030 EDX: c1250b80

Quoted 26 lines

ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

Quoted 6 lines
Quoted 3 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

The IRQ requested does not seem to have been associated with any chip controller, which is likely the basic issue.

I had a look at arch/x86/kernel/apic/io_apic.c and the only controllers which seem left unhandled by ipipe are the remapped ones (and the hpet but I doubt it could be the hpet). Do you see any other possibility ?

Do you think that writing a little test module which requests the irq (through Linux API) is a good idea ?

After having loaded this module, the problematic controller should be listed in /proc/interrupts...

Quoted 524 lines
Quoted 5 lines

What is your kernel configuration ? no IO_APIC ?
Which irq did you try to request ? 48 or 5 ?

Which CPU are you using ?

Looks like something being used in x86_32 mode.

Quoted 514 lines

Thank you for your time.

Quoted 497 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 481 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 472 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 468 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 437 lines · wrote:
Quoted 437 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 337 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 333 lines

Hi,

Quoted 247 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 2 lines

Can anyone help?

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Best regards
Ettore Pedretti

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Quoted 9 lines

--
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

#14 lore raw
Quoted 122 lines · Alexis Berlemont

Hi Philippe,

Quoted 119 lines · Philippe Gerum
Quoted 72 lines · Alexis Berlemont
Quoted 71 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Quoted 4 lines
Quoted 4 lines

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1 EIP is at 0x0
EAX: 00000030

This is likely IRQ 48, with rthal_irq_enable jumping to address zero.

Quoted 38 lines

EBX: 00000000 ECX: 00000030 EDX: c1250b80

Quoted 26 lines

ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

Quoted 7 lines
Quoted 2 lines

The IRQ requested does not seem to have been associated with any chip controller, which is likely the basic issue.

I had a look at arch/x86/kernel/apic/io_apic.c and the only controllers which seem left unhandled by ipipe are the remapped ones (and the hpet but I doubt it could be the hpet). Do you see any other possibility ?

What needs to be assessed is whether irq48 gets registered through ioapic_register_intr() because a routing was found, or not. Likely not.

Quoted 6 lines

Do you think that writing a little test module which requests the irq (through Linux API) is a good idea ?

After having loaded this module, the problematic controller should be listed in /proc/interrupts...

/proc/interrupts only lists Linux requested interrupts, not necessarily all registered ones. So this won't do, since you likely don't want some Linux driver to request an interrupt an RTDM driver wants to handle (i.e. no IRQ sharing between domains).

Quoted 525 lines
Quoted 524 lines
Quoted 5 lines

What is your kernel configuration ? no IO_APIC ?
Which irq did you try to request ? 48 or 5 ?

Which CPU are you using ?

Looks like something being used in x86_32 mode.

Quoted 514 lines

Thank you for your time.

Quoted 497 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 481 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 472 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 468 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 437 lines · wrote:
Quoted 437 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 337 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 333 lines

Hi,

Quoted 247 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last
insmod (analogy_ni_pcimio). You can check that by typing "cat
/proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 2 lines

Can anyone help?

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Best regards
Ettore Pedretti

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Quoted 9 lines

--
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#15 lore raw
Quoted 126 lines · Philippe Gerum
Quoted 125 lines · Alexis Berlemont

Hi Philippe,

Quoted 121 lines · Philippe Gerum
Quoted 72 lines · Alexis Berlemont
Quoted 71 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Quoted 4 lines
Quoted 4 lines

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1 EIP is at 0x0
EAX: 00000030

This is likely IRQ 48, with rthal_irq_enable jumping to address zero.

Quoted 32 lines

EBX: 00000000 ECX: 00000030 EDX: c1250b80

Quoted 26 lines

ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Quoted 6 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

The IRQ requested does not seem to have been associated with any chip controller, which is likely the basic issue.

Quoted 11 lines
Quoted 4 lines

I had a look at arch/x86/kernel/apic/io_apic.c and the only controllers which seem left unhandled by ipipe are the remapped ones (and the hpet but I doubt it could be the hpet). Do you see any other possibility ?

What needs to be assessed is whether irq48 gets registered through ioapic_register_intr() because a routing was found, or not. Likely not.

Quoted 3 lines

Do you think that writing a little test module which requests the irq (through Linux API) is a good idea ?

Sorry, I'm just catching up with your idea. Yes, you could check this way whether irq48 was registered at low-level, but it would not tell you why it is not.

Signature · 1 line
Philippe.
#16 lore raw
In reply to Alexis Berlemont

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 102 lines · Ettore Pedretti
Quoted 101 lines

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ... kernel:Oops: 0000 [#1] PREEMPT SMP fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ... kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ... kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ... kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Code:  Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ... kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ... kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 5 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 3 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 5 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful
CPU0 CPU1

  0:        222          0   IO-APIC-edge      timer
  1:          0          9   IO-APIC-edge      i8042
  2:          0          0    XT-PIC-XT        cascade
 12:          0        132   IO-APIC-edge      i8042
 14:          0          8   IO-APIC-edge      ata_piix
 15:          0      12358   IO-APIC-edge      ata_piix
 20:          0          0   IO-APIC-fasteoi   astropci0
 28:          0        235   IO-APIC-fasteoi   sata_mv
 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ CPU0 CPU1

516:           0           0         [IPI]
519:    46161773    46161772         [timer]
520:           0           0         [critical sync]
546:           0           0         [virtual]
Quoted 2 lines

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Quoted 512 lines

Thank you for your time.

Quoted 509 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 503 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 487 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 482 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 440 lines · wrote:
Quoted 440 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
       rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 338 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 334 lines

Hi,

Quoted 249 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio analogy_8255            3900  1 analogy_ni_mio analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog y_n i_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0 ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:

 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

       rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n", err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

#17 lore raw

Hi,

Quoted 122 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 102 lines · Ettore Pedretti
Quoted 101 lines

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 4 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

Quoted 7 lines

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

No, you just have to change the irq number in the source code and recompile it. However, if you have re-enabled the IO-APIC in the kernel config, that should be ok (48 was already set in the code).

Quoted 36 lines

This is my /proc/interrupts if that is helpful
CPU0 CPU1

  0:        222          0   IO-APIC-edge      timer
  1:          0          9   IO-APIC-edge      i8042
  2:          0          0    XT-PIC-XT        cascade
 12:          0        132   IO-APIC-edge      i8042
 14:          0          8   IO-APIC-edge      ata_piix
 15:          0      12358   IO-APIC-edge      ata_piix
 20:          0          0   IO-APIC-fasteoi   astropci0
 28:          0        235   IO-APIC-fasteoi   sata_mv
 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ CPU0 CPU1

516:           0           0         [IPI]
519:    46161773    46161772         [timer]
520:           0           0         [critical sync]
546:           0           0         [virtual]
Quoted 506 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Quoted 498 lines

Thank you for your time.

Quoted 496 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 490 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 476 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 472 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 432 lines · wrote:
Quoted 432 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 332 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 328 lines

Hi,

Quoted 247 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

module_init(__test_init);
module_exit(__test_exit);

Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

#18 lore raw
In reply to Ettore Pedretti

Hi,

Quoted 165 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 102 lines · Ettore Pedretti
Quoted 101 lines

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
      rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84
Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 4 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful
CPU0 CPU1

  0:        222          0   IO-APIC-edge      timer
  1:          0          9   IO-APIC-edge      i8042
  2:          0          0    XT-PIC-XT        cascade
 12:          0        132   IO-APIC-edge      i8042
 14:          0          8   IO-APIC-edge      ata_piix
 15:          0      12358   IO-APIC-edge      ata_piix
 20:          0          0   IO-APIC-fasteoi   astropci0
 28:          0        235   IO-APIC-fasteoi   sata_mv
 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ CPU0 CPU1

516:           0           0         [IPI]
519:    46161773    46161772         [timer]
520:           0           0         [critical sync]
546:           0           0         [virtual]
Quoted 7 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 490 lines
Quoted 490 lines

Thank you for your time.

Quoted 488 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 483 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations; so, do not bother changing your configuration for the moment.

Quoted 474 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 470 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So, the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 7 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 3 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti <[email protected]>

Quoted 439 lines · wrote:
Quoted 439 lines
Quoted 79 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 339 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 335 lines

Hi,

Quoted 247 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
       subdevices count = 0
       read subdevice index = 0
       write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size (fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303   /usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303   /usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619    /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619    /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000 08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000 08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009 i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220 5
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0

ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 3 lines

The analogy driver "a4l_pcimio" will be registered with your last insmod (analogy_ni_pcimio). You can check that by typing "cat /proc/analogy/drivers", you will see only one entry: a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux

Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc

f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14 f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf 00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Quoted 6 lines
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b

55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would be great to test that calling rtdm_request_irq(... , 48, ...) does not trigger the bug.

Here is a little test module you could try to insmod. If you do not want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in your kernel configuration (in "Processor type and features", disable the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

       rtdm_printk("irq_test: INTERRUPT!\n");

       return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

       int err;

       rtdm_printk("irq_test: before rtdm_irq_request\n");

       err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

       rtdm_printk("irq_test: before rtdm_irq_enable\n");

       err = rtdm_irq_enable(&handle);

       rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

       return err;
}

static void __exit __test_exit(void)
{

       rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

arch/x86/kernel/apic/io_apic.c +5 -0
diff -uNrp linux-2.6.31.1-xeno-perso/arch/x86/kernel/apic/io_apic.c linux-2.6.31.1-xeno-perso-x86_64-local/arch/x86/kernel/apic/io_apic.c
@@ -1357,6 +1357,11 @@ static inline int IO_APIC_irq_trigger(in
 static void ioapic_register_intr(int irq, struct irq_desc *desc, unsigned long trigger)
 {
 
+#if 1 /* debug */
+	printk("ioapic_register_intr: irq = %d, trig = %lu, apic_trig = %d, remap = %d\n",
+	       irq, trigger, IO_APIC_irq_trigger(irq), irq_remapped(irq));
+#endif /* debug */
+
 	if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
 	    trigger == IOAPIC_LEVEL)
 		desc->status |= IRQ_LEVEL;

#include <linux/version.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>

static int test_var;

static irqreturn_t test_handler(int irq, void *arg)

{
	printk("irq_test: INTERRUPT!\n");
	return IRQ_HANDLED;

}

static int __init __test_init(void)
{

	int err;

	printk("irq_test: before request_irq\n");

	err = request_irq(48, test_handler, IRQF_SHARED, "test_irq", &test_var);
	
	printk("irq_test: after request_irq (err = %d)\n", err);	

	return err;
}

static void __exit __test_exit(void)

{
	free_irq(48, &test_var);
}

MODULE_LICENSE("GPL");
module_init(__test_init);
module_exit(__test_exit);

#19 lore raw

Hi,

I applied your kernel patch before applying the xenomai patch. When I insert the kernel patch I obtain:

insmod: error inserting 'test_module.ko': -1 Function not implemented

Attached is the content of dmesg from boot to module insertion.

Cheers
-ep

ps. I am leaving the mountain tomorrow and will be travelling until Friday. I hope I will be able to test the machine at distance without crashing it for good.

2009/11/29 Alexis Berlemont <[email protected]>:

Quoted 754 lines

Hi,

Quoted 173 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 108 lines
Quoted 105 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
     rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ... kernel:Oops: 0000 [#1] PREEMPT SMP fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ... kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ... kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ... kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Code:  Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ... kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ... kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:

 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000 <0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84

Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 5 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful CPU0       CPU1
 0:        222          0   IO-APIC-edge      timer 1:          0          9   IO-APIC-edge      i8042 2:          0          0    XT-PIC-XT        cascade 12:          0        132   IO-APIC-edge      i8042 14:          0          8   IO-APIC-edge      ata_piix 15:          0      12358   IO-APIC-edge      ata_piix 20:          0          0   IO-APIC-fasteoi   astropci0 28:          0        235   IO-APIC-fasteoi   sata_mv 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ         CPU0        CPU1
516:           0           0         [IPI] 519:    46161773    46161772         [timer] 520:           0           0         [critical sync] 546:           0           0         [virtual]

Quoted 7 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 552 lines
Quoted 552 lines

Thank you for your time.

Quoted 550 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 545 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 6 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations;
so, do not bother changing your configuration for the moment.

Quoted 532 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 528 lines

Hi,

Quoted 9 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So,
the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the
bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 9 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 5 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti
<[email protected]>

Quoted 487 lines · wrote:
Quoted 487 lines
Quoted 81 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
      $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
      $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
      rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ ni_ mite xeno_rtdm              24244  3 xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 380 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 376 lines

Hi,

Quoted 276 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need to
use the comedi drivers for Xenomai for a NI PCI-6711 function generator board.

When I try to use the test program cmd_write (or cmd-read) I obtain
the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
      subdevices count = 0
      read subdevice index = 0
      write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size
(fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303
/usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303
/usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619
 /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619
 /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000
08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000
08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618    /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618    /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST 2009
i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream) loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio analogy_ni_tio         24956  1 analogy_ni_mio analogy_8255            3900  1 analogy_ni_mio analogy_ni_mite        10140  3 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy 40220  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog y_n i_mit e xeno_rtdm              28436  2 analogy_ni_mio,xeno_analogy astropci               10944  0 ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

Quoted 5 lines

The analogy driver "a4l_pcimio" will be registered with your
last
insmod (analogy_ni_pcimio). You can check that by typing "cat
/proc/analogy/drivers", you will see only one entry:
a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --
| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --
| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

Quoted 6 lines

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)

This is what happens when I try to attach the driver to de device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ... kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ... kernel:Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ... kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00
8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00
00 31

Message from [email protected] at Nov 21 23:22:37 ... kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ... kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0,
iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at
00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP

last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm
astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv
e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0 task.ti=f64cc000) I-pipe domain Linux

Stack:

 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0 f64cde14
f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38 f8c2cccf
00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm] [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy] [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy] [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy] [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio] [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy] [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy] [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy] [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy] [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm] [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm] [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm] [<c10699ae>] ? losyscall_event+0xa9/0x190 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201 [<c1069905>] ? losyscall_event+0x0/0x190 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4 [<c1002cfd>] ? system_call+0x2d/0x4f

Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
Quoted 8 lines

8b
55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42
18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f64cddc8 CR2: 0000000000000004

---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in
my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me
is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would
be great to test that calling rtdm_request_irq(... , 48, ...) does
not trigger the bug.

Here is a little test module you could try to insmod. If you do not
want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in
your kernel configuration (in "Processor type and features", disable
the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

      rtdm_printk("irq_test: INTERRUPT!\n");

      return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

      int err;

      rtdm_printk("irq_test: before rtdm_irq_request\n");

      err = rtdm_irq_request(&handle, 48, test_handler, 0, "test_irq", NULL);

      rtdm_printk("irq_test: after rtdm_irq_request (err = %d)\n",
err);

      rtdm_printk("irq_test: before rtdm_irq_enable\n");

      err = rtdm_irq_enable(&handle);

      rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n", err);

      return err;
}

static void __exit __test_exit(void)
{

      rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44 1334 461669, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#20 lore raw

Hi,

Quoted 1 line · Ettore Pedretti

Hi,

Sorry for the late reply.

Quoted 4 lines

I applied your kernel patch before applying the xenomai patch. When I insert the kernel patch I obtain:

insmod: error inserting 'test_module.ko': -1 Function not implemented

Yes. request_irq returns an error because the io_apic did not register the interrupt.

Quoted 1 line

Attached is the content of dmesg from boot to module insertion.

Thanks to your traces and a look at the x86-specific pci code in the kernel (arch/x86/pci), I think I understand the way it works.

The fact that request_irq return -ENOSYS is normal: the irq is not "enabled". In order to enable the pci card's irq, we have to enable the pci device (thanks to a call to pci_enable()). This operation will route the PCI interrupt line to an io_apic irq; after that, the io_apic will register the irq. Once this procedure is complete, the irq is made available for Linux.

That is the reason why, our little Linux test module failed and our little RTDM test module crashed.

If you had the kernel boot argument "pci=routeirq", both test modules should insmod fine because all pci interrupt are "enabled" during the PCI discovery.

Concerning the analogy driver, that does not explain the problem because the pci board enabling is _supposed_ to be ok. Could you also test the attach procedure with kernel boot argument specified above ?

Quoted 736 lines

Cheers
-ep

ps. I am leaving the mountain tomorrow and will be travelling until Friday. I hope I will be able to test the machine at distance without crashing it for good.

2009/11/29 Alexis Berlemont <[email protected]>:

Quoted 722 lines

Hi,

Quoted 165 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 106 lines
Quoted 104 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
     rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0
task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000

<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84

Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 4 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful
CPU0 CPU1

 0:        222          0   IO-APIC-edge      timer
 1:          0          9   IO-APIC-edge      i8042
 2:          0          0    XT-PIC-XT        cascade
 12:          0        132   IO-APIC-edge      i8042
 14:          0          8   IO-APIC-edge      ata_piix
 15:          0      12358   IO-APIC-edge      ata_piix
 20:          0          0   IO-APIC-fasteoi   astropci0
 28:          0        235   IO-APIC-fasteoi   sata_mv
 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ CPU0 CPU1

516:           0           0         [IPI]
519:    46161773    46161772         [timer]
520:           0           0         [critical sync]
546:           0           0         [virtual]
Quoted 6 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 532 lines
Quoted 532 lines

Thank you for your time.

Quoted 530 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 525 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations;
so, do not bother changing your configuration for the moment.

Quoted 515 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 511 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So,
the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC, the
bug is bound to be located in analogy. There may be some wrong write access on the interrupt structure.

I will come back with a patch which dumps the structure's content at various locations in the attach code.

Quoted 8 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 4 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti
<[email protected]>

Quoted 477 lines · wrote:
Quoted 477 lines
Quoted 80 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:

      $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:

      $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench (probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm 24244 3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0

ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 375 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 371 lines

Hi,

Quoted 281 lines · On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need
to
use the comedi drivers for Xenomai for a NI PCI-6711 function
generator board.

When I try to use the test program cmd_write (or cmd-read) I
obtain
the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened (fd=0)
cmd_write: basic descriptor retrieved
subdevices count = 0
read subdevice index = 0
write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size
(fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303
/usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303
/usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0 [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619
/lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619
/lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426 /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
/lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000
08:01
6144250 /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250 /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000 08:01
10808118 /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
/usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000
08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112 /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426 /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618 /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618 /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
Aborted

This is probably because the device /dev/analogy0 does not
exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST
2009
i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream)
loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module Size Used by
xeno_native 105088 0
analogy_ni_pcimio 15644 0
analogy_ni_mio 44860 1 analogy_ni_pcimio
analogy_ni_tio 24956 1 analogy_ni_mio
analogy_8255 3900 1 analogy_ni_mio
analogy_ni_mite 10140 3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
40220 5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0
ext3 109636 1
jbd 43920 1 ext3
mbcache 6272 1 ext3
ide_pci_generic 3712 0
ide_core 74204 1 ide_pci_generic
ata_piix 15748 2
sata_mv 26448 0
e1000 114208 0
libata 142156 2 ata_piix,sata_mv
unix 22992 10

According to this post:
http://www.mail-archive.com/[email protected]

The analogy driver "a4l_pcimio" will be registered with your
last
insmod (analogy_ni_pcimio). You can check that by typing "cat
/proc/analogy/drivers", you will see only one entry:
a4l_pcimio.
fangorn:~# cat /proc/analogy/drivers
-- Analogy drivers --

| idx | driver name
| 00 | analogy_ni_pcimio
| 01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
-- Analogy devices --

| idx | status | driver
| 00 | Unused | No driver
| 01 | Unused | No driver
| 02 | Unused | No driver
| 03 | Unused | No driver
| 04 | Unused | No driver
| 05 | Unused | No driver
| 06 | Unused | No driver
| 07 | Unused | No driver
| 08 | Unused | No driver
| 09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)
This is what happens when I try to attach the driver to de
device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe
ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00
00
8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01
00
00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode
= 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins =
0,
iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48
BUG: unable to handle kernel NULL pointer dereference at
00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class Modules
linked in: xeno_native analogy_ni_pcimio analogy_ni_mio
analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy
xeno_rtdm
astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix
sata_mv
e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux
Stack:
f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7 f64cddfc
f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0
f64cde14
f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38
f8c2cccf
00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
[<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
[<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
[<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
[<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
[<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
[<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
[<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
[<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
[<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
[<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
[<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
[<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
[<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
[<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b
55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b
42
18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00
31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP
0068:f64cddc8 CR2: 0000000000000004
---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was already in
my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler registering seems to be the source of the trouble. What strikes me
is that the oops occurred very low (unmask_IO_APIC_irq: we are no more in the analogy layer).

In order to be sure that the problem is located in analogy, it would
be great to test that calling rtdm_request_irq(... , 48, ...) does
not trigger the bug.

Here is a little test module you could try to insmod. If you do not
want to bother finding out how to compile it, you can replace the code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC in
your kernel configuration (in "Processor type and features", disable
the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

      rtdm_printk("irq_test: INTERRUPT!\n");

      return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

      int err;

      rtdm_printk("irq_test: before rtdm_irq_request\n");

      err = rtdm_irq_request(&handle, 48, test_handler, 0,

"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err =
%d)\n",
err);

      rtdm_printk("irq_test: before rtdm_irq_enable\n");

      err = rtdm_irq_enable(&handle);

      rtdm_printk("irq_test: after rtdm_irq_enable (err = %d)\n",

err);

      return err;
}

static void __exit __test_exit(void)
{

      rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Quoted 4 lines

Can anyone help?

Best regards
Ettore Pedretti

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

Alexis.

#21 lore raw

Hi,

I have added routeirq to the kernel parameters:

kernel /boot/vmlinuz-2.6.31.1 root=LABEL=ROOTFS_TEST ro noht
mem=2048M memmap=1024M pci=routeirq

When I insert your test module:

fangorn:~/control/CHAMP/irqTest# insmod test_module.ko

The trace is:

rq_test: before request_irq
irq_test: after request_irq (err = 0)

When I try the attach procedure:

analogy_config analogy0 analogy_ni_pcimio Message from [email protected] at Dec 15 07:39:25 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Dec 15 07:39:25 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730
task.ti=f6c48000)

Message from [email protected] at Dec 15 07:39:25 ...
kernel:I-pipe domain Linux

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Stack:

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Call Trace:

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Dec 15 07:39:25 ...
kernel:EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f6c49dc8

Message from [email protected] at Dec 15 07:39:25 ...
kernel:CR2: 0000000000000004

And the trace:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e32000
a4l: DAQ: 0xd0800000 mapped to f8e36000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: test_module xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix e1000 sata_mv libata unix [last unloaded:
scsi_wait_scan]

Pid: 3556, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7f029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a24280 ECX: f8c33e6c EDX: f8c33e60
ESI: 00000000 EDI: f8c33e60 EBP: f6c49e38 ESP: f6c49dc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730 task.ti=f6c48000) I-pipe domain Linux

Stack:
 f6c49dd0 c10143ee f6c49dd8 f8c33e60 f6c49de0 c105ad27 f6c49dfc f8a10a5d
<0> f8c2de00 00000000 00000001 f8c33e94 fffffff0 f6c49e14 f8c2e118 00000001
<0> f8c30d0d f8c33e88 f8c33e60 f6c49e38 f8c2eccf 00000001 f8c33e60 00000030
Call Trace:
 [<c10143ee>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105ad27>] ? xnintr_enable+0xb/0xd
 [<f8a10a5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2de00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2e118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2eccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8dd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2cfef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2d2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c106641a>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2d54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2f36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0f3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a11e77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a11dde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c1069ade>] ? losyscall_event+0xa9/0x190
 [<c10567fe>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069a35>] ? losyscall_event+0x0/0x190
 [<c10167d1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f6c49dc8
CR2: 0000000000000004

---[ end trace bcff6beb2ba30576 ]---

Ettore

2009/12/2 Alexis Berlemont <[email protected]>:

Quoted 834 lines

Hi,

Quoted 2 lines · Ettore Pedretti

Hi,

Sorry for the late reply.

Quoted 4 lines

I applied your kernel patch before applying the xenomai patch. When I insert the kernel patch I obtain:

insmod: error inserting 'test_module.ko': -1 Function not implemented

Yes. request_irq returns an error because the io_apic did not register the interrupt.

Quoted 1 line

Attached is the content of dmesg from boot to module insertion.

Thanks to your traces and a look at the x86-specific pci code in the kernel (arch/x86/pci), I think I understand the way it works.

The fact that request_irq return -ENOSYS is normal: the irq is not "enabled". In order to enable the pci card's irq, we have to enable the pci device (thanks to a call to pci_enable()). This operation will route the PCI interrupt line to an io_apic irq; after that, the io_apic will register the irq. Once this procedure is complete, the irq is made available for Linux.

That is the reason why, our little Linux test module failed and our little RTDM test module crashed.

If you had the kernel boot argument "pci=routeirq", both test modules should insmod fine because all pci interrupt are "enabled" during the PCI discovery.

Concerning the analogy driver, that does not explain the problem because the pci board enabling is _supposed_ to be ok. Could you also test the attach procedure with kernel boot argument specified above ?

Quoted 792 lines

Cheers
-ep

ps. I am leaving the mountain tomorrow and will be travelling until Friday. I hope I will be able to test the machine at distance without crashing it for good.

2009/11/29 Alexis Berlemont <[email protected]>:

Quoted 778 lines

Hi,

Quoted 174 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 109 lines
Quoted 106 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
    rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ... kernel:Oops: 0000 [#1] PREEMPT SMP fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ... kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ... kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ... kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Code:  Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ... kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ... kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:

 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84

Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 5 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful CPU0       CPU1
 0:        222          0   IO-APIC-edge      timer 1:          0          9   IO-APIC-edge      i8042 2:          0          0    XT-PIC-XT        cascade 12:          0        132   IO-APIC-edge      i8042 14:          0          8   IO-APIC-edge      ata_piix 15:          0      12358   IO-APIC-edge      ata_piix 20:          0          0   IO-APIC-fasteoi   astropci0 28:          0        235   IO-APIC-fasteoi   sata_mv 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ         CPU0        CPU1
516:           0           0         [IPI] 519:    46161773    46161772         [timer] 520:           0           0         [critical sync] 546:           0           0         [virtual]

Quoted 7 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 576 lines
Quoted 576 lines

Thank you for your time.

Quoted 574 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 569 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 6 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations;
so, do not bother changing your configuration for the moment.

Quoted 556 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 552 lines

Hi,

Quoted 9 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So,
the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC,
the
bug is bound to be located in analogy. There may be some wrong write
access on the interrupt structure.

I will come back with a patch which dumps the structure's content at
various locations in the attach code.

Quoted 9 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 5 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti
<[email protected]>

Quoted 508 lines · wrote:
Quoted 508 lines
Quoted 84 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix) obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

KDIR    := /lib/modules/$(shell uname -r)/build PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
     $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
     $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
     rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build SUBDIRS=/home/ep41/control/CHAMP/irqTest modules make[1]: Entering directory `/usr/src/linux-2.6.31.1' CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe irqbench
(probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_ ni_ mite xeno_rtdm              24244  3 xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in module

Quoted 8 lines

dmesg:

irqTest: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 398 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Quoted 394 lines

Hi,

On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need
to
use the comedi drivers for Xenomai for a NI PCI-6711 function
generator board.

When I try to use the test program cmd_write (or cmd-read) I
obtain
the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened
(fd=0)
cmd_write: basic descriptor retrieved
     subdevices count = 0
     read subdevice index = 0
     write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size
(fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303
/usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303
/usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619
 /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619
 /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000
08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000
08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000
08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618
 /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618
 /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not
exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST
2009
i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream)
loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3
 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
 40220  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm              28436  2
analogy_ni_mio,xeno_analogy astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:
http://www.mail-archive.com/[email protected]

The analogy driver "a4l_pcimio" will be registered with your
last
insmod (analogy_ni_pcimio). You can check that by typing "cat
/proc/analogy/drivers", you will see only one entry:
a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --

| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --

| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)

This is what happens when I try to attach the driver to de
device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4
fe
ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00
00
8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b
01
00
00 31

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1
[analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface
mode
= 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins =
0,
iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48
BUG: unable to handle kernel NULL pointer dereference at
00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules
linked in: xeno_native analogy_ni_pcimio analogy_ni_mio
analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy
xeno_rtdm
astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix
sata_mv
e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1)
X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
 task.ti=f64cc000) I-pipe domain Linux
Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7
f64cddfc
f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0
f64cde14
f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38
f8c2cccf
00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b
55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b
42
18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00
00
31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP
0068:f64cddc8 CR2: 0000000000000004
---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was
already
in
my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler
registering seems to be the source of the trouble. What strikes
me
is that the oops occurred very low (unmask_IO_APIC_irq: we are
no
more in the analogy layer).

In order to be sure that the problem is located in analogy, it
would
be great to test that calling rtdm_request_irq(... , 48, ...)
does
not trigger the bug.

Here is a little test module you could try to insmod. If you do
not
want to bother finding out how to compile it, you can replace
the
code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC
in
your kernel configuration (in "Processor type and features",
disable
the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

     rtdm_printk("irq_test: INTERRUPT!\n");

     return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

     int err;

     rtdm_printk("irq_test: before rtdm_irq_request\n");

     err = rtdm_irq_request(&handle, 48, test_handler, 0,
"test_irq", NULL);

     rtdm_printk("irq_test: after rtdm_irq_request (err =
%d)\n",
err);

     rtdm_printk("irq_test: before rtdm_irq_enable\n");

     err = rtdm_irq_enable(&handle);

     rtdm_printk("irq_test: after rtdm_irq_enable (err =
%d)\n",
err);

     return err;
}

static void __exit __test_exit(void)
{

     rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44-1334-461666, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#22 lore raw
Quoted 7 lines · Ettore Pedretti

Hi,

I have added routeirq to the kernel parameters:

kernel /boot/vmlinuz-2.6.31.1 root=LABEL=ROOTFS_TEST ro noht
mem=2048M memmap=1024M pci=routeirq

Quoted 8 lines

When I insert your test module:

fangorn:~/control/CHAMP/irqTest# insmod test_module.ko

The trace is:

rq_test: before request_irq
irq_test: after request_irq (err = 0)

Great ! and did the "rtdm test module" behave well ?

Could you also send the kernel traces (with the debug messages we added).

Quoted 93 lines

When I try the attach procedure:

analogy_config analogy0 analogy_ni_pcimio Message from [email protected] at Dec 15 07:39:25 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Dec 15 07:39:25 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730
task.ti=f6c48000)

Message from [email protected] at Dec 15 07:39:25 ...
kernel:I-pipe domain Linux

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Stack:

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Call Trace:

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Dec 15 07:39:25 ...
kernel:EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f6c49dc8

Message from [email protected] at Dec 15 07:39:25 ...
kernel:CR2: 0000000000000004

And the trace:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e32000
a4l: DAQ: 0xd0800000 mapped to f8e36000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: test_module xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix e1000 sata_mv libata unix [last unloaded:
scsi_wait_scan]

Pid: 3556, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7f029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a24280 ECX: f8c33e6c EDX: f8c33e60
ESI: 00000000 EDI: f8c33e60 EBP: f6c49e38 ESP: f6c49dc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730 task.ti=f6c48000) I-pipe domain Linux

Stack:
 f6c49dd0 c10143ee f6c49dd8 f8c33e60 f6c49de0 c105ad27 f6c49dfc f8a10a5d
<0> f8c2de00 00000000 00000001 f8c33e94 fffffff0 f6c49e14 f8c2e118 00000001
<0> f8c30d0d f8c33e88 f8c33e60 f6c49e38 f8c2eccf 00000001 f8c33e60 00000030
Call Trace:
 [<c10143ee>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105ad27>] ? xnintr_enable+0xb/0xd
 [<f8a10a5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2de00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2e118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2eccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8dd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2cfef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2d2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c106641a>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2d54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2f36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0f3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a11e77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a11dde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c1069ade>] ? losyscall_event+0xa9/0x190
 [<c10567fe>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069a35>] ? losyscall_event+0x0/0x190
 [<c10167d1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f6c49dc8
CR2: 0000000000000004

Quoted 806 lines
---[ end trace bcff6beb2ba30576 ]---

Ettore

2009/12/2 Alexis Berlemont <[email protected]>:

Quoted 797 lines

Hi,

Quoted 1 line · Ettore Pedretti

Hi,

Sorry for the late reply.

Quoted 4 lines

I applied your kernel patch before applying the xenomai patch. When I insert the kernel patch I obtain:

insmod: error inserting 'test_module.ko': -1 Function not implemented

Yes. request_irq returns an error because the io_apic did not register the interrupt.

Quoted 1 line

Attached is the content of dmesg from boot to module insertion.

Thanks to your traces and a look at the x86-specific pci code in the kernel (arch/x86/pci), I think I understand the way it works.

The fact that request_irq return -ENOSYS is normal: the irq is not "enabled". In order to enable the pci card's irq, we have to enable the pci device (thanks to a call to pci_enable()). This operation will route the PCI interrupt line to an io_apic irq; after that, the io_apic will register the irq. Once this procedure is complete, the irq is made available for Linux.

That is the reason why, our little Linux test module failed and our little RTDM test module crashed.

If you had the kernel boot argument "pci=routeirq", both test modules should insmod fine because all pci interrupt are "enabled" during the PCI discovery.

Concerning the analogy driver, that does not explain the problem because the pci board enabling is _supposed_ to be ok. Could you also test the attach procedure with kernel boot argument specified above ?

Quoted 760 lines

Cheers
-ep

ps. I am leaving the mountain tomorrow and will be travelling until Friday. I hope I will be able to test the machine at distance without crashing it for good.

2009/11/29 Alexis Berlemont <[email protected]>:

Quoted 747 lines

Hi,

Quoted 166 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 107 lines
Quoted 105 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
    rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0
task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1
EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000) I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000

00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84

Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 4 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful
CPU0 CPU1

 0:        222          0   IO-APIC-edge      timer
 1:          0          9   IO-APIC-edge      i8042
 2:          0          0    XT-PIC-XT        cascade
 12:          0        132   IO-APIC-edge      i8042
 14:          0          8   IO-APIC-edge      ata_piix
 15:          0      12358   IO-APIC-edge      ata_piix
 20:          0          0   IO-APIC-fasteoi   astropci0
 28:          0        235   IO-APIC-fasteoi   sata_mv
 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ CPU0 CPU1

516:           0           0         [IPI]
519:    46161773    46161772         [timer]
520:           0           0         [critical sync]
546:           0           0         [virtual]
Quoted 6 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 556 lines
Quoted 556 lines

Thank you for your time.

Quoted 554 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 549 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 5 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program and send you the call-stack dump? I am willing to test your patch on our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations;
so, do not bother changing your configuration for the moment.

Quoted 539 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 535 lines

Hi,

Quoted 8 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled. So,
the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC,
the
bug is bound to be located in analogy. There may be some wrong write
access on the interrupt structure.

I will come back with a patch which dumps the structure's content at
various locations in the attach code.

Quoted 8 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 4 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti
<[email protected]>

Quoted 498 lines · wrote:
Quoted 498 lines
Quoted 91 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable)
endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build
SUBDIRS=/home/ep41/control/CHAMP/irqTest modules
make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe
irqbench
(probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module Size Used by
xeno_irqbench 5152 0
xeno_native 83296 0
analogy_ni_pcimio 15676 0
analogy_ni_mio 41596 1 analogy_ni_pcimio
analogy_ni_tio 21724 1 analogy_ni_mio
analogy_8255 4060 1 analogy_ni_mio
analogy_ni_mite 9980 3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876 5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm 24244 3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3 112900 1
jbd 44016 1 ext3
mbcache 6652 1 ext3
ide_pci_generic 3712 0
ide_core 79388 1 ide_pci_generic
e1000 118204 0
ata_piix 15968 2
sata_mv 27632 0
libata 151468 2 ata_piix,sata_mv
unix 24460 10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in
module

dmesg:

irqTest: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the kernel.

xnintr_* symbols are only exported for GPL compliant modules. So, could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

Quoted 2 lines

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same
problem.

Could you send the call-stack dump ? Maybe, that will unveil a clue.

Quoted 393 lines

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:
Hi,

On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:
Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I need
to
use the comedi drivers for Xenomai for a NI PCI-6711 function
generator board.

When I try to use the test program cmd_write (or cmd-read) I
obtain
the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened
(fd=0)
cmd_write: basic descriptor retrieved
subdevices count = 0
read subdevice index = 0
write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size
(fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303
/usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303
/usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0 [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619
/lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619
/lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426 /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
/lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000
08:01
6144250 /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250 /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000
08:01
10808118 /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
/usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000
08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112 /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426 /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618
/lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618
/lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
Aborted

This is probably because the device /dev/analogy0 does not
exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26 PST
2009
i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream)
loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module Size Used by
xeno_native 105088 0
analogy_ni_pcimio 15644 0
analogy_ni_mio 44860 1 analogy_ni_pcimio
analogy_ni_tio 24956 1 analogy_ni_mio
analogy_8255 3900 1 analogy_ni_mio
analogy_ni_mite 10140 3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
40220 5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0
ext3 109636 1
jbd 43920 1 ext3
mbcache 6272 1 ext3
ide_pci_generic 3712 0
ide_core 74204 1 ide_pci_generic
ata_piix 15748 2
sata_mv 26448 0
e1000 114208 0
libata 142156 2 ata_piix,sata_mv
unix 22992 10

According to this post:
http://www.mail-archive.com/[email protected]

The analogy driver "a4l_pcimio" will be registered with your
last
insmod (analogy_ni_pcimio). You can check that by typing "cat
/proc/analogy/drivers", you will see only one entry:
a4l_pcimio.
fangorn:~# cat /proc/analogy/drivers
-- Analogy drivers --

| idx | driver name
| 00 | analogy_ni_pcimio
| 01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
-- Analogy devices --

| idx | status | driver
| 00 | Unused | No driver
| 01 | Unused | No driver
| 02 | Unused | No driver
| 03 | Unused | No driver
| 04 | Unused | No driver
| 05 | Unused | No driver
| 06 | Unused | No driver
| 07 | Unused | No driver
| 08 | Unused | No driver
| 09 | Unused | No driver

I'm aware of the name change of the drivers:
http://www.mail-archive.com/[email protected]

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)
This is what happens when I try to attach the driver to de
device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4
fe
ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00
00
8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b
01
00
00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1
[analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface
mode
= 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins =
0,
iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq 48
BUG: unable to handle kernel NULL pointer dereference at
00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules
linked in: xeno_native analogy_ni_pcimio analogy_ni_mio
analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy
xeno_rtdm
astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix
sata_mv
e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1)
X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux
Stack:
f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7
f64cddfc
f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0
f64cde14
f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38
f8c2cccf
00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
[<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
[<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
[<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
[<f8c8bd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
[<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
[<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
[<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
[<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
[<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
[<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
[<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
[<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
[<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
[<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b
55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b
42
18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00
00
31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP
0068:f64cddc8 CR2: 0000000000000004
---[ end trace c887d49bb5e86cf4 ]---
Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was
already
in
my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler
registering seems to be the source of the trouble. What strikes
me
is that the oops occurred very low (unmask_IO_APIC_irq: we are
no
more in the analogy layer).

In order to be sure that the problem is located in analogy, it
would
be great to test that calling rtdm_request_irq(... , 48, ...)
does
not trigger the bug.

Here is a little test module you could try to insmod. If you do
not
want to bother finding out how to compile it, you can replace
the
code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source below.

Another interesting test would be to disable CONFIG_X86_IO_APIC
in
your kernel configuration (in "Processor type and features",
disable
the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

rtdm_printk("irq_test: INTERRUPT!\n");

return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

int err;

rtdm_printk("irq_test: before rtdm_irq_request\n");

err = rtdm_irq_request(&handle, 48, test_handler, 0,
"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err =
%d)\n",
err);

rtdm_printk("irq_test: before rtdm_irq_enable\n");

err = rtdm_irq_enable(&handle);

rtdm_printk("irq_test: after rtdm_irq_enable (err =
%d)\n",
err);

return err;
}

static void __exit __test_exit(void)
{

rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Can anyone help?

Best regards
Ettore Pedretti

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

Alexis.

Alexis.

#23 lore raw

Hi,

You gave me two test modules. I sent you the trace of the second module plus the trace of the attach procedure.

I am now sending the trace of the very first module you sent:

insmod irqTest.ko

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = 0)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = 0)

Is this what you meant?

Please note that all the previous xenomai and kernel patches are in place. Cheers
Ettore

2009/12/15 Alexis Berlemont <[email protected]>:

Quoted 996 lines
Quoted 8 lines · Ettore Pedretti

Hi,

I have added routeirq to the kernel parameters:

kernel          /boot/vmlinuz-2.6.31.1 root=LABEL=ROOTFS_TEST ro noht mem=2048M memmap=1024M pci=routeirq

Quoted 8 lines

When I insert your test module:

fangorn:~/control/CHAMP/irqTest# insmod test_module.ko

The trace is:

rq_test: before request_irq
irq_test: after request_irq (err = 0)

Great ! and did the "rtdm test module" behave well ?

Could you also send the kernel traces (with the debug messages we added).

Quoted 98 lines

When I try the attach procedure:

analogy_config analogy0 analogy_ni_pcimio Message from [email protected] at Dec 15 07:39:25 ... kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Dec 15 07:39:25 ... kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Dec 15 07:39:25 ... kernel:Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730 task.ti=f6c48000)

Message from [email protected] at Dec 15 07:39:25 ... kernel:I-pipe domain Linux

Message from [email protected] at Dec 15 07:39:25 ... kernel:Stack:

Message from [email protected] at Dec 15 07:39:25 ... kernel:Call Trace:

Message from [email protected] at Dec 15 07:39:25 ... kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Dec 15 07:39:25 ... kernel:EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f6c49dc8

Message from [email protected] at Dec 15 07:39:25 ... kernel:CR2: 0000000000000004

And the trace:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e32000
a4l: DAQ: 0xd0800000 mapped to f8e36000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: test_module xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix e1000 sata_mv libata unix [last unloaded:
scsi_wait_scan]

Pid: 3556, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7f029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a24280 ECX: f8c33e6c EDX: f8c33e60
ESI: 00000000 EDI: f8c33e60 EBP: f6c49e38 ESP: f6c49dc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730 task.ti=f6c48000)
I-pipe domain Linux

Stack:

 f6c49dd0 c10143ee f6c49dd8 f8c33e60 f6c49de0 c105ad27 f6c49dfc f8a10a5d <0> f8c2de00 00000000 00000001 f8c33e94 fffffff0 f6c49e14 f8c2e118 00000001
<0> f8c30d0d f8c33e88 f8c33e60 f6c49e38 f8c2eccf 00000001 f8c33e60 00000030

Call Trace:
 [<c10143ee>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105ad27>] ? xnintr_enable+0xb/0xd
 [<f8a10a5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2de00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2e118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2eccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8dd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2cfef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2d2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c106641a>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2d54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2f36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0f3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a11e77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a11dde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c1069ade>] ? losyscall_event+0xa9/0x190
 [<c10567fe>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069a35>] ? losyscall_event+0x0/0x190
 [<c10167d1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f6c49dc8
CR2: 0000000000000004

Quoted 873 lines
---[ end trace bcff6beb2ba30576 ]---

Ettore

2009/12/2 Alexis Berlemont <[email protected]>:

Quoted 864 lines

Hi,

Quoted 2 lines · Ettore Pedretti

Hi,

Sorry for the late reply.

Quoted 4 lines

I applied your kernel patch before applying the xenomai patch. When I insert the kernel patch I obtain:

insmod: error inserting 'test_module.ko': -1 Function not implemented

Yes. request_irq returns an error because the io_apic did not register the interrupt.

Quoted 1 line

Attached is the content of dmesg from boot to module insertion.

Thanks to your traces and a look at the x86-specific pci code in the kernel (arch/x86/pci), I think I understand the way it works.

The fact that request_irq return -ENOSYS is normal: the irq is not "enabled". In order to enable the pci card's irq, we have to enable the pci device (thanks to a call to pci_enable()). This operation will route the PCI interrupt line to an io_apic irq; after that, the io_apic will register the irq. Once this procedure is complete, the irq is made available for Linux.

That is the reason why, our little Linux test module failed and our little RTDM test module crashed.

If you had the kernel boot argument "pci=routeirq", both test modules should insmod fine because all pci interrupt are "enabled" during the PCI discovery.

Concerning the analogy driver, that does not explain the problem because the pci board enabling is _supposed_ to be ok. Could you also test the attach procedure with kernel boot argument specified above ?

Quoted 822 lines

Cheers
-ep

ps. I am leaving the mountain tomorrow and will be travelling until Friday. I hope I will be able to test the machine at distance without crashing it for good.

2009/11/29 Alexis Berlemont <[email protected]>:

Quoted 809 lines

Hi,

Quoted 175 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 110 lines
Quoted 107 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
   rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ... kernel:Oops: 0000 [#1] PREEMPT SMP fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ... kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ... kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ... kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ... kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ... kernel:Code:  Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ... kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ... kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1 EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)
I-pipe domain Linux

Stack:

 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000 00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84

Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 5 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful CPU0       CPU1
 0:        222          0   IO-APIC-edge      timer 1:          0          9   IO-APIC-edge      i8042 2:          0          0    XT-PIC-XT        cascade 12:          0        132   IO-APIC-edge      i8042 14:          0          8   IO-APIC-edge      ata_piix 15:          0      12358   IO-APIC-edge      ata_piix 20:          0          0   IO-APIC-fasteoi   astropci0 28:          0        235   IO-APIC-fasteoi   sata_mv 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ         CPU0        CPU1
516:           0           0         [IPI] 519:    46161773    46161772         [timer] 520:           0           0         [critical sync] 546:           0           0         [virtual]

Quoted 7 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 606 lines
Quoted 606 lines

Thank you for your time.

Quoted 604 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 599 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 8 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program
and send you the call-stack dump? I am willing to test your patch on
our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations;
so, do not bother changing your configuration for the moment.

Quoted 584 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 580 lines

Hi,

Quoted 10 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled.
So,
the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel configuration.

With the fact that there is still a NULL pointer bug without IO APIC,
the
bug is bound to be located in analogy. There may be some wrong write
access on the interrupt structure.

I will come back with a patch which dumps the structure's content at
various locations in the attach code.

Quoted 9 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 5 lines

Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti
<[email protected]>

Quoted 534 lines · wrote:
Quoted 534 lines

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m   := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable)
endif

KDIR    := /lib/modules/$(shell uname -r)/build
PWD     := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
    rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build
SUBDIRS=/home/ep41/control/CHAMP/irqTest modules
make[1]: Entering directory `/usr/src/linux-2.6.31.1'
 CC [M]  /home/ep41/control/CHAMP/irqTest/irqTest.o
 Building modules, stage 2.
 MODPOST 1 modules
 CC      /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
 LD [M]  /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe
irqbench
(probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module                  Size  Used by
xeno_irqbench           5152  0
xeno_native            83296  0
analogy_ni_pcimio      15676  0
analogy_ni_mio         41596  1 analogy_ni_pcimio
analogy_ni_tio         21724  1 analogy_ni_mio
analogy_8255            4060  1 analogy_ni_mio
analogy_ni_mite         9980  3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm              24244  3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3                  112900  1
jbd                    44016  1 ext3
mbcache                 6652  1 ext3
ide_pci_generic         3712  0
ide_core               79388  1 ide_pci_generic
e1000                 118204  0
ata_piix               15968  2
sata_mv                27632  0
libata                151468  2 ata_piix,sata_mv
unix                   24460  10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in
module

dmesg:

irqTest: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?

It's me who did wrong. I just tested the compilation inside the
kernel.

xnintr_* symbols are only exported for GPL compliant modules.
So,
could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

BTW, I disabled  CONFIG_X86_IO_APIC and  the SMP option: same
problem.

Could you send the call-stack dump ? Maybe, that will unveil a
clue.

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:

Hi,

On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:

Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I
need
to
use the comedi drivers for Xenomai for a NI PCI-6711
function
generator board.

When I try to use the test program cmd_write (or cmd-read) I
obtain
the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened
(fd=0)
cmd_write: basic descriptor retrieved
    subdevices count = 0
    read subdevice index = 0
    write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size
(fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303
/usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303
/usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0          [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619
 /lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619
 /lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426        /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
 /lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000
08:01
6144250    /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250    /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000
08:01
10808118   /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
 /usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000
08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112   /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426        /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618
 /lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618
 /lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted

This is probably because the device /dev/analogy0 does not
exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26
PST
2009
i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream)
loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module                  Size  Used by
xeno_native           105088  0
analogy_ni_pcimio      15644  0
analogy_ni_mio         44860  1 analogy_ni_pcimio
analogy_ni_tio         24956  1 analogy_ni_mio
analogy_8255            3900  1 analogy_ni_mio
analogy_ni_mite        10140  3
 analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio
xeno_analogy
 40220  5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm              28436  2
analogy_ni_mio,xeno_analogy astropci               10944  0
ext3                  109636  1
jbd                    43920  1 ext3
mbcache                 6272  1 ext3
ide_pci_generic         3712  0
ide_core               74204  1 ide_pci_generic
ata_piix               15748  2
sata_mv                26448  0
e1000                 114208  0
libata                142156  2 ata_piix,sata_mv
unix                   22992  10

According to this post:

http://www.mail-archive.com/[email protected]

The analogy driver "a4l_pcimio" will be registered with
your
last
insmod (analogy_ni_pcimio). You can check that by typing
"cat
/proc/analogy/drivers", you will see only one entry:
a4l_pcimio.

fangorn:~# cat /proc/analogy/drivers
--  Analogy drivers --

| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
--  Analogy devices --

| idx | status | driver
|  00 | Unused | No driver
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

I'm aware of the name change of the drivers:

http://www.mail-archive.com/[email protected]

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)

This is what happens when I try to attach the driver to de
device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:last sysfs file:
 /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85
d4
fe
ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01
00
00
8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84
0b
01
00
00 31

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1
[analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
 kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface
mode
= 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins
=
0,
iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq
48
BUG: unable to handle kernel NULL pointer dereference at
00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules
linked in: xeno_native analogy_ni_pcimio analogy_ni_mio
analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy
xeno_rtdm
astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix
sata_mv
e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1)
X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
 task.ti=f64cc000) I-pipe domain Linux
Stack:
 f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7
f64cddfc
f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0
f64cde14
f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38
f8c2cccf
00000001 f8c31e60 00000030 Call Trace:
 [<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8bd8a>] ? pcimio_attach+0x54d/0x664
[analogy_ni_pcimio]
 [<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c10699ae>] ? losyscall_event+0xa9/0x190
 [<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069905>] ? losyscall_event+0x0/0x190
 [<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff
8b
55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00
8b
42
18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01
00
00
31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP
0068:f64cddc8 CR2: 0000000000000004
---[ end trace c887d49bb5e86cf4 ]---

Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was
already
in
my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler
registering seems to be the source of the trouble. What
strikes
me
is that the oops occurred very low (unmask_IO_APIC_irq: we
are
no
more in the analogy layer).

In order to be sure that the problem is located in analogy,
it
would
be great to test that calling rtdm_request_irq(... , 48, ...)
does
not trigger the bug.

Here is a little test module you could try to insmod. If you
do
not
want to bother finding out how to compile it, you can replace
the
code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source
below.

Another interesting test would be to disable
CONFIG_X86_IO_APIC
in
your kernel configuration (in "Processor type and features",
disable
the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

    rtdm_printk("irq_test: INTERRUPT!\n");

    return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

    int err;

    rtdm_printk("irq_test: before rtdm_irq_request\n");

    err = rtdm_irq_request(&handle, 48, test_handler, 0,
"test_irq", NULL);

    rtdm_printk("irq_test: after rtdm_irq_request (err =
%d)\n",
err);

    rtdm_printk("irq_test: before rtdm_irq_enable\n");

    err = rtdm_irq_enable(&handle);

    rtdm_printk("irq_test: after rtdm_irq_enable (err =
%d)\n",
err);

    return err;
}

static void __exit __test_exit(void)
{

    rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Can anyone help?

Best regards
Ettore Pedretti

Alexis.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

Alexis.

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44-1334-461666, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532
#24 lore raw

Hi,

Sorry for the late reply.

Quoted 7 lines · Ettore Pedretti

Hi,

You gave me two test modules. I sent you the trace of the second module plus the trace of the attach procedure.

I am now sending the trace of the very first module you sent:

Quoted 9 lines

insmod irqTest.ko

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = 0)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = 0)

Is this what you meant?

Yes, thank you. The bug is definitely in the function ni_E_init(). Considering the number of cards supported by the ni_pcimio driver, the problem that you are facing is bound to occur in other configuration.

I will update the NI driver with configurable debug messages. I will come back as soon as possible. Sorry for the lack of reactivity, my free time is quite reduced during this pre-Christmas period.

Quoted 5 lines

Please note that all the previous xenomai and kernel patches are in place. Cheers
Ettore

Quoted 959 lines

2009/12/15 Alexis Berlemont <[email protected]>:

Quoted 955 lines
Quoted 7 lines · Ettore Pedretti

Hi,

I have added routeirq to the kernel parameters:

kernel /boot/vmlinuz-2.6.31.1 root=LABEL=ROOTFS_TEST ro noht
mem=2048M memmap=1024M pci=routeirq

Quoted 8 lines

When I insert your test module:

fangorn:~/control/CHAMP/irqTest# insmod test_module.ko

The trace is:

rq_test: before request_irq
irq_test: after request_irq (err = 0)

Great ! and did the "rtdm test module" behave well ?

Could you also send the kernel traces (with the debug messages we added).

Quoted 98 lines

When I try the attach procedure:

analogy_config analogy0 analogy_ni_pcimio Message from [email protected] at Dec 15 07:39:25 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Dec 15 07:39:25 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730
task.ti=f6c48000)

Message from [email protected] at Dec 15 07:39:25 ...
kernel:I-pipe domain Linux

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Stack:

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Call Trace:

Message from [email protected] at Dec 15 07:39:25 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff
8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31

Message from [email protected] at Dec 15 07:39:25 ...
kernel:EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP 0068:f6c49dc8

Message from [email protected] at Dec 15 07:39:25 ...
kernel:CR2: 0000000000000004

And the trace:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e32000
a4l: DAQ: 0xd0800000 mapped to f8e36000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
a4l: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: test_module xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix e1000 sata_mv libata unix [last unloaded:
scsi_wait_scan]

Pid: 3556, comm: analogy_config Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<f8c7f029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a24280 ECX: f8c33e6c EDX: f8c33e60
ESI: 00000000 EDI: f8c33e60 EBP: f6c49e38 ESP: f6c49dc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3556, ti=f6c48000 task=f790c730 task.ti=f6c48000)
I-pipe domain Linux

Stack:
 f6c49dd0 c10143ee f6c49dd8 f8c33e60 f6c49de0 c105ad27 f6c49dfc f8a10a5d

<0> f8c2de00 00000000 00000001 f8c33e94 fffffff0 f6c49e14 f8c2e118 00000001
<0> f8c30d0d f8c33e88 f8c33e60 f6c49e38 f8c2eccf 00000001 f8c33e60 00000030

Call Trace:
 [<c10143ee>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105ad27>] ? xnintr_enable+0xb/0xd
 [<f8a10a5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c2de00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c2e118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c2eccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c8dd8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c2cfef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
 [<f8c2d2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c106641a>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c2d54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c2f36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f8a0f3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a11e77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a11dde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c1069ade>] ? losyscall_event+0xa9/0x190
 [<c10567fe>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c1069a35>] ? losyscall_event+0x0/0x190
 [<c10167d1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55

9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31
EIP: [<f8c7f029>] ni_E_init+0x267/0xff1 [analogy_ni_mio] SS:ESP 0068:f6c49dc8
CR2: 0000000000000004

Quoted 835 lines
---[ end trace bcff6beb2ba30576 ]---

Ettore

2009/12/2 Alexis Berlemont <[email protected]>:

Quoted 827 lines

Hi,

Quoted 1 line · Ettore Pedretti

Hi,

Sorry for the late reply.

Quoted 4 lines

I applied your kernel patch before applying the xenomai patch. When I insert the kernel patch I obtain:

insmod: error inserting 'test_module.ko': -1 Function not implemented

Yes. request_irq returns an error because the io_apic did not register the interrupt.

Quoted 1 line

Attached is the content of dmesg from boot to module insertion.

Thanks to your traces and a look at the x86-specific pci code in the kernel (arch/x86/pci), I think I understand the way it works.

The fact that request_irq return -ENOSYS is normal: the irq is not "enabled". In order to enable the pci card's irq, we have to enable the pci device (thanks to a call to pci_enable()). This operation will route the PCI interrupt line to an io_apic irq; after that, the io_apic will register the irq. Once this procedure is complete, the irq is made available for Linux.

That is the reason why, our little Linux test module failed and our little RTDM test module crashed.

If you had the kernel boot argument "pci=routeirq", both test modules should insmod fine because all pci interrupt are "enabled" during the PCI discovery.

Concerning the analogy driver, that does not explain the problem because the pci board enabling is _supposed_ to be ok. Could you also test the attach procedure with kernel boot argument specified above ?

Quoted 790 lines

Cheers
-ep

ps. I am leaving the mountain tomorrow and will be travelling until Friday. I hope I will be able to test the machine at distance without crashing it for good.

2009/11/29 Alexis Berlemont <[email protected]>:

Quoted 778 lines

Hi,

Quoted 167 lines · Ettore Pedretti

2009/11/26 Alexis Berlemont <[email protected]>:

Quoted 108 lines
Quoted 106 lines · Ettore Pedretti

Hi Alexis,

I applied the patch to my local git repository:

fangorn:/usr/src#
cd xenomai-head/

fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
patch_debug_1.diff
fangorn:/usr/src/xenomai-head# git apply ../patch_debug_1.diff
../patch_debug_1.diff:14: trailing whitespace.
   rtdm_printk("\t handler=%p, irq=%d, cookie=%p\n",
warning: 1 line adds whitespace errors.

Then created a debian package:

git-buildpackage -us -uc -rfakeroot --git-debian-branch=master --git-upstream-branch=origin/master --git-ignore-new

built a new kernel package:

fakeroot make-kpkg --initrd --added-patches xenomai --revision=ipipeComedi.2.4.06 --config menuconfig binary-arch

and installed the Debian package with dpkg -i

This is what happens when i insert the module into the kernel:

fangorn:~/control/CHAMP/irqTest# insmod irqTest.ko
Killed

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Oops: 0000 [#1] PREEMPT SMP
fangorn:~/control/CHAMP/irqTest#
Message from [email protected] at Nov 26 00:09:52 ...
kernel:last sysfs file: /sys/class/net/lo/operstate

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Process insmod (pid: 3566, ti=f6c02000 task=f78634b0
task.ti=f6c02000)

Message from [email protected] at Nov 26 00:09:52 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Stack:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Call Trace:

Message from [email protected] at Nov 26 00:09:52 ...
kernel:Code: Bad EIP value.

Message from [email protected] at Nov 26 00:09:52 ...
kernel:EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18

Message from [email protected] at Nov 26 00:09:52 ...
kernel:CR2: 0000000000000000

dmesg after insmod:

irq_test: before rtdm_irq_request

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: irqTest(+) xeno_native analogy_ni_pcimio

analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix sata_mv e1000 libata unix [last unloaded:
scsi_wait_scan]

Pid: 3566, comm: insmod Not tainted (2.6.31.1 #1) X6DA8
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 1 EIP is at 0x0
EAX: 00000030 EBX: 00000000 ECX: 00000030 EDX: c1250b80
ESI: f8e24500 EDI: 00000000 EBP: f6c03f1c ESP: f6c03f18
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process insmod (pid: 3566, ti=f6c02000 task=f78634b0 task.ti=f6c02000)
I-pipe domain Linux

Stack:
 c1154166 f6c03f24 c105abf7 f6c03f40 f8a0ea5d f8e24000 00000000

00000000
<0> f8e27000 00000000 f6c03f58 f8e2703e 00000000 f8e24066 00000000 f8e27000
<0> f6c03f84 c1001028 f8e243c0 00000001 fffffffc f8e243c0 00000000 f6c03f84

Call Trace:
 [<c1154166>] ? rthal_irq_enable+0x2d/0x31
 [<c105abf7>] ? xnintr_enable+0xb/0xd
 [<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8e24000>] ? test_handler+0x0/0x1c [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<f8e2703e>] ? __test_init+0x3e/0x7e [irqTest]
 [<f8e27000>] ? __test_init+0x0/0x7e [irqTest]
 [<c1001028>] ? do_one_initcall+0x23/0x183
 [<c103a825>] ? blocking_notifier_call_chain+0x1a/0x1c
 [<c10481e9>] ? sys_init_module+0xad/0x1ec
 [<c1092cc5>] ? sys_close+0x71/0xb5
 [<c1002c25>] ? sysenter_do_call+0x12/0x16
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:f6c03f18
CR2: 0000000000000000
---[ end trace ac2616367ecf94b2 ]---
Quoted 4 lines
Quoted 1 line

I hope this is what you wanted me to try. Please let me know.

So if I understand well, you "insmoded" the little test module which does nothing but calling rtdm_irq_request() and the NULL pointer bug occured.

Correct

Quoted 2 lines

This bug occurred before calling analogy_config, you did not tried to attach the ni_pcimio driver, right ?

I insmod-ed the test module that gave that error dump. I later tried to attach the driver which causes the usual error. The stack-dumps I sent are solely related to insmod of test program.

Quoted 4 lines

If I am right, it seems like the bug is not located in analogy but between Xenomai's nucleus and Ipipe, which is ... weird.

What is your kernel configuration ? no IO_APIC ?

I put back my config to IO_APIC. Should I disable that again? attached is my kernel configuration (configAnalogy)

Quoted 1 line

Which irq did you try to request ? 48 or 5 ?

I do not know. do I have to pass parameters to insmod?

This is my /proc/interrupts if that is helpful
CPU0 CPU1

 0:        222          0   IO-APIC-edge      timer
 1:          0          9   IO-APIC-edge      i8042
 2:          0          0    XT-PIC-XT        cascade
 12:          0        132   IO-APIC-edge      i8042
 14:          0          8   IO-APIC-edge      ata_piix
 15:          0      12358   IO-APIC-edge      ata_piix
 20:          0          0   IO-APIC-fasteoi   astropci0
 28:          0        235   IO-APIC-fasteoi   sata_mv
 54:          0      77950   IO-APIC-fasteoi   eth0
NMI:          0          0   Non-maskable interrupts
LOC:   45365307   45365133   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:       2555       2212   Rescheduling interrupts
CAL:         60         58   Function call interrupts
TLB:        419        200   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        152        152   Machine check polls
ERR:          0
MIS:          0

and my /proc/xenomai/irq

IRQ CPU0 CPU1

516:           0           0         [IPI]
519:    46161773    46161772         [timer]
520:           0           0         [critical sync]
546:           0           0         [virtual]
Quoted 6 lines
Quoted 1 line

Which CPU are you using ?

CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03

As Philippe rightly pointed out this is a 32-bit install although the CPUs are 64 bit

Following Philippe's advice, I attached a little patch for your kernel sources. Could you apply it and send the kernel log messages ?

You will also find attached the sources of a little module which calls Linux' request_irq(48). Could you insmod the module and send a dump of /proc/interrupts ?

Quoted 586 lines
Quoted 586 lines

Thank you for your time.

Quoted 584 lines

Cheers
Ettore

2009/11/24 Alexis Berlemont <[email protected]>:

Quoted 579 lines · On Tuesday 24 November 2009 22:34:33 Ettore Pedretti wrote:
Quoted 7 lines

Hi,

Would it help at this stage if I re-enable IO APIC, run your program
and send you the call-stack dump? I am willing to test your patch on
our hardware as soon as you got one ready, if that can be of help.

Sorry, I did not answer your question. The bug occurs in both configurations;
so, do not bother changing your configuration for the moment.

Quoted 567 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:

Quoted 563 lines

Hi,

Quoted 9 lines · On Monday 23 November 2009 18:26:15 Ettore Pedretti wrote:

Hi,

It is finally working. here is the dmesg after I insert a
module:

irq_test: before rtdm_irq_request
irq_test: after rtdm_irq_request (err = -22)
irq_test: before rtdm_irq_enable
irq_test: after rtdm_irq_enable (err = -22)

rtdm_irq_request() returns -EINVAL because the IO APIC is disabled.
So,
the irq 48 turns into the irq 5;

Quoted 2 lines

Attached are a complete call-stack dump and my present kernel
configuration.

With the fact that there is still a NULL pointer bug without IO APIC,
the
bug is bound to be located in analogy. There may be some wrong write
access on the interrupt structure.

I will come back with a patch which dumps the structure's content at
various locations in the attach code.

Quoted 8 lines

Cheers
Ettore

2009/11/23 Alexis Berlemont <[email protected]>:
Hi,

On Mon, Nov 23, 2009 at 9:28 AM, Ettore Pedretti
<[email protected]>

Quoted 524 lines · wrote:

Hi,

I have compiled the module using this makefile:

prefix := $(shell /usr/bin/xeno-config --prefix)
obj-m := irqTest.o

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable)
endif

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
EXTRA_CFLAGS := -I/usr/include/xenomai -I/usr/include/

all: default

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install

clean:
rm -fr *.mod.c *.o *.ko irqTest *~ .irqTest* .tmp_versions

The module seems to compiles fine:

make -C /lib/modules/2.6.31.1/build
SUBDIRS=/home/ep41/control/CHAMP/irqTest modules
make[1]: Entering directory `/usr/src/linux-2.6.31.1'
CC [M] /home/ep41/control/CHAMP/irqTest/irqTest.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/ep41/control/CHAMP/irqTest/irqTest.mod.o
LD [M] /home/ep41/control/CHAMP/irqTest/irqTest.ko
make[1]: Leaving directory `/usr/src/linux-2.6.31.1'

To make sure module dependencies are in place I modprobe
irqbench
(probably not necessary).

modprobe xeno_irqbench

All the loaded modules:

fangorn:~# lsmod
Module Size Used by
xeno_irqbench 5152 0
xeno_native 83296 0
analogy_ni_pcimio 15676 0
analogy_ni_mio 41596 1 analogy_ni_pcimio
analogy_ni_tio 21724 1 analogy_ni_mio
analogy_8255 4060 1 analogy_ni_mio
analogy_ni_mite 9980 3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio xeno_analogy
38876 5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analogy_
ni_ mite xeno_rtdm 24244 3
xeno_irqbench,analogy_ni_mio,xeno_analogy astropci
10968 0
ext3 112900 1
jbd 44016 1 ext3
mbcache 6652 1 ext3
ide_pci_generic 3712 0
ide_core 79388 1 ide_pci_generic
e1000 118204 0
ata_piix 15968 2
sata_mv 27632 0
libata 151468 2 ata_piix,sata_mv
unix 24460 10

When I insert the module it complains about missing symbols:

insmod irqTest.ko

insmod: error inserting 'irqTest.ko': -1 Unknown symbol in
module

dmesg:

irqTest: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
irqTest: Unknown symbol xnintr_enable
irqTest: Unknown symbol xnintr_detach

What am I doing wrong?
It's me who did wrong. I just tested the compilation inside the
kernel.

xnintr_* symbols are only exported for GPL compliant modules.
So,
could you add the following line in the test module:
MODULE_LICENSE("GPL");

With that, the insmod operation should work.

BTW, I disabled CONFIG_X86_IO_APIC and the SMP option: same
problem.
Could you send the call-stack dump ? Maybe, that will unveil a
clue.

Cheers
Ettore

2009/11/22 Alexis Berlemont <[email protected]>:
Hi,

On Sunday 22 November 2009 20:35:51 Ettore Pedretti wrote:
Hello,

I downloaded Xenomai 2.5-rc4 from the xenomai-head.git. I
need
to
use the comedi drivers for Xenomai for a NI PCI-6711
function
generator board.

When I try to use the test program cmd_write (or cmd-read) I
obtain
the following:

fangorn:~# cmd_write -vcmd_write: device analogy0 opened
(fd=0)
cmd_write: basic descriptor retrieved
subdevices count = 0
read subdevice index = 0
write subdevice index = 0
cmd_write: a4l_get_desc failed (ret=-22)
*** glibc detected *** cmd_write: free(): invalid next size
(fast):
0x0804d008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6[0xb7e52624]
/lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7e54826]
cmd_write[0x804927c]
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfa455]
cmd_write[0x8048b01]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:01 10855303
/usr/bin/cmd_write
0804a000-0804b000 rw-p 00002000 08:01 10855303
/usr/bin/cmd_write
0804b000-0806e000 rw-p 00000000 00:00 0 [heap]
b7c00000-b7c21000 rw-p 00000000 00:00 0
b7c21000-b7d00000 ---p 00000000 00:00 0
b7dce000-b7dda000 r-xp 00000000 08:01 6127619
/lib/libgcc_s.so.1
b7dda000-b7ddb000 rw-p 0000b000 08:01 6127619
/lib/libgcc_s.so.1
b7de0000-b7de3000 rw-s 00000000 00:0b 426 /dev/rtheap
b7de3000-b7de4000 rw-p 00000000 00:00 0
b7de4000-b7f39000 r-xp 00000000 08:01 6144250
/lib/i686/cmov/libc-2.7.so b7f39000-b7f3a000 r--p 00155000
08:01
6144250 /lib/i686/cmov/libc-2.7.so b7f3a000-b7f3c000 rw-p
00156000 08:01 6144250 /lib/i686/cmov/libc-2.7.so
b7f3c000-b7f3f000 rw-p 00000000 00:00 0
b7f3f000-b7f54000 r-xp 00000000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f54000-b7f56000 rw-p 00014000 08:01 6144264
/lib/i686/cmov/libpthread-2.7.so
b7f56000-b7f58000 rw-p 00000000 00:00 0
b7f58000-b7f5a000 r-xp 00000000 08:01 10808118
/usr/lib/librtdm.so.1.0.0 b7f5a000-b7f5b000 rw-p 00001000
08:01
10808118 /usr/lib/librtdm.so.1.0.0 b7f5b000-b7f5c000 rw-p
00000000 00:00 0
b7f5c000-b7f63000 r-xp 00000000 08:01 10808119
/usr/lib/libnative.so.3.0.0 b7f63000-b7f64000 rw-p 00006000
08:01
10808119 /usr/lib/libnative.so.3.0.0 b7f64000-b7f67000 r-xp
00000000 08:01 10808112 /usr/lib/libanalogy.so.1.0.0
b7f67000-b7f68000 rw-p 00002000 08:01 10808112
/usr/lib/libanalogy.so.1.0.0
b7f69000-b7f6a000 rw-p 00000000 00:00 0
b7f6a000-b7f6d000 rw-s 00000000 00:0b 426 /dev/rtheap
b7f6d000-b7f6f000 rw-p 00000000 00:00 0
b7f6f000-b7f89000 r-xp 00000000 08:01 6127618
/lib/ld-2.7.so
b7f89000-b7f8b000 rw-p 0001a000 08:01 6127618
/lib/ld-2.7.so
bfab1000-bfac6000 rw-p 00000000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
Aborted

This is probably because the device /dev/analogy0 does not
exist.

This is the output of uname -a

Linux fangorn 2.6.31.1 #1 SMP PREEMPT Fri Nov 20 20:42:26
PST
2009
i686 GNU/Linux

And these are the relevant entries in dmesg

dmesg:

I-pipe 2.4-06: pipeline enabled.
I-pipe: Domain Xenomai registered.

Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5-rc4 (Flying In A Blue Dream)
loaded. Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Xenomai: starting native API services.
Analogy: MITE: Available NI device IDs: 0x1880

result of lspci for the relevant board:

04:01.0 Class ff00: National Instruments PCI-6711

And lsmod:

Module Size Used by
xeno_native 105088 0
analogy_ni_pcimio 15644 0
analogy_ni_mio 44860 1 analogy_ni_pcimio
analogy_ni_tio 24956 1 analogy_ni_mio
analogy_8255 3900 1 analogy_ni_mio
analogy_ni_mite 10140 3
analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio
xeno_analogy
40220 5

analogy_ni_pcimio,analogy_ni_mio,analogy_ni_tio,analogy_8255,analog
y_n i_mit e xeno_rtdm 28436 2
analogy_ni_mio,xeno_analogy astropci 10944 0
ext3 109636 1
jbd 43920 1 ext3
mbcache 6272 1 ext3
ide_pci_generic 3712 0
ide_core 74204 1 ide_pci_generic
ata_piix 15748 2
sata_mv 26448 0
e1000 114208 0
libata 142156 2 ata_piix,sata_mv
unix 22992 10

According to this post:

http://www.mail-archive.com/[email protected]

The analogy driver "a4l_pcimio" will be registered with
your
last
insmod (analogy_ni_pcimio). You can check that by typing
"cat
/proc/analogy/drivers", you will see only one entry:
a4l_pcimio.
fangorn:~# cat /proc/analogy/drivers
-- Analogy drivers --

| idx | driver name
| 00 | analogy_ni_pcimio
| 01 | analogy_8255

There are two entries and the drivers are not attached:

fangorn:~# cat /proc/analogy/devices
-- Analogy devices --

| idx | status | driver
| 00 | Unused | No driver
| 01 | Unused | No driver
| 02 | Unused | No driver
| 03 | Unused | No driver
| 04 | Unused | No driver
| 05 | Unused | No driver
| 06 | Unused | No driver
| 07 | Unused | No driver
| 08 | Unused | No driver
| 09 | Unused | No driver

I'm aware of the name change of the drivers:

http://www.mail-archive.com/[email protected]

- a4l_pcimio becomes analogy_ni_pcimio
- 8255 becomes analogy_8255.
Consequently, the command line to attach these drivers has
changed. Starting from now, we have to type:
- analogy_config analogyX analogy_ni_pcimio (instead of
a4l_pcimio)
This is what happens when I try to attach the driver to de
device:

fangorn:~# analogy_config analogy0 analogy_ni_pcimio

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Oops: 0000 [#1] PREEMPT SMP

Message from [email protected] at Nov 21 23:22:37 ...
kernel:last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Process analogy_config (pid: 3409, ti=f64cc000
task=f79013b0 task.ti=f64cc000)

Message from [email protected] at Nov 21 23:22:37 ...
kernel:I-pipe domain Linux

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Stack:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Call Trace:

Message from [email protected] at Nov 21 23:22:37 ...
kernel:Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85
d4
fe
ff
ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01
00
00
8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84
0b
01
00
00 31

Message from [email protected] at Nov 21 23:22:37 ...
kernel:EIP: [<f8c7d029>] ni_E_init+0x267/0xff1
[analogy_ni_mio]
SS:ESP 0068:f64cddc8

Message from [email protected] at Nov 21 23:22:37 ...
kernel:CR2: 0000000000000004

relevant dmeg:

a4l: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
a4l: MITE: 0xd0801000 mapped to f8e26000
a4l: DAQ: 0xd0800000 mapped to f8e2a000
a4l: MITE: version = 1, type = 1, mite mode = 1, interface
mode
= 3
a4l: MITE: num channels = 3, write post fifo depth = 1, wins
=
0,
iowins = 2 a4l: analogy_ni_pcimio: pcimio_attach: found irq
48
BUG: unable to handle kernel NULL pointer dereference at
00000004
IP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file:
/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/class
Modules
linked in: xeno_native analogy_ni_pcimio analogy_ni_mio
analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy
xeno_rtdm
astropci ext3 jbd mbcache ide_pci_generic ide_core ata_piix
sata_mv
e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3409, comm: analogy_config Not tainted (2.6.31.1 #1)
X6DA8
EIP: 0060:[<f8c7d029>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0xff1 [analogy_ni_mio]
EAX: 00000000 EBX: f8a22280 ECX: f8c31e6c EDX: f8c31e60
ESI: 00000000 EDI: f8c31e60 EBP: f64cde38 ESP: f64cddc8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3409, ti=f64cc000 task=f79013b0
task.ti=f64cc000) I-pipe domain Linux
Stack:
f64cddd0 c10142b6 f64cddd8 f8c31e60 f64cdde0 c105abf7
f64cddfc
f8a0ea5d <0> f8c2be00 00000000 00000001 f8c31e94 fffffff0
f64cde14
f8c2c118 00000001 <0> f8c2ed0d f8c31e88 f8c31e60 f64cde38
f8c2cccf
00000001 f8c31e60 00000030 Call Trace:
[<c10142b6>] ? unmask_IO_APIC_irq+0xd/0xf
[<c105abf7>] ? xnintr_enable+0xb/0xd
[<f8a0ea5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
[<f8c2be00>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
[<f8c2c118>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
[<f8c2cccf>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
[<f8c8bd8a>] ? pcimio_attach+0x54d/0x664
[analogy_ni_pcimio]
[<f8c2afef>] ? a4l_assign_driver+0x61/0x134 [xeno_analogy]
[<f8c2b2ba>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
[<c10662ea>] ? xnshadow_ppd_get+0x4f/0x58
[<f8c2b54f>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
[<f8c2d36f>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
[<f8a0d3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
[<f8a0fe77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
[<f8a0fdde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
[<c10699ae>] ? losyscall_event+0xa9/0x190
[<c10566ce>] ? __ipipe_dispatch_event+0xdf/0x201
[<c1069905>] ? losyscall_event+0x0/0x190
[<c10166a1>] ? __ipipe_syscall_root+0x3b/0xc4
[<c1002cfd>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 f2 f1 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff
ff
8b
55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00
8b
42
18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01
00
00
31
EIP: [<f8c7d029>] ni_E_init+0x267/0xff1 [analogy_ni_mio]
SS:ESP
0068:f64cddc8 CR2: 0000000000000004
---[ end trace c887d49bb5e86cf4 ]---
Thanks for such a great report.

I keep two things in mind:
- cmd_write's error handling path is not buggy (that was
already
in
my todo list). I will fix that as soon as possible.

- according to the call-stack dump you made, the irq handler
registering seems to be the source of the trouble. What
strikes
me
is that the oops occurred very low (unmask_IO_APIC_irq: we
are
no
more in the analogy layer).

In order to be sure that the problem is located in analogy,
it
would
be great to test that calling rtdm_request_irq(... , 48, ...)
does
not trigger the bug.

Here is a little test module you could try to insmod. If you
do
not
want to bother finding out how to compile it, you can replace
the
code of an existing rtdm driver (for example:
xenomai/ksrc/drivers/testing/irqbench.c) with the source
below.

Another interesting test would be to disable
CONFIG_X86_IO_APIC
in
your kernel configuration (in "Processor type and features",
disable
the SMP option and disable "IO APIC" under "Local APIC").

#include <linux/version.h>
#include <linux/module.h>
#include <linux/ioport.h>

#include <rtdm/rtdm_driver.h>

int test_handler(rtdm_irq_t *irq_handle)
{

rtdm_printk("irq_test: INTERRUPT!\n");

return RTDM_IRQ_HANDLED;
}

static rtdm_irq_t handle;

static int __init __test_init(void)
{

int err;

rtdm_printk("irq_test: before rtdm_irq_request\n");

err = rtdm_irq_request(&handle, 48, test_handler, 0,
"test_irq", NULL);

rtdm_printk("irq_test: after rtdm_irq_request (err =
%d)\n",
err);

rtdm_printk("irq_test: before rtdm_irq_enable\n");

err = rtdm_irq_enable(&handle);

rtdm_printk("irq_test: after rtdm_irq_enable (err =
%d)\n",
err);

return err;
}

static void __exit __test_exit(void)
{

rtdm_irq_free(&handle);

}

module_init(__test_init);
module_exit(__test_exit);

Can anyone help?

Best regards
Ettore Pedretti

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Alexis.

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Alexis.

Alexis.

Alexis.

Alexis.

#25 lore raw

Hi

I have installed Xenomai 2.5.0 and tried to attach the module:
analogy_config analogy0 analogy_ni_pcimio

The error trace is attached as a text file
Regards
Ettore

Linux version 2.6.32.2 (root@fangorn) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #1 SMP PREEMPT Tue Jan 5 09:42:50 PST 2010 KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009a800 (usable)
BIOS-e820: 000000000009a800 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000bff70000 (usable)
BIOS-e820: 00000000bff70000 - 00000000bff77000 (ACPI data)
BIOS-e820: 00000000bff77000 - 00000000bff80000 (ACPI NVS)
BIOS-e820: 00000000bff80000 - 00000000c0000000 (reserved)
BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ff800000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fffffc00 - 0000000100000000 (reserved)
user-defined physical RAM map:
user: 0000000000000000 - 000000000009a800 (usable)
user: 000000000009a800 - 00000000000a0000 (reserved)
user: 00000000000e4000 - 0000000000100000 (reserved)
user: 0000000000100000 - 0000000040000000 (usable)
user: 00000000bff70000 - 00000000bff77000 (ACPI data)
user: 00000000bff77000 - 00000000bff80000 (ACPI NVS)
user: 00000000bff80000 - 00000000c0000000 (reserved)
user: 00000000e0000000 - 00000000f0000000 (reserved)
user: 00000000fec00000 - 00000000fec10000 (reserved)
user: 00000000fee00000 - 00000000fee01000 (reserved)
user: 00000000ff800000 - 00000000ffc00000 (reserved)
user: 00000000fffffc00 - 0000000100000000 (reserved)
DMI present.
Phoenix BIOS detected: BIOS may corrupt low RAM, working around it.
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
last_pfn = 0x40000 max_arch_pfn = 0x100000
MTRR default type: uncachable
MTRR fixed ranges enabled:
00000-9FFFF write-back
A0000-BFFFF uncachable
C0000-C7FFF write-protect
C8000-DFFFF uncachable
E0000-FFFFF write-protect
MTRR variable ranges enabled:
0 base 000000000 mask F80000000 write-back
1 base 080000000 mask FC0000000 write-back
2 base 0BFF80000 mask FFFF80000 uncachable
3 disabled
4 disabled
5 disabled
6 disabled
7 disabled
Warning only 895MB will be used.
Use a HIGHMEM enabled kernel.
initial memory mapped : 0 - 01800000
init_memory_mapping: 0000000000000000-0000000037f1e000
0000000000 - 0000400000 page 4k
0000400000 - 0037c00000 page 2M
0037c00000 - 0037f1e000 page 4k
kernel direct mapping tables up to 37f1e000 @ 10000-15000
RAMDISK: 37e18000 - 37fefd20
Allocated new RAMDISK: 00100000 - 002d7d20
Move RAMDISK from 0000000037e18000 - 0000000037fefd1f to 00100000 - 002d7d1f
895MB LOWMEM available.
mapped low ram: 0 - 37f1e000
low ram: 0 - 37f1e000
node 0 low ram: 00000000 - 37f1e000
node 0 bootmap 00011000 - 00017fe4
(9 early reservations) ==> bootmem [0000000000 - 0037f1e000]
#0 [0000000000 - 0000001000] BIOS data page ==> [0000000000 - 0000001000]
#1 [0000001000 - 0000002000] EX TRAMPOLINE ==> [0000001000 - 0000002000]
#2 [0000006000 - 0000007000] TRAMPOLINE ==> [0000006000 - 0000007000]
#3 [0001000000 - 0001327338] TEXT DATA BSS ==> [0001000000 - 0001327338]
#4 [000009a800 - 0000100000] BIOS reserved ==> [000009a800 - 0000100000]
#5 [0001328000 - 000132e170] BRK ==> [0001328000 - 000132e170]
#6 [0000010000 - 0000011000] PGTABLE ==> [0000010000 - 0000011000]
#7 [0000100000 - 00002d7d20] NEW RAMDISK ==> [0000100000 - 00002d7d20]
#8 [0000011000 - 0000018000] BOOTMAP ==> [0000011000 - 0000018000]
found SMP MP-table at [c00f5d90] f5d90
Zone PFN ranges:
DMA 0x00000010 -> 0x00001000
Normal 0x00001000 -> 0x00037f1e
Movable zone start PFN for each node
early_node_map[2] active PFN ranges

    0: 0x00000010 -> 0x0000009a
    0: 0x00000100 -> 0x00037f1e

On node 0 totalpages: 229032
free_area_init_node: node 0, pgdat c1269900, node_mem_map c132f200
DMA zone: 32 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 3946 pages, LIFO batch:0
Normal zone: 1759 pages used for memmap
Normal zone: 223295 pages, LIFO batch:31
Using APIC driver default
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
MPTABLE: OEM ID: INTEL
MPTABLE: Product ID: Lindenhurst
MPTABLE: APIC at: 0xFEE00000
Processor #0 (Bootup-CPU)
Processor #6
I/O APIC #2 Version 32 at 0xFEC00000.
I/O APIC #3 Version 32 at 0xFEC81000.
I/O APIC #4 Version 32 at 0xFEC81400.
Enabling APIC mode: Flat. Using 3 I/O APICs
Processors: 2
SMP: Allowing 2 CPUs, 0 hotplug CPUs
nr_irqs_gsi: 72
Allocating PCI resources starting at 40000000 (gap: 40000000:7ff70000)
NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:2 nr_node_ids:1
PERCPU: Embedded 13 pages/cpu @c1c00000 s30744 r0 d22504 u2097152
pcpu-alloc: s30744 r0 d22504 u2097152 alloc=1*4194304
pcpu-alloc: [0] 0 1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 227241
Kernel command line: root=LABEL=ROOTFS_TEST ro noht mem=2048M memmap=1024M pci=routeirq PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
Memory: 902596k/916600k available (1831k kernel code, 13236k reserved, 650k data, 308k init, 0k highmem) virtual kernel memory layout:

    fixmap  : 0xfff20000 - 0xfffff000   ( 892 kB)
    vmalloc : 0xf871e000 - 0xfff1e000   ( 120 MB)
    lowmem  : 0xc0000000 - 0xf7f1e000   ( 895 MB)
      .init : 0xc126d000 - 0xc12ba000   ( 308 kB)
      .data : 0xc11c9d7b - 0xc126c618   ( 650 kB)
      .text : 0xc1000000 - 0xc11c9d7b   (1831 kB)

Checking if this processor honours the WP bit even in supervisor mode...Ok.
Hierarchical RCU implementation.
NR_IRQS:512
I-pipe 2.5-00: pipeline enabled.
Console: colour VGA+ 80x25
console [tty0] enabled
Fast TSC calibration using PIT
Detected 3000.216 MHz processor.
Calibrating delay loop (skipped), value calculated using timer frequency.. 6000.43 BogoMIPS (lpj=3000216) Mount-cache hash table entries: 512
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
mce: CPU supports 4 MCE banks
CPU0: Thermal monitoring enabled (TM1)
Checking 'hlt' instruction... OK.
Freeing SMP alternatives: 10k freed
ExtINT not setup in hardware but reported by MP table
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
..MP-BIOS bug: 8254 timer not connected to IO-APIC
...trying to set up timer (IRQ0) through the 8259A ...
..... (found apic 0 pin 0) ...
....... works.
CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
Booting processor 1 APIC 0x6 ip 0x6000
Initializing CPU#1
Calibrating delay using timer specific routine.. 5999.18 BogoMIPS (lpj=2999591)
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 3
CPU: Processor Core ID: 0
CPU1: Thermal monitoring enabled (TM1)
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
checking TSC synchronization [CPU#0 -> CPU#1]: passed.
Brought up 2 CPUs
Total of 2 processors activated (11999.61 BogoMIPS).
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xfd870, last bus=6
PCI: Using configuration type 1 for base access
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
PCI: Probing PCI hardware
PCI: Probing PCI hardware (bus 00)
pci 0000:00:02.0: PME# supported from D0 D3hot D3cold
pci 0000:00:02.0: PME# disabled
pci 0000:00:03.0: PME# supported from D0 D3hot D3cold
pci 0000:00:03.0: PME# disabled
pci 0000:00:04.0: PME# supported from D0 D3hot D3cold
pci 0000:00:04.0: PME# disabled
pci 0000:00:1d.0: reg 20 io port: [0x1840-0x185f]
pci 0000:00:1d.1: reg 20 io port: [0x1860-0x187f]
pci 0000:00:1d.2: reg 20 io port: [0x1880-0x189f]
pci 0000:00:1d.3: reg 20 io port: [0x18a0-0x18bf]
pci 0000:00:1d.7: reg 10 32bit mmio: [0xd0000000-0xd00003ff]
pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
pci 0000:00:1d.7: PME# disabled
pci 0000:00:1f.0: quirk: region 1000-107f claimed by ICH4 ACPI/GPIO/TCO
pci 0000:00:1f.0: quirk: region 1180-11bf claimed by ICH4 GPIO
pci 0000:00:1f.2: reg 10 io port: [0x00-0x07]
pci 0000:00:1f.2: reg 14 io port: [0x00-0x03]
pci 0000:00:1f.2: reg 18 io port: [0x00-0x07]
pci 0000:00:1f.2: reg 1c io port: [0x00-0x03]
pci 0000:00:1f.2: reg 20 io port: [0x18f0-0x18ff]
pci 0000:00:1f.3: reg 20 io port: [0x1100-0x111f]
pci 0000:00:1f.5: reg 10 io port: [0x1400-0x14ff]
pci 0000:00:1f.5: reg 14 io port: [0x1800-0x183f]
pci 0000:00:1f.5: reg 18 32bit mmio: [0xd0000c00-0xd0000dff]
pci 0000:00:1f.5: reg 1c 32bit mmio: [0xd0000800-0xd00008ff]
pci 0000:00:1f.5: PME# supported from D0 D3hot D3cold
pci 0000:00:1f.5: PME# disabled
pci 0000:02:00.0: PXH quirk detected; SHPC device MSI disabled
pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
pci 0000:02:00.0: PME# disabled
pci 0000:02:00.1: reg 10 32bit mmio: [0xd0100000-0xd0100fff]
pci 0000:02:00.2: PXH quirk detected; SHPC device MSI disabled
pci 0000:02:00.2: PME# supported from D0 D3hot D3cold
pci 0000:02:00.2: PME# disabled
pci 0000:02:00.3: reg 10 32bit mmio: [0xd0101000-0xd0101fff]
pci 0000:00:03.0: bridge io port: [0x2000-0x3fff]
pci 0000:00:03.0: bridge 32bit mmio: [0xd0100000-0xd08fffff]
pci 0000:03:03.0: reg 10 64bit mmio: [0xd0200000-0xd02fffff]
pci 0000:03:03.0: reg 18 io port: [0x2000-0x20ff]
pci 0000:02:00.0: bridge io port: [0x2000-0x2fff]
pci 0000:02:00.0: bridge 32bit mmio: [0xd0200000-0xd07fffff]
pci 0000:04:01.0: reg 10 32bit mmio: [0xd0801000-0xd0801fff]
pci 0000:04:01.0: reg 14 32bit mmio: [0xd0800000-0xd0800fff]
pci 0000:04:02.0: reg 10 64bit mmio: [0xd0820000-0xd083ffff]
pci 0000:04:02.0: reg 20 io port: [0x3000-0x303f]
pci 0000:04:02.0: PME# supported from D0 D3hot D3cold
pci 0000:04:02.0: PME# disabled
pci 0000:04:02.1: reg 10 64bit mmio: [0xd0840000-0xd085ffff]
pci 0000:04:02.1: reg 20 io port: [0x3040-0x307f]
pci 0000:04:02.1: PME# supported from D0 D3hot D3cold
pci 0000:04:02.1: PME# disabled
pci 0000:02:00.2: bridge io port: [0x3000-0x3fff]
pci 0000:02:00.2: bridge 32bit mmio: [0xd0800000-0xd08fffff]
pci 0000:05:00.0: reg 10 32bit mmio pref: [0xd8000000-0xdfffffff]
pci 0000:05:00.0: reg 14 io port: [0x4000-0x40ff]
pci 0000:05:00.0: reg 18 32bit mmio: [0xd0900000-0xd090ffff]
pci 0000:05:00.0: reg 30 32bit mmio pref: [0x000000-0x01ffff]
pci 0000:05:00.0: supports D1 D2
pci 0000:05:00.1: reg 10 32bit mmio: [0xd0910000-0xd091ffff]
pci 0000:05:00.1: supports D1 D2
pci 0000:00:04.0: bridge io port: [0x4000-0x4fff]
pci 0000:00:04.0: bridge 32bit mmio: [0xd0900000-0xd09fffff]
pci 0000:00:04.0: bridge 64bit mmio pref: [0xd8000000-0xdfffffff]
pci 0000:06:02.0: reg 10 32bit mmio: [0xd0a00000-0xd0a0ffff]
pci 0000:00:1e.0: transparent bridge
pci 0000:00:1e.0: bridge 32bit mmio: [0xd0a00000-0xd0afffff]
vgaarb: device added: PCI:0000:05:00.0,decodes=io+mem,owns=io+mem,locks=none
pci 0000:00:1f.0: PIIX/ICH IRQ router [8086:24d0]
PCI: Routing PCI interrupts for all devices because "pci=routeirq" specified
pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.1: PCI->APIC IRQ transform: INT B -> IRQ 19
pci 0000:00:1d.2: PCI->APIC IRQ transform: INT C -> IRQ 18
pci 0000:00:1d.3: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.7: PCI->APIC IRQ transform: INT D -> IRQ 23
pci 0000:00:1f.2: PCI->APIC IRQ transform: INT A -> IRQ 18
pci 0000:00:1f.3: PCI->APIC IRQ transform: INT B -> IRQ 17
pci 0000:00:1f.5: PCI->APIC IRQ transform: INT B -> IRQ 17
pci 0000:03:03.0: PCI->APIC IRQ transform: INT A -> IRQ 28
pci 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
pci 0000:04:02.0: PCI->APIC IRQ transform: INT A -> IRQ 54
pci 0000:04:02.1: PCI->APIC IRQ transform: INT B -> IRQ 55
pci 0000:05:00.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:06:02.0: PCI->APIC IRQ transform: INT A -> IRQ 20
Switching to clocksource tsc
pci 0000:00:02.0: PCI bridge, secondary bus 0000:01

pci 0000:00:02.0:   IO window: disabled
pci 0000:00:02.0:   MEM window: disabled
pci 0000:00:02.0:   PREFETCH window: disabled
pci 0000:02:00.0: PCI bridge, secondary bus 0000:03
pci 0000:02:00.0:   IO window: 0x2000-0x2fff
pci 0000:02:00.0:   MEM window: 0xd0200000-0xd07fffff
pci 0000:02:00.0:   PREFETCH window: disabled
pci 0000:02:00.2: PCI bridge, secondary bus 0000:04
pci 0000:02:00.2:   IO window: 0x3000-0x3fff
pci 0000:02:00.2:   MEM window: 0xd0800000-0xd08fffff
pci 0000:02:00.2:   PREFETCH window: disabled
pci 0000:00:03.0: PCI bridge, secondary bus 0000:02
pci 0000:00:03.0:   IO window: 0x2000-0x3fff
pci 0000:00:03.0:   MEM window: 0xd0100000-0xd08fffff
pci 0000:00:03.0:   PREFETCH window: disabled
pci 0000:00:04.0: PCI bridge, secondary bus 0000:05
pci 0000:00:04.0:   IO window: 0x4000-0x4fff
pci 0000:00:04.0:   MEM window: 0xd0900000-0xd09fffff
pci 0000:00:04.0:   PREFETCH window: 0x000000d8000000-0x000000dfffffff
pci 0000:00:1e.0: PCI bridge, secondary bus 0000:06
pci 0000:00:1e.0:   IO window: disabled
pci 0000:00:1e.0:   MEM window: 0xd0a00000-0xd0afffff
pci 0000:00:1e.0:   PREFETCH window: disabled

pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:02.0: setting latency timer to 64
pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:03.0: setting latency timer to 64
pci 0000:02:00.0: setting latency timer to 64
pci 0000:02:00.2: setting latency timer to 64
pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:04.0: setting latency timer to 64
pci 0000:00:1e.0: setting latency timer to 64
pci_bus 0000:00: resource 0 io: [0x00-0xffff]
pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffff] pci_bus 0000:02: resource 0 io: [0x2000-0x3fff]
pci_bus 0000:02: resource 1 mem: [0xd0100000-0xd08fffff] pci_bus 0000:03: resource 0 io: [0x2000-0x2fff]
pci_bus 0000:03: resource 1 mem: [0xd0200000-0xd07fffff] pci_bus 0000:04: resource 0 io: [0x3000-0x3fff]
pci_bus 0000:04: resource 1 mem: [0xd0800000-0xd08fffff] pci_bus 0000:05: resource 0 io: [0x4000-0x4fff]
pci_bus 0000:05: resource 1 mem: [0xd0900000-0xd09fffff] pci_bus 0000:05: resource 2 pref mem [0xd8000000-0xdfffffff] pci_bus 0000:06: resource 1 mem: [0xd0a00000-0xd0afffff] pci_bus 0000:06: resource 3 io: [0x00-0xffff]
pci_bus 0000:06: resource 4 mem: [0x000000-0xffffffff]
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes) TCP established hash table entries: 131072 (order: 8, 1048576 bytes) TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 131072 bind 65536) TCP reno registered
pci 0000:05:00.0: Boot video device
Unpacking initramfs...
Freeing initrd memory: 1887k freed
platform rtc_cmos: registered platform RTC device (no PNP device found)
audit: initializing netlink socket (disabled)
type=2000 audit(1262714306.287:1): initialized
I-pipe: Domain Xenomai registered.
Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5.0 (Flying In A Blue Dream) loaded. msgmni has been set to 1767
io scheduler noop registered
io scheduler deadline registered (default)
pcieport 0000:00:02.0: setting latency timer to 64
pcieport 0000:00:03.0: setting latency timer to 64
pcieport 0000:00:04.0: setting latency timer to 64
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
Using IPI Shortcut mode
Freeing unused kernel memory: 308k freed
input: AT Translated Set 2 keyboard as /class/input/input0
NET: Registered protocol family 1
libata version 3.00 loaded.
Intel(R) PRO/1000 Network Driver - version 7.3.21-k5-NAPI Copyright (c) 1999-2006 Intel Corporation.
e1000 0000:04:02.0: PCI->APIC IRQ transform: INT A -> IRQ 54 ata_piix 0000:00:1f.2: version 2.13
ata_piix 0000:00:1f.2: PCI->APIC IRQ transform: INT A -> IRQ 18 ata_piix 0000:00:1f.2: MAP [ IDE IDE P0 P1 ]
ata_piix 0000:00:1f.2: setting latency timer to 64
scsi0 : ata_piix
scsi1 : ata_piix
ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x18f0 irq 14
ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x18f8 irq 15 sata_mv 0000:03:03.0: version 1.28
sata_mv 0000:03:03.0: PCI->APIC IRQ transform: INT A -> IRQ 28 sata_mv 0000:03:03.0: Gen-II 32 slots 8 ports SCSI mode IRQ via INTx scsi2 : sata_mv
scsi3 : sata_mv
scsi4 : sata_mv
scsi5 : sata_mv
scsi6 : sata_mv
scsi7 : sata_mv
scsi8 : sata_mv
scsi9 : sata_mv
ata3: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0222000 irq 28
ata4: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0224000 irq 28
ata5: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0226000 irq 28
ata6: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0228000 irq 28
ata7: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0232000 irq 28
ata8: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0234000 irq 28
ata9: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0236000 irq 28
ata10: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0238000 irq 28 ata2.00: ATA-7: HDT722525DLA380, V44OA96A, max UDMA/133 ata2.00: 488397168 sectors, multi 16: LBA48 NCQ (depth 0/32)
ata1.00: ATAPI: SONY DVD RW DW-Q30A, YYS2, max UDMA/66
ata1.00: limited to UDMA/33 due to 40-wire cable
ata2.01: ATA-8: ST31000333AS, CC1H, max UDMA/133
ata2.01: 1953525168 sectors, multi 16: LBA48 NCQ (depth 0/32) ata2.00: configured for UDMA/133
ata1.00: configured for UDMA/33
scsi 0:0:0:0: CD-ROM SONY DVD RW DW-Q30A YYS2 PQ: 0 ANSI: 5
ata2.01: configured for UDMA/133

scsi 1:0:0:0: Direct-Access     ATA      HDT722525DLA380  V44O PQ: 0 ANSI: 5
scsi 1:0:1:0: Direct-Access     ATA      ST31000333AS     CC1H PQ: 0 ANSI: 5

sd 1:0:1:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdb:
input: ImPS/2 Logitech Wheel Mouse as /class/input/input1
e1000: 0000:04:02.0: e1000_probe: (PCI:33MHz:64-bit) 00:30:48:2e:94:b6
sdb1 sdb2 sdb3 sdb4
sd 1:0:1:0: [sdb] Attached SCSI disk
sda: sda1 sda2 <
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000 0000:04:02.1: PCI->APIC IRQ transform: INT B -> IRQ 55
sda5 >
sd 1:0:0:0: [sda] Attached SCSI disk
ata3: SATA link down (SStatus 0 SControl 300)
e1000: 0000:04:02.1: e1000_probe: (PCI:33MHz:64-bit) 00:30:48:2e:94:b7
e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection
ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata4.00: ATA-8: WDC WD1001FALS-00J7B1, 05.00K05, max UDMA/133
ata4.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata4.00: configured for UDMA/133
scsi 3:0:0:0: Direct-Access ATA WDC WD1001FALS-0 05.0 PQ: 0 ANSI: 5
sd 3:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 00 3a 00 00
sd 3:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdc: sdc1 sdc2 sdc3
sd 3:0:0:0: [sdc] Attached SCSI disk
ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata5.00: ATA-8: ST32000542AS, CC34, max UDMA/133
ata5.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata5.00: configured for UDMA/133
scsi 4:0:0:0: Direct-Access ATA ST32000542AS CC34 PQ: 0 ANSI: 5
sd 4:0:0:0: [sdd] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB) sd 4:0:0:0: [sdd] Write Protect is off
sd 4:0:0:0: [sdd] Mode Sense: 00 3a 00 00
sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdd: sdd1
sd 4:0:0:0: [sdd] Attached SCSI disk
ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata6.00: ATA-7: ST3120813AS, 2AAA, max UDMA/133
ata6.00: 234441648 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata6.00: configured for UDMA/133
scsi 5:0:0:0: Direct-Access ATA ST3120813AS 2AAA PQ: 0 ANSI: 5
sd 5:0:0:0: [sde] 234441648 512-byte logical blocks: (120 GB/111 GiB)
sd 5:0:0:0: [sde] Write Protect is off
sd 5:0:0:0: [sde] Mode Sense: 00 3a 00 00
sd 5:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sde: sde1 sde2 sde3
sd 5:0:0:0: [sde] Attached SCSI disk
ata7: SATA link down (SStatus 0 SControl 300)
ata8: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata8.00: ATA-7: ST3120813AS, 2AAA, max UDMA/133
ata8.00: 234441648 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata8.00: configured for UDMA/133
scsi 7:0:0:0: Direct-Access ATA ST3120813AS 2AAA PQ: 0 ANSI: 5
sd 7:0:0:0: [sdf] 234441648 512-byte logical blocks: (120 GB/111 GiB)
sd 7:0:0:0: [sdf] Write Protect is off
sd 7:0:0:0: [sdf] Mode Sense: 00 3a 00 00
sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdf: sdf1 sdf2 sdf3
sd 7:0:0:0: [sdf] Attached SCSI disk
ata9: SATA link down (SStatus 0 SControl 300)
ata10: SATA link down (SStatus 0 SControl 300)
Uniform Multi-Platform E-IDE driver
EXT3-fs: mounted filesystem with writeback data mode.
kjournald starting. Commit interval 5 seconds
udevd version 125 started
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Analogy: MITE: Available NI device IDs: 0x1880(used)
Adding 2650684k swap on /dev/sda5. Priority:-1 extents:1 across:2650684k EXT3 FS on sda1, internal journal
Xenomai: starting native API services.
e1000: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
warning: `ntpd' uses 32-bit capabilities (legacy support in use)
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 58 to 1
set_rtc_mmss: can't update from 59 to 1
set_rtc_mmss: can't update from 59 to 1
set_rtc_mmss: can't update from 59 to 1
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
set_rtc_mmss: can't update from 59 to 2
Analogy: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
Analogy: MITE: 0xd0801000 mapped to f8e24000
Analogy: DAQ: 0xd0800000 mapped to f8e28000
Analogy: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
Analogy: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
Analogy: analogy_ni_pcimio: pcimio_attach: found irq 48

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c70061>] ni_E_init+0x267/0x1009 [analogy_ni_mio]
*pde = 00000000 
Oops: 0000 [#1] PREEMPT SMP 
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm ext3 jbd mbcache ide_pci_generic ide_core sata_mv ata_piix e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3849, comm: analogy_config Not tainted (2.6.32.2 #1) X6DA8
EIP: 0060:[<f8c70061>] EFLAGS: 00010202 CPU: 1
EIP is at ni_E_init+0x267/0x1009 [analogy_ni_mio]
EAX: 00000000 EBX: f8a15280 ECX: f8c2336c EDX: f8c23360
ESI: 00000000 EDI: f8c23360 EBP: f5831e24 ESP: f5831db4
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3849, ti=f5830000 task=f78ff7d0 task.ti=f5830000) I-pipe domain Linux

Stack:
 f5831dbc c10139e3 f5831dc4 f8c23360 f5831dcc c105d577 f5831de8 f8a00a5d
<0> f8c1ef30 00000000 00000001 f8c23394 fffffff0 f5831e00 f8c1f240 00000001
<0> f8c2251d f8c23388 f8c23360 f5831e24 f8c1fdef 00000001 f8c23360 00000030
Call Trace:
 [<c10139e3>] ? unmask_IO_APIC_irq+0xd/0xf
 [<c105d577>] ? xnintr_enable+0xb/0xd
 [<f8a00a5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c1ef30>] ? a4l_handle_irq+0x0/0x1a [xeno_analogy]
 [<f8c1f240>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c1fdef>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c82d8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c1e0af>] ? a4l_assign_driver+0x61/0x13c [xeno_analogy]
 [<f8c1e382>] ? a4l_device_attach+0x54/0x6d [xeno_analogy]
 [<c1068ca8>] ? xnshadow_ppd_get+0x4f/0x58
 [<f8c1e617>] ? a4l_ioctl_devcfg+0x57/0x104 [xeno_analogy]
 [<f8c204af>] ? a4l_rt_ioctl+0x33/0x3a [xeno_analogy]
 [<f89ff3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a01e77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a01dde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c106c584>] ? losyscall_event+0xa7/0x2c7
 [<c105925e>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c106c4dd>] ? losyscall_event+0x0/0x2c7
 [<c10169f1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002d7d>] ? system_call+0x2d/0x4f
Code: 8b 45 9c e8 da f2 fa ff 89 c2 83 f8 01 0f 85 d4 fe ff ff 8b 55 9c 8b 82 74 01 00 00 8b 00 f6 40 3c 06 0f 84 22 01 00 00 8b 42 18 <8b> 40 04 89 45 b0 8b 40 14 8b 40 04 85 c0 0f 84 0b 01 00 00 31 
EIP: [<f8c70061>] ni_E_init+0x267/0x1009 [analogy_ni_mio] SS:ESP 0068:f5831db4
CR2: 0000000000000004
---[ end trace 9c888f2ba4161d5a ]---
#26 lore raw

Hi,

Quoted 6 lines · Ettore Pedretti

Hi

I have installed Xenomai 2.5.0 and tried to attach the module:
analogy_config analogy0 analogy_ni_pcimio

The error trace is attached as a text file

I do not see any analogy debug traces. In your kernel configuration, have you configured the following options like this:
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG=y CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=1 CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

Quoted 3 lines

Regards
Ettore

Alexis.

#27 lore raw

Hi,

There was no option in menuconfig for enabling
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=1
CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

I edited .config manually and that worked (I hope).

Error trace attached. I hope this will narrow-down the problem

Ettore

2010/1/5 Alexis Berlemont <[email protected]>:

Quoted 22 lines

Hi,

Quoted 7 lines · Ettore Pedretti

Hi

I have installed Xenomai 2.5.0 and tried to attach the module:
analogy_config analogy0 analogy_ni_pcimio

The error trace is attached as a text file

I do not see any analogy debug traces. In your kernel configuration, have you configured the following options like this:
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG=y CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=1 CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

Quoted 3 lines

Regards
Ettore

Alexis.

Signature · 6 lines
Ettore Pedretti, SUPA
School of Physics and Astronomy
University of St Andrews, North Haugh,
St Andrews, Fife, KY16 9SS, Scotland
Ph: +44-1334-461666, Fax: +44-1334-463104
The University of St Andrews is a charity registered in Scotland : No SC013532

Linux version 2.6.32.2 (root@fangorn) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #1 SMP PREEMPT Wed Jan 6 04:18:06 PST 2010 KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009a800 (usable)
BIOS-e820: 000000000009a800 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000bff70000 (usable)
BIOS-e820: 00000000bff70000 - 00000000bff77000 (ACPI data)
BIOS-e820: 00000000bff77000 - 00000000bff80000 (ACPI NVS)
BIOS-e820: 00000000bff80000 - 00000000c0000000 (reserved)
BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ff800000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fffffc00 - 0000000100000000 (reserved)
user-defined physical RAM map:
user: 0000000000000000 - 000000000009a800 (usable)
user: 000000000009a800 - 00000000000a0000 (reserved)
user: 00000000000e4000 - 0000000000100000 (reserved)
user: 0000000000100000 - 0000000040000000 (usable)
user: 00000000bff70000 - 00000000bff77000 (ACPI data)
user: 00000000bff77000 - 00000000bff80000 (ACPI NVS)
user: 00000000bff80000 - 00000000c0000000 (reserved)
user: 00000000e0000000 - 00000000f0000000 (reserved)
user: 00000000fec00000 - 00000000fec10000 (reserved)
user: 00000000fee00000 - 00000000fee01000 (reserved)
user: 00000000ff800000 - 00000000ffc00000 (reserved)
user: 00000000fffffc00 - 0000000100000000 (reserved)
DMI present.
Phoenix BIOS detected: BIOS may corrupt low RAM, working around it.
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
last_pfn = 0x40000 max_arch_pfn = 0x100000
MTRR default type: uncachable
MTRR fixed ranges enabled:
00000-9FFFF write-back
A0000-BFFFF uncachable
C0000-C7FFF write-protect
C8000-DFFFF uncachable
E0000-FFFFF write-protect
MTRR variable ranges enabled:
0 base 000000000 mask F80000000 write-back
1 base 080000000 mask FC0000000 write-back
2 base 0BFF80000 mask FFFF80000 uncachable
3 disabled
4 disabled
5 disabled
6 disabled
7 disabled
Warning only 895MB will be used.
Use a HIGHMEM enabled kernel.
initial memory mapped : 0 - 01800000
init_memory_mapping: 0000000000000000-0000000037f1e000
0000000000 - 0000400000 page 4k
0000400000 - 0037c00000 page 2M
0037c00000 - 0037f1e000 page 4k
kernel direct mapping tables up to 37f1e000 @ 10000-15000
RAMDISK: 37e18000 - 37feffc5
Allocated new RAMDISK: 00100000 - 002d7fc5
Move RAMDISK from 0000000037e18000 - 0000000037feffc4 to 00100000 - 002d7fc4
895MB LOWMEM available.
mapped low ram: 0 - 37f1e000
low ram: 0 - 37f1e000
node 0 low ram: 00000000 - 37f1e000
node 0 bootmap 00011000 - 00017fe4
(9 early reservations) ==> bootmem [0000000000 - 0037f1e000]
#0 [0000000000 - 0000001000] BIOS data page ==> [0000000000 - 0000001000]
#1 [0000001000 - 0000002000] EX TRAMPOLINE ==> [0000001000 - 0000002000]
#2 [0000006000 - 0000007000] TRAMPOLINE ==> [0000006000 - 0000007000]
#3 [0001000000 - 0001327338] TEXT DATA BSS ==> [0001000000 - 0001327338]
#4 [000009a800 - 0000100000] BIOS reserved ==> [000009a800 - 0000100000]
#5 [0001328000 - 000132e170] BRK ==> [0001328000 - 000132e170]
#6 [0000010000 - 0000011000] PGTABLE ==> [0000010000 - 0000011000]
#7 [0000100000 - 00002d7fc5] NEW RAMDISK ==> [0000100000 - 00002d7fc5]
#8 [0000011000 - 0000018000] BOOTMAP ==> [0000011000 - 0000018000]
found SMP MP-table at [c00f5d90] f5d90
Zone PFN ranges:
DMA 0x00000010 -> 0x00001000
Normal 0x00001000 -> 0x00037f1e
Movable zone start PFN for each node
early_node_map[2] active PFN ranges

    0: 0x00000010 -> 0x0000009a
    0: 0x00000100 -> 0x00037f1e

On node 0 totalpages: 229032
free_area_init_node: node 0, pgdat c1269900, node_mem_map c132f200
DMA zone: 32 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 3946 pages, LIFO batch:0
Normal zone: 1759 pages used for memmap
Normal zone: 223295 pages, LIFO batch:31
Using APIC driver default
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
MPTABLE: OEM ID: INTEL
MPTABLE: Product ID: Lindenhurst
MPTABLE: APIC at: 0xFEE00000
Processor #0 (Bootup-CPU)
Processor #6
I/O APIC #2 Version 32 at 0xFEC00000.
I/O APIC #3 Version 32 at 0xFEC81000.
I/O APIC #4 Version 32 at 0xFEC81400.
Enabling APIC mode: Flat. Using 3 I/O APICs
Processors: 2
SMP: Allowing 2 CPUs, 0 hotplug CPUs
nr_irqs_gsi: 72
Allocating PCI resources starting at 40000000 (gap: 40000000:7ff70000)
NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:2 nr_node_ids:1
PERCPU: Embedded 13 pages/cpu @c1c00000 s30744 r0 d22504 u2097152
pcpu-alloc: s30744 r0 d22504 u2097152 alloc=1*4194304
pcpu-alloc: [0] 0 1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 227241
Kernel command line: root=LABEL=ROOTFS_TEST ro noht mem=2048M memmap=1024M pci=routeirq PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
Memory: 902596k/916600k available (1830k kernel code, 13236k reserved, 650k data, 308k init, 0k highmem) virtual kernel memory layout:

    fixmap  : 0xfff20000 - 0xfffff000   ( 892 kB)
    vmalloc : 0xf871e000 - 0xfff1e000   ( 120 MB)
    lowmem  : 0xc0000000 - 0xf7f1e000   ( 895 MB)
      .init : 0xc126d000 - 0xc12ba000   ( 308 kB)
      .data : 0xc11c9a6b - 0xc126c618   ( 650 kB)
      .text : 0xc1000000 - 0xc11c9a6b   (1830 kB)

Checking if this processor honours the WP bit even in supervisor mode...Ok.
Hierarchical RCU implementation.
NR_IRQS:512
I-pipe 2.5-00: pipeline enabled.
Console: colour VGA+ 80x25
console [tty0] enabled
Fast TSC calibration using PIT
Detected 2999.916 MHz processor.
Calibrating delay loop (skipped), value calculated using timer frequency.. 5999.83 BogoMIPS (lpj=2999916) Mount-cache hash table entries: 512
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
mce: CPU supports 4 MCE banks
CPU0: Thermal monitoring enabled (TM1)
Checking 'hlt' instruction... OK.
Freeing SMP alternatives: 10k freed
ExtINT not setup in hardware but reported by MP table
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
..MP-BIOS bug: 8254 timer not connected to IO-APIC
...trying to set up timer (IRQ0) through the 8259A ...
..... (found apic 0 pin 0) ...
....... works.
CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
Booting processor 1 APIC 0x6 ip 0x6000
Initializing CPU#1
Calibrating delay using timer specific routine.. 5999.17 BogoMIPS (lpj=2999588)
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 3
CPU: Processor Core ID: 0
CPU1: Thermal monitoring enabled (TM1)
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
checking TSC synchronization [CPU#0 -> CPU#1]: passed.
Brought up 2 CPUs
Total of 2 processors activated (11999.00 BogoMIPS).
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xfd870, last bus=6
PCI: Using configuration type 1 for base access
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
PCI: Probing PCI hardware
PCI: Probing PCI hardware (bus 00)
pci 0000:00:02.0: PME# supported from D0 D3hot D3cold
pci 0000:00:02.0: PME# disabled
pci 0000:00:03.0: PME# supported from D0 D3hot D3cold
pci 0000:00:03.0: PME# disabled
pci 0000:00:04.0: PME# supported from D0 D3hot D3cold
pci 0000:00:04.0: PME# disabled
pci 0000:00:1d.0: reg 20 io port: [0x1840-0x185f]
pci 0000:00:1d.1: reg 20 io port: [0x1860-0x187f]
pci 0000:00:1d.2: reg 20 io port: [0x1880-0x189f]
pci 0000:00:1d.3: reg 20 io port: [0x18a0-0x18bf]
pci 0000:00:1d.7: reg 10 32bit mmio: [0xd0000000-0xd00003ff]
pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
pci 0000:00:1d.7: PME# disabled
pci 0000:00:1f.0: quirk: region 1000-107f claimed by ICH4 ACPI/GPIO/TCO
pci 0000:00:1f.0: quirk: region 1180-11bf claimed by ICH4 GPIO
pci 0000:00:1f.2: reg 10 io port: [0x00-0x07]
pci 0000:00:1f.2: reg 14 io port: [0x00-0x03]
pci 0000:00:1f.2: reg 18 io port: [0x00-0x07]
pci 0000:00:1f.2: reg 1c io port: [0x00-0x03]
pci 0000:00:1f.2: reg 20 io port: [0x18f0-0x18ff]
pci 0000:00:1f.3: reg 20 io port: [0x1100-0x111f]
pci 0000:00:1f.5: reg 10 io port: [0x1400-0x14ff]
pci 0000:00:1f.5: reg 14 io port: [0x1800-0x183f]
pci 0000:00:1f.5: reg 18 32bit mmio: [0xd0000c00-0xd0000dff]
pci 0000:00:1f.5: reg 1c 32bit mmio: [0xd0000800-0xd00008ff]
pci 0000:00:1f.5: PME# supported from D0 D3hot D3cold
pci 0000:00:1f.5: PME# disabled
pci 0000:02:00.0: PXH quirk detected; SHPC device MSI disabled
pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
pci 0000:02:00.0: PME# disabled
pci 0000:02:00.1: reg 10 32bit mmio: [0xd0100000-0xd0100fff]
pci 0000:02:00.2: PXH quirk detected; SHPC device MSI disabled
pci 0000:02:00.2: PME# supported from D0 D3hot D3cold
pci 0000:02:00.2: PME# disabled
pci 0000:02:00.3: reg 10 32bit mmio: [0xd0101000-0xd0101fff]
pci 0000:00:03.0: bridge io port: [0x2000-0x3fff]
pci 0000:00:03.0: bridge 32bit mmio: [0xd0100000-0xd08fffff]
pci 0000:03:03.0: reg 10 64bit mmio: [0xd0200000-0xd02fffff]
pci 0000:03:03.0: reg 18 io port: [0x2000-0x20ff]
pci 0000:02:00.0: bridge io port: [0x2000-0x2fff]
pci 0000:02:00.0: bridge 32bit mmio: [0xd0200000-0xd07fffff]
pci 0000:04:01.0: reg 10 32bit mmio: [0xd0801000-0xd0801fff]
pci 0000:04:01.0: reg 14 32bit mmio: [0xd0800000-0xd0800fff]
pci 0000:04:02.0: reg 10 64bit mmio: [0xd0820000-0xd083ffff]
pci 0000:04:02.0: reg 20 io port: [0x3000-0x303f]
pci 0000:04:02.0: PME# supported from D0 D3hot D3cold
pci 0000:04:02.0: PME# disabled
pci 0000:04:02.1: reg 10 64bit mmio: [0xd0840000-0xd085ffff]
pci 0000:04:02.1: reg 20 io port: [0x3040-0x307f]
pci 0000:04:02.1: PME# supported from D0 D3hot D3cold
pci 0000:04:02.1: PME# disabled
pci 0000:02:00.2: bridge io port: [0x3000-0x3fff]
pci 0000:02:00.2: bridge 32bit mmio: [0xd0800000-0xd08fffff]
pci 0000:05:00.0: reg 10 32bit mmio pref: [0xd8000000-0xdfffffff]
pci 0000:05:00.0: reg 14 io port: [0x4000-0x40ff]
pci 0000:05:00.0: reg 18 32bit mmio: [0xd0900000-0xd090ffff]
pci 0000:05:00.0: reg 30 32bit mmio pref: [0x000000-0x01ffff]
pci 0000:05:00.0: supports D1 D2
pci 0000:05:00.1: reg 10 32bit mmio: [0xd0910000-0xd091ffff]
pci 0000:05:00.1: supports D1 D2
pci 0000:00:04.0: bridge io port: [0x4000-0x4fff]
pci 0000:00:04.0: bridge 32bit mmio: [0xd0900000-0xd09fffff]
pci 0000:00:04.0: bridge 64bit mmio pref: [0xd8000000-0xdfffffff]
pci 0000:06:02.0: reg 10 32bit mmio: [0xd0a00000-0xd0a0ffff]
pci 0000:00:1e.0: transparent bridge
pci 0000:00:1e.0: bridge 32bit mmio: [0xd0a00000-0xd0afffff]
vgaarb: device added: PCI:0000:05:00.0,decodes=io+mem,owns=io+mem,locks=none
pci 0000:00:1f.0: PIIX/ICH IRQ router [8086:24d0]
PCI: Routing PCI interrupts for all devices because "pci=routeirq" specified
pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.1: PCI->APIC IRQ transform: INT B -> IRQ 19
pci 0000:00:1d.2: PCI->APIC IRQ transform: INT C -> IRQ 18
pci 0000:00:1d.3: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.7: PCI->APIC IRQ transform: INT D -> IRQ 23
pci 0000:00:1f.2: PCI->APIC IRQ transform: INT A -> IRQ 18
pci 0000:00:1f.3: PCI->APIC IRQ transform: INT B -> IRQ 17
pci 0000:00:1f.5: PCI->APIC IRQ transform: INT B -> IRQ 17
pci 0000:03:03.0: PCI->APIC IRQ transform: INT A -> IRQ 28
pci 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
pci 0000:04:02.0: PCI->APIC IRQ transform: INT A -> IRQ 54
pci 0000:04:02.1: PCI->APIC IRQ transform: INT B -> IRQ 55
pci 0000:05:00.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:06:02.0: PCI->APIC IRQ transform: INT A -> IRQ 20
Switching to clocksource tsc
pci 0000:00:02.0: PCI bridge, secondary bus 0000:01

pci 0000:00:02.0:   IO window: disabled
pci 0000:00:02.0:   MEM window: disabled
pci 0000:00:02.0:   PREFETCH window: disabled
pci 0000:02:00.0: PCI bridge, secondary bus 0000:03
pci 0000:02:00.0:   IO window: 0x2000-0x2fff
pci 0000:02:00.0:   MEM window: 0xd0200000-0xd07fffff
pci 0000:02:00.0:   PREFETCH window: disabled
pci 0000:02:00.2: PCI bridge, secondary bus 0000:04
pci 0000:02:00.2:   IO window: 0x3000-0x3fff
pci 0000:02:00.2:   MEM window: 0xd0800000-0xd08fffff
pci 0000:02:00.2:   PREFETCH window: disabled
pci 0000:00:03.0: PCI bridge, secondary bus 0000:02
pci 0000:00:03.0:   IO window: 0x2000-0x3fff
pci 0000:00:03.0:   MEM window: 0xd0100000-0xd08fffff
pci 0000:00:03.0:   PREFETCH window: disabled
pci 0000:00:04.0: PCI bridge, secondary bus 0000:05
pci 0000:00:04.0:   IO window: 0x4000-0x4fff
pci 0000:00:04.0:   MEM window: 0xd0900000-0xd09fffff
pci 0000:00:04.0:   PREFETCH window: 0x000000d8000000-0x000000dfffffff
pci 0000:00:1e.0: PCI bridge, secondary bus 0000:06
pci 0000:00:1e.0:   IO window: disabled
pci 0000:00:1e.0:   MEM window: 0xd0a00000-0xd0afffff
pci 0000:00:1e.0:   PREFETCH window: disabled

pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:02.0: setting latency timer to 64
pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:03.0: setting latency timer to 64
pci 0000:02:00.0: setting latency timer to 64
pci 0000:02:00.2: setting latency timer to 64
pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:04.0: setting latency timer to 64
pci 0000:00:1e.0: setting latency timer to 64
pci_bus 0000:00: resource 0 io: [0x00-0xffff]
pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffff] pci_bus 0000:02: resource 0 io: [0x2000-0x3fff]
pci_bus 0000:02: resource 1 mem: [0xd0100000-0xd08fffff] pci_bus 0000:03: resource 0 io: [0x2000-0x2fff]
pci_bus 0000:03: resource 1 mem: [0xd0200000-0xd07fffff] pci_bus 0000:04: resource 0 io: [0x3000-0x3fff]
pci_bus 0000:04: resource 1 mem: [0xd0800000-0xd08fffff] pci_bus 0000:05: resource 0 io: [0x4000-0x4fff]
pci_bus 0000:05: resource 1 mem: [0xd0900000-0xd09fffff] pci_bus 0000:05: resource 2 pref mem [0xd8000000-0xdfffffff] pci_bus 0000:06: resource 1 mem: [0xd0a00000-0xd0afffff] pci_bus 0000:06: resource 3 io: [0x00-0xffff]
pci_bus 0000:06: resource 4 mem: [0x000000-0xffffffff]
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes) TCP established hash table entries: 131072 (order: 8, 1048576 bytes) TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 131072 bind 65536) TCP reno registered
pci 0000:05:00.0: Boot video device
Unpacking initramfs...
Freeing initrd memory: 1887k freed
platform rtc_cmos: registered platform RTC device (no PNP device found)
audit: initializing netlink socket (disabled)
type=2000 audit(1262785485.289:1): initialized
I-pipe: Domain Xenomai registered.
Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5.0 (Flying In A Blue Dream) loaded. msgmni has been set to 1767
io scheduler noop registered
io scheduler deadline registered (default)
pcieport 0000:00:02.0: setting latency timer to 64
pcieport 0000:00:03.0: setting latency timer to 64
pcieport 0000:00:04.0: setting latency timer to 64
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
Using IPI Shortcut mode
Freeing unused kernel memory: 308k freed
input: AT Translated Set 2 keyboard as /class/input/input0
NET: Registered protocol family 1
Intel(R) PRO/1000 Network Driver - version 7.3.21-k5-NAPI Copyright (c) 1999-2006 Intel Corporation.
e1000 0000:04:02.0: PCI->APIC IRQ transform: INT A -> IRQ 54 libata version 3.00 loaded.
ata_piix 0000:00:1f.2: version 2.13
ata_piix 0000:00:1f.2: PCI->APIC IRQ transform: INT A -> IRQ 18 ata_piix 0000:00:1f.2: MAP [ IDE IDE P0 P1 ]
ata_piix 0000:00:1f.2: setting latency timer to 64
scsi0 : ata_piix
scsi1 : ata_piix
ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x18f0 irq 14
ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x18f8 irq 15 sata_mv 0000:03:03.0: version 1.28
sata_mv 0000:03:03.0: PCI->APIC IRQ transform: INT A -> IRQ 28 sata_mv 0000:03:03.0: Gen-II 32 slots 8 ports SCSI mode IRQ via INTx scsi2 : sata_mv
scsi3 : sata_mv
scsi4 : sata_mv
scsi5 : sata_mv
scsi6 : sata_mv
scsi7 : sata_mv
scsi8 : sata_mv
scsi9 : sata_mv
ata3: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0222000 irq 28
ata4: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0224000 irq 28
ata5: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0226000 irq 28
ata6: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0228000 irq 28
ata7: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0232000 irq 28
ata8: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0234000 irq 28
ata9: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0236000 irq 28
ata10: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0238000 irq 28 ata2.00: ATA-7: HDT722525DLA380, V44OA96A, max UDMA/133 ata2.00: 488397168 sectors, multi 16: LBA48 NCQ (depth 0/32)
ata1.00: ATAPI: SONY DVD RW DW-Q30A, YYS2, max UDMA/66
ata1.00: limited to UDMA/33 due to 40-wire cable
ata2.01: ATA-8: ST31000333AS, CC1H, max UDMA/133
ata2.01: 1953525168 sectors, multi 16: LBA48 NCQ (depth 0/32) ata2.00: configured for UDMA/133
ata1.00: configured for UDMA/33
scsi 0:0:0:0: CD-ROM SONY DVD RW DW-Q30A YYS2 PQ: 0 ANSI: 5
input: ImPS/2 Logitech Wheel Mouse as /class/input/input1 ata2.01: configured for UDMA/133

scsi 1:0:0:0: Direct-Access     ATA      HDT722525DLA380  V44O PQ: 0 ANSI: 5
scsi 1:0:1:0: Direct-Access     ATA      ST31000333AS     CC1H PQ: 0 ANSI: 5

sd 1:0:1:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) sd 1:0:1:0: [sdb] Write Protect is off
sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdb: sdb1 sdb2 sdb3 sdb4
sda:
e1000: 0000:04:02.0: e1000_probe: (PCI:33MHz:64-bit) 00:30:48:2e:94:b6
sda1 sda2 <
sd 1:0:1:0: [sdb] Attached SCSI disk
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000 0000:04:02.1: PCI->APIC IRQ transform: INT B -> IRQ 55
sda5 >
sd 1:0:0:0: [sda] Attached SCSI disk
ata3: SATA link down (SStatus 0 SControl 300)
e1000: 0000:04:02.1: e1000_probe: (PCI:33MHz:64-bit) 00:30:48:2e:94:b7
e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection
ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata4.00: ATA-8: WDC WD1001FALS-00J7B1, 05.00K05, max UDMA/133
ata4.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata4.00: configured for UDMA/133
scsi 3:0:0:0: Direct-Access ATA WDC WD1001FALS-0 05.0 PQ: 0 ANSI: 5
sd 3:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 00 3a 00 00
sd 3:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdc: sdc1 sdc2 sdc3
sd 3:0:0:0: [sdc] Attached SCSI disk
ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata5.00: ATA-8: ST32000542AS, CC34, max UDMA/133
ata5.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata5.00: configured for UDMA/133
scsi 4:0:0:0: Direct-Access ATA ST32000542AS CC34 PQ: 0 ANSI: 5
sd 4:0:0:0: [sdd] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB) sd 4:0:0:0: [sdd] Write Protect is off
sd 4:0:0:0: [sdd] Mode Sense: 00 3a 00 00
sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdd: sdd1
sd 4:0:0:0: [sdd] Attached SCSI disk
ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata6.00: ATA-7: ST3120813AS, 2AAA, max UDMA/133
ata6.00: 234441648 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata6.00: configured for UDMA/133
scsi 5:0:0:0: Direct-Access ATA ST3120813AS 2AAA PQ: 0 ANSI: 5
sd 5:0:0:0: [sde] 234441648 512-byte logical blocks: (120 GB/111 GiB)
sd 5:0:0:0: [sde] Write Protect is off
sd 5:0:0:0: [sde] Mode Sense: 00 3a 00 00
sd 5:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sde: sde1 sde2 sde3
sd 5:0:0:0: [sde] Attached SCSI disk
ata7: SATA link down (SStatus 0 SControl 300)
ata8: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata8.00: ATA-7: ST3120813AS, 2AAA, max UDMA/133
ata8.00: 234441648 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata8.00: configured for UDMA/133
scsi 7:0:0:0: Direct-Access ATA ST3120813AS 2AAA PQ: 0 ANSI: 5
sd 7:0:0:0: [sdf] 234441648 512-byte logical blocks: (120 GB/111 GiB)
sd 7:0:0:0: [sdf] Write Protect is off
sd 7:0:0:0: [sdf] Mode Sense: 00 3a 00 00
sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdf: sdf1 sdf2 sdf3
sd 7:0:0:0: [sdf] Attached SCSI disk
ata9: SATA link down (SStatus 0 SControl 300)
ata10: SATA link down (SStatus 0 SControl 300)
Uniform Multi-Platform E-IDE driver
EXT3-fs: mounted filesystem with writeback data mode.
kjournald starting. Commit interval 5 seconds
udevd version 125 started
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Analogy: MITE: Available NI device IDs: 0x1880
Analogy: a4l_add_drv: name=analogy_8255
Analogy: a4l_lct_drv: name=analogy_8255
Analogy: a4l_add_drv: name=analogy_ni_pcimio
Analogy: a4l_lct_drv: name=analogy_ni_pcimio
Adding 2650684k swap on /dev/sda5. Priority:-1 extents:1 across:2650684k EXT3 FS on sda1, internal journal
Xenomai: starting native API services.
e1000: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
warning: `ntpd' uses 32-bit capabilities (legacy support in use)
Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_devcfg: minor=0
Analogy: a4l_presetup_transfer: minor=0
Analogy: a4l_device_attach: minor=0
Analogy: a4l_fill_lnkdesc: minor=0
Analogy: a4l_lct_drv: name=analogy_ni_pcimio
Analogy: a4l_assign_driver: minor=0
Analogy: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
Analogy: MITE: 0xd0801000 mapped to f8e26000
Analogy: DAQ: 0xd0800000 mapped to f8e2a000
Analogy: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
Analogy: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
Analogy: analogy_ni_pcimio: pcimio_attach: found irq 48
Analogy: analogy_ni_pcimio: mio_common: starting attach procedure...
Analogy: analogy_ni_pcimio: mio_common: registering AI subdevice...
Analogy: analogy_ni_pcimio: mio_common: AI subdevice not present
Analogy: analogy_ni_pcimio: mio_common: AI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering AO subdevice...
Analogy: analogy_ni_pcimio: mio_common: AO: 4 channels
Analogy: analogy_ni_pcimio: mio_common: AO subdevice registered

BUG: unable to handle kernel NULL pointer dereference at 00000004
IP: [<f8c73162>] ni_E_init+0x368/0x1565 [analogy_ni_mio]
*pde = 00000000 
Oops: 0000 [#1] PREEMPT SMP 
last sysfs file: /sys/class/net/lo/operstate
Modules linked in: xeno_native analogy_ni_pcimio analogy_ni_mio analogy_ni_tio analogy_8255 analogy_ni_mite xeno_analogy xeno_rtdm ext3 jbd mbcache ide_pci_generic ide_core sata_mv ata_piix e1000 libata unix [last unloaded: scsi_wait_scan]

Pid: 3705, comm: analogy_config Not tainted (2.6.32.2 #1) X6DA8
EIP: 0060:[<f8c73162>] EFLAGS: 00010202 CPU: 0
EIP is at ni_E_init+0x368/0x1565 [analogy_ni_mio]
EAX: 00000000 EBX: f8a15280 ECX: f8c24d80 EDX: 0094e000
ESI: c0c00380 EDI: f8c24d80 EBP: f6be3e18 ESP: f6be3db8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process analogy_config (pid: 3705, ti=f6be2000 task=f78767d0 task.ti=f6be2000) I-pipe domain Linux

Stack:
 f8c75554 f8c864f9 00000004 f8a00a5d f8c24d80 00000000 00000001 f8c24db4
<0> fffffff0 f6be3df4 f8c204b0 00000001 f8c23f35 f8c24da8 f8c24d80 f6be3e18
<0> f8c210af 00000001 f8c24d80 00000030 00000000 00000030 c0c00380 c0c003a0
Call Trace:
 [<f8a00a5d>] ? rtdm_irq_request+0x48/0x5e [xeno_rtdm]
 [<f8c204b0>] ? __a4l_request_irq+0x33/0x39 [xeno_analogy]
 [<f8c210af>] ? a4l_request_irq+0x98/0xaf [xeno_analogy]
 [<f8c85d8a>] ? pcimio_attach+0x54d/0x664 [analogy_ni_pcimio]
 [<f8c1f26c>] ? a4l_assign_driver+0x81/0x170 [xeno_analogy]
 [<f8c1f592>] ? a4l_device_attach+0x74/0x8d [xeno_analogy]
 [<f8c1f843>] ? a4l_ioctl_devcfg+0x73/0x11c [xeno_analogy]
 [<f8c217ef>] ? a4l_rt_ioctl+0x4f/0x56 [xeno_analogy]
 [<f89ff3e6>] ? __rt_dev_ioctl+0xd1/0xd8 [xeno_rtdm]
 [<f8a01e77>] ? sys_rtdm_open+0x5c/0x64 [xeno_rtdm]
 [<f8a01dde>] ? sys_rtdm_ioctl+0x29/0x2b [xeno_rtdm]
 [<c106c584>] ? losyscall_event+0xa7/0x2c7
 [<c105925e>] ? __ipipe_dispatch_event+0xdf/0x201
 [<c106c4dd>] ? losyscall_event+0x0/0x2c7
 [<c10169f1>] ? __ipipe_syscall_root+0x3b/0xc4
 [<c1002d7d>] ? system_call+0x2d/0x4f
Code: 8b 50 10 89 54 24 04 c7 04 24 54 55 c7 f8 e8 8a 30 55 c8 8b 4d b0 8b 81 74 01 00 00 8b 00 f6 40 3c 06 0f 84 c9 00 00 00 8b 41 18 <8b> 40 04 89 45 bc 8b 40 14 8b 40 04 85 c0 0f 84 b2 00 00 00 31 
EIP: [<f8c73162>] ni_E_init+0x368/0x1565 [analogy_ni_mio] SS:ESP 0068:f6be3db8
CR2: 0000000000000004
---[ end trace 4ab8cafb94eb805d ]---

Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_close: minor=0

#28 lore raw
Quoted 5 lines · Ettore Pedretti

Hi,

There was no option in menuconfig for enabling
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=1
CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

That's weird. There must be a bug somewhere. Could you send me your last .config file?

Quoted 4 lines

I edited .config manually and that worked (I hope).

Error trace attached. I hope this will narrow-down the problem

Thank you. I think I fixed the bug. I updated my git repository (branch analogy). Could you test it ?

If you do not want to bother with git. Here is the patch:

ksrc/drivers/analogy/national_instruments/mio_common.c +6 -1
index c722384..db9762a 100644
@@ -3732,9 +3732,14 @@ void mio_common_detach(a4l_dev_t * dev)
 
 static void init_ao_67xx(a4l_dev_t * dev)
 {
-       a4l_subd_t *subd = dev->transfer.subds[NI_AO_SUBDEV];
+       a4l_subd_t *subd = a4l_get_subd(dev, NI_AO_SUBDEV);
        int i;
 
+       if (subd == NULL) {
+               a4l_err(dev, "%s: unable to find AO subdevice\n", __FUNCTION__);
+               return;
+       }
+
        for (i = 0; i < subd->chan_desc->length; i++)
                ni_ao_win_outw(dev, AO_Channel(i) | 0x0,
                               AO_Configuration_2_67xx);
Quoted 27 lines

Ettore

2010/1/5 Alexis Berlemont <[email protected]>:

Quoted 20 lines

Hi,

Quoted 6 lines · Ettore Pedretti

Hi

I have installed Xenomai 2.5.0 and tried to attach the module:
analogy_config analogy0 analogy_ni_pcimio

The error trace is attached as a text file

I do not see any analogy debug traces. In your kernel configuration, have you configured the following options like this:
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG=y CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=1 CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

Quoted 3 lines

Regards
Ettore

Alexis.

Alexis.

#29 lore raw

Hi,

I did not quite understand how to checkout the analogy branch. When I do git branch -a either in xenomai-head or in xenomai-2.5 I get only:

* master
origin/HEAD
origin/master

no other branch is available for checkout. I'm obviously missing something.

I tried to apply the patch but it failed. At the end I edited mio_common.c directly. I hope I did not introduce any error. Everything compiled and installed fine.

The attach command did not complain this time:

analogy_config analogy0 analogy_ni_pcimio

The error trace is attached (dmesg_07Jan2010.txt). I also attached the kernel config as you asked: (config_analogy).

However the device /dev/analogy0 does not seem to be created.

The content of /proc/analogy/drivers is:

-- Analogy drivers --

| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

/proc/analogy/devices is:

-- Analogy devices --

| idx | status | driver
|  00 | Linked | analogy_ni_pcimio
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

/proc/analogy/00-analogy_ni_pcimio

-- Subdevices --

| idx | type
|  00 | Unused subdevice
|  01 | Analog output subdevice
|  02 | Digital input/output subdevice
|  03 | Unused subdevice
|  04 | Unused subdevice
|  05 | Calibration subdevice
|  06 | Memory subdevice
|  07 | Digital input/output subdevice
|  08 | Unused subdevice
|  09 | Serial subdevice
|  10 | Unused subdevice
|  11 | Counter subdevice
|  12 | Counter subdevice
|  13 | Counter subdevice

When I try cmd_write I get this

cmd_write: triggering failed (ret=-16)

I was expecting complaints about /dev/analogy0 not existing. I'm confused.

Progress though!

Ettore

Linux version 2.6.32.2 (root@fangorn) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #1 SMP PREEMPT Thu Jan 7 09:49:39 PST 2010 KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009a800 (usable)
BIOS-e820: 000000000009a800 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000bff70000 (usable)
BIOS-e820: 00000000bff70000 - 00000000bff77000 (ACPI data)
BIOS-e820: 00000000bff77000 - 00000000bff80000 (ACPI NVS)
BIOS-e820: 00000000bff80000 - 00000000c0000000 (reserved)
BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ff800000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fffffc00 - 0000000100000000 (reserved)
user-defined physical RAM map:
user: 0000000000000000 - 000000000009a800 (usable)
user: 000000000009a800 - 00000000000a0000 (reserved)
user: 00000000000e4000 - 0000000000100000 (reserved)
user: 0000000000100000 - 0000000040000000 (usable)
user: 00000000bff70000 - 00000000bff77000 (ACPI data)
user: 00000000bff77000 - 00000000bff80000 (ACPI NVS)
user: 00000000bff80000 - 00000000c0000000 (reserved)
user: 00000000e0000000 - 00000000f0000000 (reserved)
user: 00000000fec00000 - 00000000fec10000 (reserved)
user: 00000000fee00000 - 00000000fee01000 (reserved)
user: 00000000ff800000 - 00000000ffc00000 (reserved)
user: 00000000fffffc00 - 0000000100000000 (reserved)
DMI present.
Phoenix BIOS detected: BIOS may corrupt low RAM, working around it.
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
last_pfn = 0x40000 max_arch_pfn = 0x100000
MTRR default type: uncachable
MTRR fixed ranges enabled:
00000-9FFFF write-back
A0000-BFFFF uncachable
C0000-C7FFF write-protect
C8000-DFFFF uncachable
E0000-FFFFF write-protect
MTRR variable ranges enabled:
0 base 000000000 mask F80000000 write-back
1 base 080000000 mask FC0000000 write-back
2 base 0BFF80000 mask FFFF80000 uncachable
3 disabled
4 disabled
5 disabled
6 disabled
7 disabled
Warning only 895MB will be used.
Use a HIGHMEM enabled kernel.
initial memory mapped : 0 - 01800000
init_memory_mapping: 0000000000000000-0000000037f1e000
0000000000 - 0000400000 page 4k
0000400000 - 0037c00000 page 2M
0037c00000 - 0037f1e000 page 4k
kernel direct mapping tables up to 37f1e000 @ 10000-15000
RAMDISK: 37e17000 - 37fef043
Allocated new RAMDISK: 00100000 - 002d8043
Move RAMDISK from 0000000037e17000 - 0000000037fef042 to 00100000 - 002d8042
895MB LOWMEM available.
mapped low ram: 0 - 37f1e000
low ram: 0 - 37f1e000
node 0 low ram: 00000000 - 37f1e000
node 0 bootmap 00011000 - 00017fe4
(9 early reservations) ==> bootmem [0000000000 - 0037f1e000]
#0 [0000000000 - 0000001000] BIOS data page ==> [0000000000 - 0000001000]
#1 [0000001000 - 0000002000] EX TRAMPOLINE ==> [0000001000 - 0000002000]
#2 [0000006000 - 0000007000] TRAMPOLINE ==> [0000006000 - 0000007000]
#3 [0001000000 - 0001327338] TEXT DATA BSS ==> [0001000000 - 0001327338]
#4 [000009a800 - 0000100000] BIOS reserved ==> [000009a800 - 0000100000]
#5 [0001328000 - 000132e170] BRK ==> [0001328000 - 000132e170]
#6 [0000010000 - 0000011000] PGTABLE ==> [0000010000 - 0000011000]
#7 [0000100000 - 00002d8043] NEW RAMDISK ==> [0000100000 - 00002d8043]
#8 [0000011000 - 0000018000] BOOTMAP ==> [0000011000 - 0000018000]
found SMP MP-table at [c00f5d90] f5d90
Zone PFN ranges:
DMA 0x00000010 -> 0x00001000
Normal 0x00001000 -> 0x00037f1e
Movable zone start PFN for each node
early_node_map[2] active PFN ranges

    0: 0x00000010 -> 0x0000009a
    0: 0x00000100 -> 0x00037f1e

On node 0 totalpages: 229032
free_area_init_node: node 0, pgdat c1269900, node_mem_map c132f200
DMA zone: 32 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 3946 pages, LIFO batch:0
Normal zone: 1759 pages used for memmap
Normal zone: 223295 pages, LIFO batch:31
Using APIC driver default
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
MPTABLE: OEM ID: INTEL
MPTABLE: Product ID: Lindenhurst
MPTABLE: APIC at: 0xFEE00000
Processor #0 (Bootup-CPU)
Processor #6
I/O APIC #2 Version 32 at 0xFEC00000.
I/O APIC #3 Version 32 at 0xFEC81000.
I/O APIC #4 Version 32 at 0xFEC81400.
Enabling APIC mode: Flat. Using 3 I/O APICs
Processors: 2
SMP: Allowing 2 CPUs, 0 hotplug CPUs
nr_irqs_gsi: 72
Allocating PCI resources starting at 40000000 (gap: 40000000:7ff70000)
NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:2 nr_node_ids:1
PERCPU: Embedded 13 pages/cpu @c1c00000 s30744 r0 d22504 u2097152
pcpu-alloc: s30744 r0 d22504 u2097152 alloc=1*4194304
pcpu-alloc: [0] 0 1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 227241
Kernel command line: root=LABEL=ROOTFS_TEST ro noht mem=2048M memmap=1024M pci=routeirq PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
Memory: 902592k/916600k available (1830k kernel code, 13240k reserved, 650k data, 308k init, 0k highmem) virtual kernel memory layout:

    fixmap  : 0xfff20000 - 0xfffff000   ( 892 kB)
    vmalloc : 0xf871e000 - 0xfff1e000   ( 120 MB)
    lowmem  : 0xc0000000 - 0xf7f1e000   ( 895 MB)
      .init : 0xc126d000 - 0xc12ba000   ( 308 kB)
      .data : 0xc11c9a6b - 0xc126c618   ( 650 kB)
      .text : 0xc1000000 - 0xc11c9a6b   (1830 kB)

Checking if this processor honours the WP bit even in supervisor mode...Ok.
Hierarchical RCU implementation.
NR_IRQS:512
I-pipe 2.5-00: pipeline enabled.
Console: colour VGA+ 80x25
console [tty0] enabled
Fast TSC calibration using PIT
Detected 2999.720 MHz processor.
Calibrating delay loop (skipped), value calculated using timer frequency.. 5999.44 BogoMIPS (lpj=2999720) Mount-cache hash table entries: 512
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
mce: CPU supports 4 MCE banks
CPU0: Thermal monitoring enabled (TM1)
Checking 'hlt' instruction... OK.
Freeing SMP alternatives: 10k freed
ExtINT not setup in hardware but reported by MP table
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
..MP-BIOS bug: 8254 timer not connected to IO-APIC
...trying to set up timer (IRQ0) through the 8259A ...
..... (found apic 0 pin 0) ...
....... works.
CPU0: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
Booting processor 1 APIC 0x6 ip 0x6000
Initializing CPU#1
Calibrating delay using timer specific routine.. 5999.16 BogoMIPS (lpj=2999582)
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 3
CPU: Processor Core ID: 0
CPU1: Thermal monitoring enabled (TM1)
CPU1: Intel(R) Xeon(TM) CPU 3.00GHz stepping 03
checking TSC synchronization [CPU#0 -> CPU#1]: passed.
Brought up 2 CPUs
Total of 2 processors activated (11998.60 BogoMIPS).
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xfd870, last bus=6
PCI: Using configuration type 1 for base access
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
PCI: Probing PCI hardware
PCI: Probing PCI hardware (bus 00)
pci 0000:00:02.0: PME# supported from D0 D3hot D3cold
pci 0000:00:02.0: PME# disabled
pci 0000:00:03.0: PME# supported from D0 D3hot D3cold
pci 0000:00:03.0: PME# disabled
pci 0000:00:04.0: PME# supported from D0 D3hot D3cold
pci 0000:00:04.0: PME# disabled
pci 0000:00:1d.0: reg 20 io port: [0x1840-0x185f]
pci 0000:00:1d.1: reg 20 io port: [0x1860-0x187f]
pci 0000:00:1d.2: reg 20 io port: [0x1880-0x189f]
pci 0000:00:1d.3: reg 20 io port: [0x18a0-0x18bf]
pci 0000:00:1d.7: reg 10 32bit mmio: [0xd0000000-0xd00003ff]
pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
pci 0000:00:1d.7: PME# disabled
pci 0000:00:1f.0: quirk: region 1000-107f claimed by ICH4 ACPI/GPIO/TCO
pci 0000:00:1f.0: quirk: region 1180-11bf claimed by ICH4 GPIO
pci 0000:00:1f.2: reg 10 io port: [0x00-0x07]
pci 0000:00:1f.2: reg 14 io port: [0x00-0x03]
pci 0000:00:1f.2: reg 18 io port: [0x00-0x07]
pci 0000:00:1f.2: reg 1c io port: [0x00-0x03]
pci 0000:00:1f.2: reg 20 io port: [0x18f0-0x18ff]
pci 0000:00:1f.3: reg 20 io port: [0x1100-0x111f]
pci 0000:00:1f.5: reg 10 io port: [0x1400-0x14ff]
pci 0000:00:1f.5: reg 14 io port: [0x1800-0x183f]
pci 0000:00:1f.5: reg 18 32bit mmio: [0xd0000c00-0xd0000dff]
pci 0000:00:1f.5: reg 1c 32bit mmio: [0xd0000800-0xd00008ff]
pci 0000:00:1f.5: PME# supported from D0 D3hot D3cold
pci 0000:00:1f.5: PME# disabled
pci 0000:02:00.0: PXH quirk detected; SHPC device MSI disabled
pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
pci 0000:02:00.0: PME# disabled
pci 0000:02:00.1: reg 10 32bit mmio: [0xd0100000-0xd0100fff]
pci 0000:02:00.2: PXH quirk detected; SHPC device MSI disabled
pci 0000:02:00.2: PME# supported from D0 D3hot D3cold
pci 0000:02:00.2: PME# disabled
pci 0000:02:00.3: reg 10 32bit mmio: [0xd0101000-0xd0101fff]
pci 0000:00:03.0: bridge io port: [0x2000-0x3fff]
pci 0000:00:03.0: bridge 32bit mmio: [0xd0100000-0xd08fffff]
pci 0000:03:03.0: reg 10 64bit mmio: [0xd0200000-0xd02fffff]
pci 0000:03:03.0: reg 18 io port: [0x2000-0x20ff]
pci 0000:02:00.0: bridge io port: [0x2000-0x2fff]
pci 0000:02:00.0: bridge 32bit mmio: [0xd0200000-0xd07fffff]
pci 0000:04:01.0: reg 10 32bit mmio: [0xd0801000-0xd0801fff]
pci 0000:04:01.0: reg 14 32bit mmio: [0xd0800000-0xd0800fff]
pci 0000:04:02.0: reg 10 64bit mmio: [0xd0820000-0xd083ffff]
pci 0000:04:02.0: reg 20 io port: [0x3000-0x303f]
pci 0000:04:02.0: PME# supported from D0 D3hot D3cold
pci 0000:04:02.0: PME# disabled
pci 0000:04:02.1: reg 10 64bit mmio: [0xd0840000-0xd085ffff]
pci 0000:04:02.1: reg 20 io port: [0x3040-0x307f]
pci 0000:04:02.1: PME# supported from D0 D3hot D3cold
pci 0000:04:02.1: PME# disabled
pci 0000:02:00.2: bridge io port: [0x3000-0x3fff]
pci 0000:02:00.2: bridge 32bit mmio: [0xd0800000-0xd08fffff]
pci 0000:05:00.0: reg 10 32bit mmio pref: [0xd8000000-0xdfffffff]
pci 0000:05:00.0: reg 14 io port: [0x4000-0x40ff]
pci 0000:05:00.0: reg 18 32bit mmio: [0xd0900000-0xd090ffff]
pci 0000:05:00.0: reg 30 32bit mmio pref: [0x000000-0x01ffff]
pci 0000:05:00.0: supports D1 D2
pci 0000:05:00.1: reg 10 32bit mmio: [0xd0910000-0xd091ffff]
pci 0000:05:00.1: supports D1 D2
pci 0000:00:04.0: bridge io port: [0x4000-0x4fff]
pci 0000:00:04.0: bridge 32bit mmio: [0xd0900000-0xd09fffff]
pci 0000:00:04.0: bridge 64bit mmio pref: [0xd8000000-0xdfffffff]
pci 0000:06:02.0: reg 10 32bit mmio: [0xd0a00000-0xd0a0ffff]
pci 0000:00:1e.0: transparent bridge
pci 0000:00:1e.0: bridge 32bit mmio: [0xd0a00000-0xd0afffff]
vgaarb: device added: PCI:0000:05:00.0,decodes=io+mem,owns=io+mem,locks=none
pci 0000:00:1f.0: PIIX/ICH IRQ router [8086:24d0]
PCI: Routing PCI interrupts for all devices because "pci=routeirq" specified
pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.1: PCI->APIC IRQ transform: INT B -> IRQ 19
pci 0000:00:1d.2: PCI->APIC IRQ transform: INT C -> IRQ 18
pci 0000:00:1d.3: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:00:1d.7: PCI->APIC IRQ transform: INT D -> IRQ 23
pci 0000:00:1f.2: PCI->APIC IRQ transform: INT A -> IRQ 18
pci 0000:00:1f.3: PCI->APIC IRQ transform: INT B -> IRQ 17
pci 0000:00:1f.5: PCI->APIC IRQ transform: INT B -> IRQ 17
pci 0000:03:03.0: PCI->APIC IRQ transform: INT A -> IRQ 28
pci 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
pci 0000:04:02.0: PCI->APIC IRQ transform: INT A -> IRQ 54
pci 0000:04:02.1: PCI->APIC IRQ transform: INT B -> IRQ 55
pci 0000:05:00.0: PCI->APIC IRQ transform: INT A -> IRQ 16
pci 0000:06:02.0: PCI->APIC IRQ transform: INT A -> IRQ 20
Switching to clocksource tsc
pci 0000:00:02.0: PCI bridge, secondary bus 0000:01

pci 0000:00:02.0:   IO window: disabled
pci 0000:00:02.0:   MEM window: disabled
pci 0000:00:02.0:   PREFETCH window: disabled
pci 0000:02:00.0: PCI bridge, secondary bus 0000:03
pci 0000:02:00.0:   IO window: 0x2000-0x2fff
pci 0000:02:00.0:   MEM window: 0xd0200000-0xd07fffff
pci 0000:02:00.0:   PREFETCH window: disabled
pci 0000:02:00.2: PCI bridge, secondary bus 0000:04
pci 0000:02:00.2:   IO window: 0x3000-0x3fff
pci 0000:02:00.2:   MEM window: 0xd0800000-0xd08fffff
pci 0000:02:00.2:   PREFETCH window: disabled
pci 0000:00:03.0: PCI bridge, secondary bus 0000:02
pci 0000:00:03.0:   IO window: 0x2000-0x3fff
pci 0000:00:03.0:   MEM window: 0xd0100000-0xd08fffff
pci 0000:00:03.0:   PREFETCH window: disabled
pci 0000:00:04.0: PCI bridge, secondary bus 0000:05
pci 0000:00:04.0:   IO window: 0x4000-0x4fff
pci 0000:00:04.0:   MEM window: 0xd0900000-0xd09fffff
pci 0000:00:04.0:   PREFETCH window: 0x000000d8000000-0x000000dfffffff
pci 0000:00:1e.0: PCI bridge, secondary bus 0000:06
pci 0000:00:1e.0:   IO window: disabled
pci 0000:00:1e.0:   MEM window: 0xd0a00000-0xd0afffff
pci 0000:00:1e.0:   PREFETCH window: disabled

pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:02.0: setting latency timer to 64
pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:03.0: setting latency timer to 64
pci 0000:02:00.0: setting latency timer to 64
pci 0000:02:00.2: setting latency timer to 64
pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 16 pci 0000:00:04.0: setting latency timer to 64
pci 0000:00:1e.0: setting latency timer to 64
pci_bus 0000:00: resource 0 io: [0x00-0xffff]
pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffff] pci_bus 0000:02: resource 0 io: [0x2000-0x3fff]
pci_bus 0000:02: resource 1 mem: [0xd0100000-0xd08fffff] pci_bus 0000:03: resource 0 io: [0x2000-0x2fff]
pci_bus 0000:03: resource 1 mem: [0xd0200000-0xd07fffff] pci_bus 0000:04: resource 0 io: [0x3000-0x3fff]
pci_bus 0000:04: resource 1 mem: [0xd0800000-0xd08fffff] pci_bus 0000:05: resource 0 io: [0x4000-0x4fff]
pci_bus 0000:05: resource 1 mem: [0xd0900000-0xd09fffff] pci_bus 0000:05: resource 2 pref mem [0xd8000000-0xdfffffff] pci_bus 0000:06: resource 1 mem: [0xd0a00000-0xd0afffff] pci_bus 0000:06: resource 3 io: [0x00-0xffff]
pci_bus 0000:06: resource 4 mem: [0x000000-0xffffffff]
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes) TCP established hash table entries: 131072 (order: 8, 1048576 bytes) TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 131072 bind 65536) TCP reno registered
pci 0000:05:00.0: Boot video device
Unpacking initramfs...
Freeing initrd memory: 1888k freed
platform rtc_cmos: registered platform RTC device (no PNP device found)
audit: initializing netlink socket (disabled)
type=2000 audit(1262889524.287:1): initialized
I-pipe: Domain Xenomai registered.
Xenomai: hal/i386 started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5.0 (Flying In A Blue Dream) loaded. msgmni has been set to 1767
io scheduler noop registered
io scheduler deadline registered (default)
pcieport 0000:00:02.0: setting latency timer to 64
pcieport 0000:00:03.0: setting latency timer to 64
pcieport 0000:00:04.0: setting latency timer to 64
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
Using IPI Shortcut mode
Freeing unused kernel memory: 308k freed
input: AT Translated Set 2 keyboard as /class/input/input0
NET: Registered protocol family 1
Intel(R) PRO/1000 Network Driver - version 7.3.21-k5-NAPI Copyright (c) 1999-2006 Intel Corporation.
e1000 0000:04:02.0: PCI->APIC IRQ transform: INT A -> IRQ 54 libata version 3.00 loaded.
sata_mv 0000:03:03.0: version 1.28
ata_piix 0000:00:1f.2: version 2.13
ata_piix 0000:00:1f.2: PCI->APIC IRQ transform: INT A -> IRQ 18 ata_piix 0000:00:1f.2: MAP [ IDE IDE P0 P1 ]
ata_piix 0000:00:1f.2: setting latency timer to 64
sata_mv 0000:03:03.0: PCI->APIC IRQ transform: INT A -> IRQ 28 sata_mv 0000:03:03.0: Gen-II 32 slots 8 ports SCSI mode IRQ via INTx scsi0 : ata_piix
scsi2 : ata_piix
ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x18f0 irq 14
ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x18f8 irq 15 scsi1 : sata_mv
scsi3 : sata_mv
scsi4 : sata_mv
scsi5 : sata_mv
scsi6 : sata_mv
scsi7 : sata_mv
scsi8 : sata_mv
scsi9 : sata_mv
ata3: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0222000 irq 28
ata4: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0224000 irq 28
ata5: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0226000 irq 28
ata6: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0228000 irq 28
ata7: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0232000 irq 28
ata8: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0234000 irq 28
ata9: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0236000 irq 28
ata10: SATA max UDMA/133 mmio m1048576@0xd0200000 port 0xd0238000 irq 28 ata2.00: ATA-7: HDT722525DLA380, V44OA96A, max UDMA/133 ata2.00: 488397168 sectors, multi 16: LBA48 NCQ (depth 0/32)
ata1.00: ATAPI: SONY DVD RW DW-Q30A, YYS2, max UDMA/66
ata1.00: limited to UDMA/33 due to 40-wire cable
ata2.01: ATA-8: ST31000333AS, CC1H, max UDMA/133
ata2.01: 1953525168 sectors, multi 16: LBA48 NCQ (depth 0/32) ata2.00: configured for UDMA/133
ata1.00: configured for UDMA/33
scsi 0:0:0:0: CD-ROM SONY DVD RW DW-Q30A YYS2 PQ: 0 ANSI: 5
ata2.01: configured for UDMA/133

scsi 2:0:0:0: Direct-Access     ATA      HDT722525DLA380  V44O PQ: 0 ANSI: 5
scsi 2:0:1:0: Direct-Access     ATA      ST31000333AS     CC1H PQ: 0 ANSI: 5

sd 2:0:1:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) sd 2:0:1:0: [sdb] Write Protect is off
sd 2:0:1:0: [sdb] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
sd 2:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sd 2:0:0:0: [sda] Write Protect is off
sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdb:
input: ImPS/2 Logitech Wheel Mouse as /class/input/input1
e1000: 0000:04:02.0: e1000_probe: (PCI:33MHz:64-bit) 00:30:48:2e:94:b6
sdb1 sdb2 sdb3 sdb4
sda:
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000 0000:04:02.1: PCI->APIC IRQ transform: INT B -> IRQ 55
sda1 sda2 < sda5 >
sd 2:0:1:0: [sdb] Attached SCSI disk
sd 2:0:0:0: [sda] Attached SCSI disk
ata3: SATA link down (SStatus 0 SControl 300)
e1000: 0000:04:02.1: e1000_probe: (PCI:33MHz:64-bit) 00:30:48:2e:94:b7
e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection
ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata4.00: ATA-8: WDC WD1001FALS-00J7B1, 05.00K05, max UDMA/133
ata4.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata4.00: configured for UDMA/133
scsi 3:0:0:0: Direct-Access ATA WDC WD1001FALS-0 05.0 PQ: 0 ANSI: 5
sd 3:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 00 3a 00 00
sd 3:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdc: sdc1 sdc2 sdc3
sd 3:0:0:0: [sdc] Attached SCSI disk
ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata5.00: ATA-8: ST32000542AS, CC34, max UDMA/133
ata5.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata5.00: configured for UDMA/133
scsi 4:0:0:0: Direct-Access ATA ST32000542AS CC34 PQ: 0 ANSI: 5
sd 4:0:0:0: [sdd] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB) sd 4:0:0:0: [sdd] Write Protect is off
sd 4:0:0:0: [sdd] Mode Sense: 00 3a 00 00
sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdd: sdd1
sd 4:0:0:0: [sdd] Attached SCSI disk
ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata6.00: ATA-7: ST3120813AS, 2AAA, max UDMA/133
ata6.00: 234441648 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata6.00: configured for UDMA/133
scsi 5:0:0:0: Direct-Access ATA ST3120813AS 2AAA PQ: 0 ANSI: 5
sd 5:0:0:0: [sde] 234441648 512-byte logical blocks: (120 GB/111 GiB)
sd 5:0:0:0: [sde] Write Protect is off
sd 5:0:0:0: [sde] Mode Sense: 00 3a 00 00
sd 5:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sde: sde1 sde2 sde3
sd 5:0:0:0: [sde] Attached SCSI disk
ata7: SATA link down (SStatus 0 SControl 300)
ata8: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata8.00: ATA-7: ST3120813AS, 2AAA, max UDMA/133
ata8.00: 234441648 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata8.00: configured for UDMA/133
scsi 7:0:0:0: Direct-Access ATA ST3120813AS 2AAA PQ: 0 ANSI: 5
sd 7:0:0:0: [sdf] 234441648 512-byte logical blocks: (120 GB/111 GiB)
sd 7:0:0:0: [sdf] Write Protect is off
sd 7:0:0:0: [sdf] Mode Sense: 00 3a 00 00
sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sdf: sdf1 sdf2 sdf3
sd 7:0:0:0: [sdf] Attached SCSI disk
ata9: SATA link down (SStatus 0 SControl 300)
ata10: SATA link down (SStatus 0 SControl 300)
Uniform Multi-Platform E-IDE driver
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with writeback data mode.
udevd version 125 started
Xenomai: SMI-enabled chipset found
Xenomai: SMI workaround enabled
Xenomai: starting RTDM services.
Analogy: MITE: Available NI device IDs: 0x1880(used)
Analogy: a4l_add_drv: name=analogy_8255
Analogy: a4l_lct_drv: name=analogy_8255
Analogy: a4l_add_drv: name=analogy_ni_pcimio
Analogy: a4l_lct_drv: name=analogy_ni_pcimio
Adding 2650684k swap on /dev/sda5. Priority:-1 extents:1 across:2650684k EXT3 FS on sda1, internal journal
Xenomai: starting native API services.
e1000: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
warning: `ntpd' uses 32-bit capabilities (legacy support in use)
Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_devcfg: minor=0
Analogy: a4l_presetup_transfer: minor=0
Analogy: a4l_device_attach: minor=0
Analogy: a4l_fill_lnkdesc: minor=0
Analogy: a4l_lct_drv: name=analogy_ni_pcimio
Analogy: a4l_assign_driver: minor=0
Analogy: analogy_ni_pcimio: pcimio_attach: found pci-6711 board
mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
Analogy: MITE: 0xd0801000 mapped to f8e26000
Analogy: DAQ: 0xd0800000 mapped to f8e2a000
Analogy: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
Analogy: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
Analogy: analogy_ni_pcimio: pcimio_attach: found irq 48
Analogy: analogy_ni_pcimio: mio_common: starting attach procedure...
Analogy: analogy_ni_pcimio: mio_common: registering AI subdevice...
Analogy: analogy_ni_pcimio: mio_common: AI subdevice not present
Analogy: analogy_ni_pcimio: mio_common: AI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering AO subdevice...
Analogy: analogy_ni_pcimio: mio_common: AO: 4 channels
Analogy: analogy_ni_pcimio: mio_common: AO subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering DIO subdevice...
Analogy: analogy_ni_pcimio: mio_common: DIO: 8 channels
Analogy: analogy_ni_pcimio: mio_common: DIO subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering 8255 subdevice...
Analogy: analogy_ni_pcimio: mio_common: 8255 subdevice not present
Analogy: analogy_ni_pcimio: mio_common: 8255 subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering calib subdevice...
Analogy: analogy_ni_pcimio: mio_common: calib: common calibration
Analogy: analogy_ni_pcimio: mio_common: calib subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering EEPROM subdevice...
Analogy: analogy_ni_pcimio: mio_common: EEPROM: size = 512
Analogy: analogy_ni_pcimio: mio_common: EEPROM subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering PFI(DIO) subdevice...
Analogy: analogy_ni_pcimio: mio_common: PFI: 10 bits...
Analogy: analogy_ni_pcimio: mio_common: PFI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering serial subdevice...
Analogy: analogy_ni_pcimio: mio_common: serial subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering GPCT[0] subdevice...
Analogy: analogy_ni_pcimio: mio_common: GPCT[0]: 24 bits
Analogy: analogy_ni_pcimio: mio_common: GPCT[0]: command feature available
Analogy: analogy_ni_pcimio: mio_common: GCPT[0] subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering GPCT[1] subdevice...
Analogy: analogy_ni_pcimio: mio_common: GPCT[1]: 24 bits
Analogy: analogy_ni_pcimio: mio_common: GPCT[1]: command feature available
Analogy: analogy_ni_pcimio: mio_common: GCPT[1] subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering counter subdevice...
Analogy: analogy_ni_pcimio: mio_common: counter subdevice registered
Analogy: analogy_ni_pcimio: mio_common: initializing AI...
Analogy: analogy_ni_pcimio: mio_common: AI initialization OK
Analogy: analogy_ni_pcimio: mio_common: initializing A0...
Analogy: analogy_ni_pcimio: mio_common: A0 initialization OK
Analogy: analogy_ni_pcimio: mio_common: DMA setup
Analogy: analogy_ni_pcimio: mio_common: attach procedure complete
Analogy: a4l_free_lnkdesc: minor=0
Analogy: a4l_setup_transfer: minor=0
Analogy: a4l_rt_close: minor=0

#30 lore raw

Hi,

Quoted 15 lines · Ettore Pedretti

Hi,

I did not quite understand how to checkout the analogy branch. When I do git branch -a either in xenomai-head or in xenomai-2.5 I get only:

* master
origin/HEAD
origin/master

no other branch is available for checkout. I'm obviously missing something.

I tried to apply the patch but it failed. At the end I edited mio_common.c directly. I hope I did not introduce any error. Everything compiled and installed fine.

Quoted 8 lines

The attach command did not complain this time:

analogy_config analogy0 analogy_ni_pcimio

The error trace is attached (dmesg_07Jan2010.txt). I also attached the kernel config as you asked: (config_analogy).

However the device /dev/analogy0 does not seem to be created.

That's the common behaviour. The dev files you find in the /dev directory belong to the Linux drivers. The RTDM dev nodes can be listed in the following proc file:

# cat /proc/xenomai/rtdm/named_devices
Hash Name Driver /proc
1B analogy0 rtdm_analogy analogy0
1C analogy1 rtdm_analogy analogy1
1D analogy2 rtdm_analogy analogy2
1E analogy3 rtdm_analogy analogy3
1F analogy4 rtdm_analogy analogy4
20 analogy5 rtdm_analogy analogy5
21 analogy6 rtdm_analogy analogy6
22 analogy7 rtdm_analogy analogy7
23 analogy8 rtdm_analogy analogy8
24 analogy9 rtdm_analogy analogy9

Roughly, a user application which communicates with RTDM drivers does not use the same channels as a user application which communicates with Linux drivers. Unlike Linux' ones, the RTDM devices are not reachable through specific files.

So, instead of calling open("/dev/analogy0",...), we call rtdm_open("analogy0", ...).

Quoted 13 lines

The content of /proc/analogy/drivers is:

-- Analogy drivers --

| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

/proc/analogy/devices is:

-- Analogy devices --

Quoted 11 lines
| idx | status | driver
|  00 | Linked | analogy_ni_pcimio
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

Ok. The attach procedure went well.

Quoted 21 lines

/proc/analogy/00-analogy_ni_pcimio

-- Subdevices --

| idx | type
|  00 | Unused subdevice
|  01 | Analog output subdevice
|  02 | Digital input/output subdevice
|  03 | Unused subdevice
|  04 | Unused subdevice
|  05 | Calibration subdevice
|  06 | Memory subdevice
|  07 | Digital input/output subdevice
|  08 | Unused subdevice
|  09 | Serial subdevice
|  10 | Unused subdevice
|  11 | Counter subdevice
|  12 | Counter subdevice
|  13 | Counter subdevice
Quoted 3 lines

When I try cmd_write I get this

cmd_write: triggering failed (ret=-16)

-16 means -EBUSY. Did you get this error at the first launch?

Before checking asynchronous writes (with cmd_write), could you test the synchronous writes (with insn_write)?

Quoted 7 lines

I was expecting complaints about /dev/analogy0 not existing. I'm confused.

Progress though!

Ettore

Alexis.

#31 lore raw

Hi,

I started from scratch by rebooting the system.

analogy_config analogy0 analogy_ni_pcimio

insn_write (no output)

Relevant error trace:
Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_devcfg: minor=0
Analogy: a4l_presetup_transfer: minor=0
Analogy: a4l_device_attach: minor=0
Analogy: a4l_fill_lnkdesc: minor=0
Analogy: a4l_lct_drv: name=analogy_ni_pcimio
Analogy: a4l_assign_driver: minor=0
Analogy: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48
mite 0000:04:01.0: setting latency timer to 64
Analogy: MITE: 0xd0801000 mapped to f8e26000
Analogy: DAQ: 0xd0800000 mapped to f8e2a000
Analogy: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
Analogy: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
Analogy: analogy_ni_pcimio: pcimio_attach: found irq 48
Analogy: analogy_ni_pcimio: mio_common: starting attach procedure...
Analogy: analogy_ni_pcimio: mio_common: registering AI subdevice...
Analogy: analogy_ni_pcimio: mio_common: AI subdevice not present
Analogy: analogy_ni_pcimio: mio_common: AI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering AO subdevice...
Analogy: analogy_ni_pcimio: mio_common: AO: 4 channels
Analogy: analogy_ni_pcimio: mio_common: AO subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering DIO subdevice...
Analogy: analogy_ni_pcimio: mio_common: DIO: 8 channels
Analogy: analogy_ni_pcimio: mio_common: DIO subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering 8255 subdevice...
Analogy: analogy_ni_pcimio: mio_common: 8255 subdevice not present
Analogy: analogy_ni_pcimio: mio_common: 8255 subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering calib subdevice...
Analogy: analogy_ni_pcimio: mio_common: calib: common calibration
Analogy: analogy_ni_pcimio: mio_common: calib subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering EEPROM subdevice...
Analogy: analogy_ni_pcimio: mio_common: EEPROM: size = 512
Analogy: analogy_ni_pcimio: mio_common: EEPROM subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering PFI(DIO) subdevice...
Analogy: analogy_ni_pcimio: mio_common: PFI: 10 bits...
Analogy: analogy_ni_pcimio: mio_common: PFI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering serial subdevice...
Analogy: analogy_ni_pcimio: mio_common: serial subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering GPCT[0] subdevice...
Analogy: analogy_ni_pcimio: mio_common: GPCT[0]: 24 bits
Analogy: analogy_ni_pcimio: mio_common: GPCT[0]: command feature available
Analogy: analogy_ni_pcimio: mio_common: GCPT[0] subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering GPCT[1] subdevice...
Analogy: analogy_ni_pcimio: mio_common: GPCT[1]: 24 bits
Analogy: analogy_ni_pcimio: mio_common: GPCT[1]: command feature available
Analogy: analogy_ni_pcimio: mio_common: GCPT[1] subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering counter subdevice...
Analogy: analogy_ni_pcimio: mio_common: counter subdevice registered
Analogy: analogy_ni_pcimio: mio_common: initializing AI...
Analogy: analogy_ni_pcimio: mio_common: AI initialization OK
Analogy: analogy_ni_pcimio: mio_common: initializing A0...
Analogy: analogy_ni_pcimio: mio_common: A0 initialization OK
Analogy: analogy_ni_pcimio: mio_common: DMA setup
Analogy: analogy_ni_pcimio: mio_common: attach procedure complete
Analogy: a4l_free_lnkdesc: minor=0
Analogy: a4l_setup_transfer: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_devinfo: minor=0
Analogy: a4l_rt_ioctl: minor=0
---------------> snip <-----------------
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_reserve_transfer: minor=0 idx=1
Analogy: a4l_rt_close: minor=0

Then typed:
cmd_write
cmd_write: triggering failed (ret=-16)

error trace:

Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
---------------> snip <-----------------
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_cancel: subdevice currently idle
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_cmd: minor=0
Analogy: a4l_fill_cmddesc: desc dump
Analogy: ->idx_subd=1
Analogy: ->flags=0
Analogy: ->nb_chan=2
Analogy: ->chan_descs=0x0
Analogy: ->data_len=0
Analogy: ->pdata=0x(null)
Analogy: a4l_check_cmddesc: minor=0
Analogy: a4l_ioctl_cmd: 1st cmd checks passed
Analogy: a4l_ioctl_cmd: driver's cmd checks passed
Analogy: a4l_reserve_transfer: minor=0 idx=1
Analogy: a4l_init_transfer: minor=0 idx=1
Analogy: a4l_rt_write: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: analogy_ni_pcimio: ni_request_ao_mite_channel: failed to reserve mite dma channel for analog outut.
Analogy: a4l_rt_close: minor=0

Hope this helps
Ettore

#32 lore raw

Hello,

I just installed Xenomai 2.5.1, however, I am having the exact same problem
- the computer completely crashes when running analogy_config analogy0 analogy_ni_pcimio. However, I could not get any significant debug info before the system crashes.

This is the exact behavior I had with Xenomai 2.5.0.

I am running Ubuntu 9.04 on a with a AMD Sempron 2800+ with a National Instruments 6221-37 DAQ card. Xenomai seems to be running pretty well.

So, is this a known issue? Can I help with the debug messages/logs in any way?

Thanks for the help,
-Felipe Brandão Cavalcanti

(Sorry to reply to such an old thread.. but my problem seemed a lot like this one.)

Quoted 119 lines · Ettore Pedretti

Hi,

I started from scratch by rebooting the system.

analogy_config analogy0 analogy_ni_pcimio

insn_write (no output)

Relevant error trace:
Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_devcfg: minor=0
Analogy: a4l_presetup_transfer: minor=0
Analogy: a4l_device_attach: minor=0
Analogy: a4l_fill_lnkdesc: minor=0
Analogy: a4l_lct_drv: name=analogy_ni_pcimio
Analogy: a4l_assign_driver: minor=0
Analogy: analogy_ni_pcimio: pcimio_attach: found pci-6711 board mite 0000:04:01.0: PCI->APIC IRQ transform: INT A -> IRQ 48 mite 0000:04:01.0: setting latency timer to 64
Analogy: MITE: 0xd0801000 mapped to f8e26000
Analogy: DAQ: 0xd0800000 mapped to f8e2a000
Analogy: MITE: version = 1, type = 1, mite mode = 1, interface mode = 3
Analogy: MITE: num channels = 3, write post fifo depth = 1, wins = 0, iowins = 2
Analogy: analogy_ni_pcimio: pcimio_attach: found irq 48
Analogy: analogy_ni_pcimio: mio_common: starting attach procedure...
Analogy: analogy_ni_pcimio: mio_common: registering AI subdevice...
Analogy: analogy_ni_pcimio: mio_common: AI subdevice not present
Analogy: analogy_ni_pcimio: mio_common: AI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering AO subdevice...
Analogy: analogy_ni_pcimio: mio_common: AO: 4 channels
Analogy: analogy_ni_pcimio: mio_common: AO subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering DIO subdevice...
Analogy: analogy_ni_pcimio: mio_common: DIO: 8 channels
Analogy: analogy_ni_pcimio: mio_common: DIO subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering 8255 subdevice...
Analogy: analogy_ni_pcimio: mio_common: 8255 subdevice not present
Analogy: analogy_ni_pcimio: mio_common: 8255 subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering calib subdevice...
Analogy: analogy_ni_pcimio: mio_common: calib: common calibration
Analogy: analogy_ni_pcimio: mio_common: calib subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering EEPROM subdevice...
Analogy: analogy_ni_pcimio: mio_common: EEPROM: size = 512
Analogy: analogy_ni_pcimio: mio_common: EEPROM subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering PFI(DIO) subdevice...
Analogy: analogy_ni_pcimio: mio_common: PFI: 10 bits...
Analogy: analogy_ni_pcimio: mio_common: PFI subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering serial subdevice...
Analogy: analogy_ni_pcimio: mio_common: serial subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering GPCT[0] subdevice...
Analogy: analogy_ni_pcimio: mio_common: GPCT[0]: 24 bits
Analogy: analogy_ni_pcimio: mio_common: GPCT[0]: command feature available
Analogy: analogy_ni_pcimio: mio_common: GCPT[0] subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering GPCT[1] subdevice...
Analogy: analogy_ni_pcimio: mio_common: GPCT[1]: 24 bits
Analogy: analogy_ni_pcimio: mio_common: GPCT[1]: command feature available
Analogy: analogy_ni_pcimio: mio_common: GCPT[1] subdevice registered
Analogy: analogy_ni_pcimio: mio_common: registering counter subdevice...
Analogy: analogy_ni_pcimio: mio_common: counter subdevice registered
Analogy: analogy_ni_pcimio: mio_common: initializing AI...
Analogy: analogy_ni_pcimio: mio_common: AI initialization OK
Analogy: analogy_ni_pcimio: mio_common: initializing A0...
Analogy: analogy_ni_pcimio: mio_common: A0 initialization OK
Analogy: analogy_ni_pcimio: mio_common: DMA setup
Analogy: analogy_ni_pcimio: mio_common: attach procedure complete
Analogy: a4l_free_lnkdesc: minor=0
Analogy: a4l_setup_transfer: minor=0
Analogy: a4l_rt_close: minor=0
Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_devinfo: minor=0
Analogy: a4l_rt_ioctl: minor=0
---------------> snip <-----------------
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_reserve_transfer: minor=0 idx=1
Analogy: a4l_rt_close: minor=0

Then typed:
cmd_write
cmd_write: triggering failed (ret=-16)

error trace:

Analogy: a4l_rt_open: minor=0
Analogy: a4l_rt_ioctl: minor=0
---------------> snip <-----------------

Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_cancel: subdevice currently idle
Analogy: a4l_rt_ioctl: minor=0
Analogy: a4l_ioctl_cmd: minor=0
Analogy: a4l_fill_cmddesc: desc dump
Analogy:        ->idx_subd=1
Analogy:        ->flags=0
Analogy:        ->nb_chan=2
Analogy:        ->chan_descs=0x0
Analogy:        ->data_len=0
Analogy:        ->pdata=0x(null)
Analogy: a4l_check_cmddesc: minor=0
Analogy: a4l_ioctl_cmd: 1st cmd checks passed
Analogy: a4l_ioctl_cmd: driver's cmd checks passed
Analogy: a4l_reserve_transfer: minor=0 idx=1
Analogy: a4l_init_transfer: minor=0 idx=1
Analogy: a4l_rt_write: minor=0
Analogy: a4l_rt_ioctl: minor=0
Analogy: analogy_ni_pcimio: ni_request_ao_mite_channel: failed to

reserve mite dma channel for analog outut.
Analogy: a4l_rt_close: minor=0

Hope this helps
Ettore

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 5 lines
      -Felipe Brandão Cavalcanti
      LARA - Robotics and Automation Laboratory
      Department of Electrical Engineering
      UnB - University of Brasília, Brazil
      http://www.lara.unb.br/~fbcavalcanti/
#33 lore raw

Hi,

Quoted 7 lines · Felipe Brandão Cavalcanti

Hello,

I just installed Xenomai 2.5.1, however, I am having the exact same problem - the computer completely crashes when running analogy_config analogy0 analogy_ni_pcimio. However, I could not get any significant debug info before the system crashes.

This is the exact behavior I had with Xenomai 2.5.0.

I am running Ubuntu 9.04 on a with a AMD Sempron 2800+ with a National Instruments 6221-37 DAQ card. Xenomai seems to be running pretty well.

I am surprised that it is the same bug. If I remember well, there were two bugs:
- the first one was specific to NI 67xx cards and was fixed
- the second one was supposed to be fixed with the following commits:
analogy: [NI mite] initialize the mite structures after their allocations
analogy: [NI mite] initialize channels' status

I am afraid we are facing a bright new one...

Quoted 2 lines

So, is this a known issue? Can I help with the debug messages/logs in any way?

Even if your system crashes, you might be able to catch the log traces printed just before. In such a case, could you set the analogy debug options like this:
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG=y
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=0
CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

And send your kernel traces, after having launched the attach procedure (which, if I understand well, should have triggered the bug).

Quoted 6 lines

Thanks for the help,
-Felipe Brandão Cavalcanti

(Sorry to reply to such an old thread.. but my problem seemed a lot like this one.)

Alexis.

#34 lore raw
In reply to Felipe Brandão Cavalcanti

Hi,

Quoted 7 lines · Felipe Brandão Cavalcanti

Hello,

I just installed Xenomai 2.5.1, however, I am having the exact same problem - the computer completely crashes when running analogy_config analogy0 analogy_ni_pcimio. However, I could not get any significant debug info before the system crashes.

This is the exact behavior I had with Xenomai 2.5.0.

I am running Ubuntu 9.04 on a with a AMD Sempron 2800+ with a National Instruments 6221-37 DAQ card. Xenomai seems to be running pretty well.

I am surprised that it is the same bug. If I remember well, there were two bugs:
- the first one was specific to NI 67xx cards and was fixed
- the second one was supposed to be fixed with the following commits:
analogy: [NI mite] initialize the mite structures after their allocations
analogy: [NI mite] initialize channels' status

I am afraid we are facing a bright new one...

Quoted 2 lines

So, is this a known issue? Can I help with the debug messages/logs in any way?

Even if your system crashes, you might be able to catch the log traces printed just before. In such a case, could you set the analogy debug options like this:
CONFIG_XENO_DRIVERS_ANALOGY_DEBUG=y CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL=0 CONFIG_XENO_DRIVERS_ANALOGY_DRIVER_DEBUG_LEVEL=1

And send your kernel traces, after having launched the attach procedure (which, if I understand well, should have triggered the bug).

Quoted 6 lines

Thanks for the help,
-Felipe Brandão Cavalcanti

(Sorry to reply to such an old thread.. but my problem seemed a lot like this one.)

Alexis.

#35 lore raw
In reply to Ettore Pedretti
Quoted 10 lines · Ettore Pedretti

Hi,

I did not quite understand how to checkout the analogy branch. When I do git branch -a either in xenomai-head or in xenomai-2.5 I get only:

* master
origin/HEAD
origin/master

no other branch is available for checkout. I'm obviously missing something.

The analogy branch is located in my repository. So you need to add my repository as a remote one:
git remote add xenomai-abe git://xenomai.org/xenomai-abe.git
git fetch xenomai-abe

Now, the branch should be available:
git branch -r
...
xenomai-abe/analogy
...

You just have to create a new branch on your repo:
git branch --track xenomai-abe/analogy analogy

Quoted 60 lines

I tried to apply the patch but it failed. At the end I edited mio_common.c directly. I hope I did not introduce any error. Everything compiled and installed fine.

The attach command did not complain this time:

analogy_config analogy0 analogy_ni_pcimio

The error trace is attached (dmesg_07Jan2010.txt). I also attached the kernel config as you asked: (config_analogy).

However the device /dev/analogy0 does not seem to be created.

The content of /proc/analogy/drivers is:

-- Analogy drivers --

| idx | driver name
|  00 | analogy_ni_pcimio
|  01 | analogy_8255

/proc/analogy/devices is:

-- Analogy devices --

| idx | status | driver
|  00 | Linked | analogy_ni_pcimio
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

/proc/analogy/00-analogy_ni_pcimio

-- Subdevices --

| idx | type
|  00 | Unused subdevice
|  01 | Analog output subdevice
|  02 | Digital input/output subdevice
|  03 | Unused subdevice
|  04 | Unused subdevice
|  05 | Calibration subdevice
|  06 | Memory subdevice
|  07 | Digital input/output subdevice
|  08 | Unused subdevice
|  09 | Serial subdevice
|  10 | Unused subdevice
|  11 | Counter subdevice
|  12 | Counter subdevice
|  13 | Counter subdevice

When I try cmd_write I get this

Quoted 8 lines

cmd_write: triggering failed (ret=-16)

I was expecting complaints about /dev/analogy0 not existing. I'm confused.

Progress though!

Ettore

Alexis.