Bonjour,
Je me suis trompé dans mon message précédent, si on fait :
# cat /proc/xenomai/latency
on obtient : 509039189470
C'est donc une erreur de faire :
echo -4386 > /proc/xenomai/latency
Reprenons:
# echo 0 > /proc/xenomai/latency
# latency
RTT| 00:00:01 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| 3.200| 14.340| 55.822| 0| 0| 3.200| 55.822
RTD| 3.200| 14.459| 74.549| 0| 0| 3.200| 74.549
RTD| 3.200| 13.274| 78.815| 0| 0| 3.200| 78.815
RTD| 3.200| 12.681| 91.615| 0| 0| 3.200| 91.615
RTD| 3.200| 12.681| 68.741| 0| 0| 3.200| 91.615
RTD| 3.200| 12.444| 75.260| 0| 0| 3.200| 91.615
RTD| 3.200| 12.563| 74.430| 0| 0| 3.200| 91.615
RTD| 3.200| 12.800| 71.230| 0| 0| 3.200| 91.615
RTD| 3.200| 12.681| 78.578| 0| 0| 3.200| 91.615
RTD| -4.267| 13.037| 77.512| 0| 0| -4.267| 91.615 <<
RTD| 3.200| 12.563| 80.593| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 68.741| 0| 0| -4.267| 91.615
RTD| 3.200| 13.511| 72.889| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 74.311| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 84.623| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 73.008| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 77.156| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 78.341| 0| 0| -4.267| 91.615
RTD| 3.200| 14.340| 63.289| 0| 0| -4.267| 91.615
RTD| 3.200| 13.866| 77.037| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 80.949| 0| 0| -4.267| 91.615
RTT| 00:00:22 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| 3.200| 14.340| 77.512| 0| 0| -4.267| 91.615
RTD| 3.200| 13.985| 79.289| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 82.489| 0| 0| -4.267| 91.615
RTD| 3.200| 14.340| 67.911| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 78.223| 0| 0| -4.267| 91.615
RTD| 3.200| 14.459| 79.289| 0| 0| -4.267| 91.615
RTD| 3.200| 14.340| 78.697| 0| 0| -4.267| 91.615
RTD| 3.200| 14.340| 77.037| 0| 0| -4.267| 91.615
RTD| 3.200| 13.866| 74.904| 0| 0| -4.267| 91.615
RTD| -4.623| 11.614| 68.385| 0| 0| -4.623| 91.615 <<
RTD| 1.422| 14.459| 73.008| 0| 0| -4.623| 91.615
RTD| 3.200| 14.459| 76.563| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 64.948| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 75.734| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 80.119| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 80.119| 0| 0| -4.623| 91.615
RTD| 3.200| 14.459| 80.356| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 76.800| 0| 0| -4.623| 91.615
RTD| 3.200| 14.459| 82.371| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 75.378| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 81.897| 0| 0| -4.623| 91.615
RTT| 00:00:43 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| 3.200| 14.340| 78.341| 0| 0| -4.623| 91.615
RTD| 3.200| 14.459| 80.712| 0| 0| -4.623| 91.615
RTD| 3.200| 14.459| 74.074| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 74.786| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 75.260| 0| 0| -4.623| 91.615
RTD| 3.200| 14.340| 83.675| 0| 0| -4.623| 91.615
RTD| 3.200| 14.577| 79.882| 0| 0| -4.623| 91.615
RTD| 3.200| 14.222| 75.971| 0| 0| -4.623| 91.615
RTD| 3.200| 13.866| 75.971| 0| 0| -4.623| 91.615
RTD| -4.267| 14.222| 78.104| 0| 0| -4.623| 91.615 <<
RTD| -2.845| 14.577| 82.252| 0| 0| -4.623| 91.615
RTD| 3.200| 14.459| 88.889| 0| 0| -4.623| 91.615
Je n'explique pas pourquoi on a, périodiquement, la routine de traitement qui se déclenche plutôt !?
Si on veut prendre la latence min de 3,200µs, il faut faire attention:
# echo 3200 > /proc/xenomai/latency
# cat /proc/xenomai/latency
3081
# echo 3300 > /proc/xenomai/latency
# cat /proc/xenomai/latency
3200
On arrive à faire l'ajustement que l'on voulait obtenir mais on a toujours ce problème...
# latency
== Sampling period: 1000 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT| 00:00:01 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| 0.000| 10.903| 51.793| 0| 0| 0.000| 51.793
RTD| 0.000| 11.259| 77.037| 0| 0| 0.000| 77.037
RTD| 0.000| 9.481| 63.882| 0| 0| 0.000| 77.037
RTD| 0.000| 10.074| 72.652| 0| 0| 0.000| 77.037
RTD| 0.000| 9.126| 68.504| 0| 0| 0.000| 77.037
RTD| 0.000| 10.429| 75.971| 0| 0| 0.000| 77.037
RTD| -7.349| 8.651| 66.726| 0| 0| -7.349| 77.037 <<
RTD| 0.000| 9.955| 76.682| 0| 0| -7.349| 77.037
RTD| 0.000| 9.007| 66.726| 0| 0| -7.349| 77.037
RTD| 0.000| 10.548| 67.437| 0| 0| -7.349| 77.037
RTD| 0.000| 11.140| 72.889| 0| 0| -7.349| 77.037
RTD| 0.000| 11.140| 78.934| 0| 0| -7.349| 78.934
RTD| 0.000| 11.140| 76.208| 0| 0| -7.349| 78.934
RTD| 0.000| 11.140| 78.223| 0| 0| -7.349| 78.934
RTD| 0.000| 11.140| 67.674| 0| 0| -7.349| 78.934
RTD| 0.000| 11.140| 71.111| 0| 0| -7.349| 78.934
RTD| 0.000| 11.259| 75.260| 0| 0| -7.349| 78.934
RTD| 0.000| 11.140| 66.134| 0| 0| -7.349| 78.934
RTD| 0.000| 11.259| 77.512| 0| 0| -7.349| 78.934
RTD| 0.000| 11.140| 82.015| 0| 0| -7.349| 82.015
RTD| 0.000| 11.259| 75.141| 0| 0| -7.349| 82.015
RTT| 00:00:22 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| 0.000| 11.140| 64.000| 0| 0| -7.349| 82.015
RTD| 0.000| 10.311| 75.023| 0| 0| -7.349| 82.015
RTD| 0.000| 11.140| 77.630| 0| 0| -7.349| 82.015
RTD| 0.000| 11.259| 69.926| 0| 0| -7.349| 82.015
RTD| 0.000| 11.140| 66.015| 0| 0| -7.349| 82.015
RTD| 0.000| 10.192| 66.252| 0| 0| -7.349| 82.015
RTD| -7.467| 11.140| 76.326| 0| 0| -7.467| 82.015 <<
RTD| 0.000| 11.140| 74.786| 0| 0| -7.467| 82.015
RTD| 0.000| 10.785| 69.215| 0| 0| -7.467| 82.015
RTD| 0.000| 11.140| 76.445| 0| 0| -7.467| 82.015
Curieusement le problème arrive plus régulièrement en réduisant la période de latency...
# latency -p500
== Sampling period: 500 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT| 00:00:01 (periodic user-mode task, 500 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| -6.875| 5.096| 55.111| 0| 0| -6.875| 55.111 <<
RTD| 0.000| 5.451| 66.845| 0| 0| -6.875| 66.845
RTD| 0.000| 5.214| 75.615| 0| 0| -6.875| 75.615
RTD| -6.638| 5.214| 67.911| 0| 0| -6.875| 75.615 <<
RTD| 0.000| 5.214| 70.400| 0| 0| -6.875| 75.615
RTD| 0.000| 4.622| 66.489| 0| 0| -6.875| 75.615
RTD| -7.112| 4.859| 72.297| 0| 0| -7.112| 75.615 <<
RTD| 0.000| 4.622| 74.193| 0| 0| -7.112| 75.615
RTD| 0.000| 5.688| 73.600| 0| 0| -7.112| 75.615
RTD| -6.638| 5.214| 59.852| 0| 0| -7.112| 75.615 <<
Jusqu'à l'avoir tout le temps...
# latency -p100
== Sampling period: 100 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
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| -7.704| 0.948| 54.045| 0| 0| -7.704| 54.045
RTD| -7.467| 1.303| 61.274| 0| 0| -7.704| 61.274
RTD| -6.875| 1.422| 57.245| 0| 0| -7.704| 61.274
RTD| -6.993| 1.422| 62.104| 0| 0| -7.704| 62.104
RTD| -7.349| 1.422| 66.252| 0| 0| -7.704| 66.252
RTD| -7.230| 1.422| 62.815| 0| 0| -7.704| 66.252
Je vais continuer les tests pour savoir d'où viennent ces 4.623µs...
En ce qui concerne le patch sur le itimer, j'ai déterminé la valeur minimale du rechargement du timer matériel:
Valeurs testées:
100 -
110 -
115 -
120 ok
125 ok
150 ok
250 ok
500 ok
1000 ok
2000 ok
+ s3c2410_itimer.min_delay_ticks = ipipe_timer_ns2ticks(&s3c2410_itimer, 120);
Pour diminuer la latence, il faut désactiver les options de debug et de statistiques dans le kernel:
CONFIG_XENO_OPT_STATS
CONFIG_XENO_OPT_DEBUG
IPIPE_DEBUG
CONFIG_FTRACE
...
J'espère que cela vous aide,
A bientôt
Romain