rt_fifo's controlled by semaphore's latency
steven.krekels at alcatel.be
Thu Nov 21 14:51:08 CET 2002
I'm trying to improve some throughput over the ISA bus on a
PC104 (Pentium MMX 266) system running debian, kernel 2.4.18, rtai 24.1.9.
As the ISA bus is quite slow ( on 8MHz one 16bit access takes about
800ns) I'm looking for optimization in the code...
Based on timings measured with a logic analyser on the ISA bus, I've
got the impression that rt_fifo's controlled by semaphores is
taking more time the I would expect.
I'm having a hard time finding out if there is room for improvement or
that I just have to accept the current timings.
Of course improvement is my goal :-)
Here's what it's about:
Task 1 Irq:
- signals task1 semaphore (indicating input data available on isa)
Task 2 Irq:
- signals task2 semaphore (allowing output data to be written on isa)
Task 1: input processing
a. rt_sem_wait() on task1 semaphore
b. read data from isa
c. process data
d. write data to rt_pipe
e. rt_sem_signal() data available semaphore
Task 2: output processing
a. rt_sem_wait() on data available semaphore
b. read data from rt_pipe
c. rt_sem_wait() on semaphore 2
d. write to isa
And here are the timings (relative time values):
0ns -- Task2 irq is fired
4370ns -- Task2 irq handler
2185ns -- Task1 irq is fired
4410ns -- Task1 irq handler
3615ns -- Task1 starts reading input
9005ns -- Task2 starts to write output
The irq latency is good, i.e. below 5 us.
I'm surprised by the time it takes to write to the pipe, signal a
semaphore and read from the pipe especially since only 36 bytes of data
so the time I'm concerned about is between task1,part a and task 2,part d.
The very first time it takes ~50us, but on average it takes 10us
between task1,part a and task 2,part d.
Are these reasonable figures? I really don't know.
I don't know what is happening behind the scenes of rt_pipes
and rt_semaphores. But tens of us looks a lot to me.
Any hints/suggestions/remarks/... ?
Steven Krekels Email: steven.krekels at alcatel.be
Alcatel Bell Space N.V. Phone: +32 3 829 51 75
Berkenrodelei 33 Fax: +32 3 829 55 02
More information about the Rtai