Messages in this thread | | | Date | Sat, 24 Jul 1999 16:32:21 +0200 | From | Ove Ewerlid <> | Subject | Re: real-time threaded IO with low latency (audio) |
| |
Paul Barton-Davis wrote: > > actually, what is really needed is interrupt filtering, not > disabling. because the soundcard ADAC works as very nice timer, i > actually want the real time thread to get interrupts from it. at the > same time, i would like that processor to receive no other interrupts. > > do you know of any way to do this ?
First, disabling symetric interrupt delivery per interrupt can be done in arch/i386/kernel/io_apic.c. Search for PIC_IRQS. This means that any interrupt can be setup to only go to the boot CPU. The make sure you FS process is running on the other CPU.
Secondly, the sound card works like a very nice timer but you do not need to use interrupts to take advantage of that. Instead, if you have on CPU dedicated to the FX processing, you can easily phase lock on the sample rate of the sound card. To do this setup the sound card in circular mode and MMAP the DMA buffer into a user process. Then keep the entire DMA input buffer at some fixed MAGIC value. When the DMA card trashes this value your user level process easily tracks this and restore the buffer magic behind the DMA pointer. This makes it possible to get the lowest possible lattencies. Limited primarily by the PCI burst DMA block size and possibly by buffering in the sound card. (We use ess1370 and ess1371 (note that many ess1370 show spectral peaks and is rather low quality))
Third, here is a patch I use on i386 linux SMP systems. The patch allows a process to lock onto a CPU, offers some additional IRQ stats to above all give info about cache invalidations.
http://www.syscon.uu.se/~oe/linux-2.3.9-cpu-lock-irq-stat.diff
We use this to run two 1371 sound cards for a course in applied signal processing of audio signals. I do not have any time to support this!
The overall setup in this course is that matlab is running on the boot CPU and a dedicated C/C++ program is running on the locked CPU to do hard real time audio processing - FIR filters and what not.
Some cmex primitives has been added to matlab to fork of a locked process that communicates to matlab through shared matrices. The students love this setup :-)
In general I think that the debate about multimedia in linux is too focused on non trivial "fixes" in the kernel when there is so much that can be done in user space with really minor kernel changes. Infact, my patch for locking CPU´s has decreased in size of the years. Also, MMAP was designed for close operation to the hardware, use this instead of read/write.
Given the cheap SMP boards based on Celeron an SMP system should not cost much more then a single CPU system (unless Intel disables the SMP support of the Celeron in the future).
Ove
-- Ove Ewerlid Ove.Ewerlid@syscon.uu.se or Ove.Ewerlid@signal.uu.se Phone: +46 70 666 23 63, Fax: +46 18 503 611, +46 18 555 096
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |