[Xenomai] Reading /proc/xenomai/stat causes high latencies

Jeroen Van den Keybus jeroen.vandenkeybus at gmail.com
Fri Apr 25 12:44:46 CEST 2014


For testing, I've removed the locks from the vfile system. Then the
high latencies reliably disappear.

To test, I made two xeno_nucleus modules: one with the xnlock_get/put_
in place and one with dummies. Subsequently, I use a program that
simply opens and reads the stat file 1,000 times.

With locks:

RTT|  00:00:01  (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD|     -2.575|     -2.309|      9.286|       0|     0|     -2.575|      9.286
RTD|     -2.364|     -2.276|      1.600|       0|     0|     -2.575|      9.286
RTD|     -2.482|     -2.274|      2.165|       0|     0|     -2.575|      9.286
RTD|     -2.368|    135.261|   1478.154|   13008|     0|     -2.575|   1478.154
RTD|     -2.368|     -2.272|      2.602|   13008|     0|     -2.575|   1478.154
RTD|     -2.499|     -2.272|      6.933|   13008|     0|     -2.575|   1478.154

Without locks:

RTT|  00:00:01  (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD|     -2.503|     -2.270|      3.310|       0|     0|     -2.503|      3.310
RTD|     -2.418|     -2.284|     -1.646|       0|     0|     -2.503|      3.310
RTD|     -2.496|     -2.275|      4.630|       0|     0|     -2.503|      4.630
RTD|     -2.374|     -2.285|     -1.458|       0|     0|     -2.503|      4.630
RTD|     -2.452|     -2.273|      3.559|       0|     0|     -2.503|      4.630
RTD|     -2.370|     -2.285|     -1.518|       0|     0|     -2.503|      4.630
RTD|     -2.458|     -2.274|      4.203|       0|     0|     -2.503|      4.630

I'll now have a closer look into the vfile system but if the locks are
malfunctioning, I'm clueless.


BTW I found that unloading and loading xeno_nucleus didn't work due to
a missing rthal_free_ptdkey call in xnshadow_cleanup. I used the
following patch to fix that. (The ability to swap out xenomai modules
is a real lifesaver when debugging. Thanks!)

--- /home/vdkeybus/work/xenomai/ksrc/nucleus/shadow.c   2014-04-16
22:46:19.018851844 +0200
+++ shadow.c    2014-04-25 09:43:49.838735832 +0200
@@ -3139,6 +3139,8 @@ void xnshadow_cleanup(void)
        }

        rthal_apc_free(lostage_apc);
+
+       rthal_free_ptdkey(nkmmptd);
        rthal_free_ptdkey(nkerrptd);
        rthal_free_ptdkey(nkthrptd);


Jeroen.




More information about the Xenomai mailing list