[Xenomai] Gpio: IRQ handler is called ~4ms after state change

Giulio Moro g.moro at qmul.ac.uk
Sat Jun 17 18:52:18 CEST 2017


Hi,
I ported this GPIO driver from Xenomai 2.6 to Xenomai 3 and I run it on the Beaglebone Black: https://github.com/giuliomoro/gpio-irq-rtdm/

TheRTDM  irq_handler (in gpio_irq_rtdm.c) toggles a pin "kernel timingpin" as soon as the IRQ is received.
The test program registers a pin to monitor and sleeps in a ioctl() waiting for the pin to go low. When the kernel unblocks it from the ioctl(), the task toggles another pin "user timingpin".

The original authors claims that, on the BeagleBone Black, with Xenomai 2.6:
* the kernel timingpin will change roughly 5us after the test pin is toggled by an external clock
*  the user timingpin will change roughly 5-10us after the kernel timingpin

The above values make sense to me.

My observations, on the BeagleBone Black, Linux 4.4.65 with Xenomai 3.0.5:
* the kernel timingpin will change roughly 4ms (milliseconds) after the test pin is toggled by an external clock
* the user timingpin will change 40 to 60us (microseconds) after the kernel timingpin

So it seems that in my case it takes a long time for the irq_handler() to be called after the test pin is toggled.
Am I doing something wrong in the kernel module ?

See in particular irq_handler() and gpio_irq_ioctl_rt() in gpio_irq_rtdm.c
and demo() in gpio-irq-test.c

$  cat /proc/xenomai/sched/stat
CPU  PID    MSW        CSW        XSC        PF    STAT       %CPU  NAME
  0  0      0          166718     0          0     00018000   99.1  [ROOT]
  0  691    1          1          5          0     000600c0    0.0  gpio-irq-test
  0  698    1          112758     338273     0     00040042    0.6  trivial
  0  0      0          978799     0          0     00000000    0.1  [IRQ16: [timer]]
  0  0      0          112756     0          0     00000000    0.2  [IRQ98: gpio69]

$ cat /proc/xenomai/sched/threads

CPU  PID    CLASS  TYPE      PRI   TIMEOUT       STAT       NAME
  0  0      idle   core       -1   -             R          [ROOT]
  0  691    rt     cobalt      0   -             X          gpio-irq-test
  0  698    rt     cobalt     99   -             W          trivial

Thanks,
Giulio


More information about the Xenomai mailing list