Messages in this thread | | | From | Benno Senoner <> | Subject | APM killing low-latency performance on BX mainboard (we need a method to disable it dynamically) | Date | Wed, 10 Nov 1999 23:49:41 +0100 |
| |
Hi, I discovered a problem of APM which can ruin the performance of low-latency (realtime) apps. All tests performed using Ingo's 2.2.10-lowlatency-N6 patch:
On my new dual Celeron box with Gigabyte GA-6BX mainboard, when enabling APM, ( Redhat comes with APM enabled by default), there are regular IRQ losses when the APM driver polls the hardware. ( every second)
I discovered when I ran the latencytest benchmark:
With Ingo's patches, my old P133 delivered rock-solid (while stressed) 2.1ms latencies. While my Celeron366 (in UP mode, because SMP lowlatency performance is not properly optimized on Ingo's patch), shows up regular 2ms peaks (at 1 sec interval) when the box is completely idle. With bigger audio fragment sizes the diagrams show clearly that there are losses of IRQs when APM makes the BIOS calls. When I disabled APM on my Celeron, the results were rock-solid without any nasty peaks. Note that disabling the power management in the BIOS and running an APM enabled kernel did not help: APM remained active and the peaks at 1sec intervals were still present. Note that the same happens when I'm doing high freq timing tests using RTC. Same peaks , same problems, and disabling APM solves the RTC problems too.
Now my question: in order to achieve best low-latency performance, we need a way to disable APM on problematic boxes, but without recompiling the kernel.
my proposals: make a sysctl ( or is this already implemented) to disable APM at runtime or: make a kernel commandline boot option which allows to disable APM at boottime, just like when the kernel detects that it is running on a SMP box.
now the diagrams:
APM ENABLED:
4x128 audiobuffer http://www.gardena.net/benno/linux/audio/apm/enabled/4x128.html
note the regular peaks at exactly 1 sec interval. I was unableto get reliable playback with this buffersize on the Celeron+APM, while the P133 gave me no problems.
4x8192 audiobuffer: http://www.gardena.net/benno/linux/audio/apm/enabled/4x8192.html
note that this diagram shows that some IRQs of the soundcard get lost, causing high latencies, and therefore potentially unreliabe playback when using small buffersizes.
APM DISABLED: rock-solid results ! http://www.gardena.net/benno/linux/audio/apm/disabled/4x128.html
Note that in order to get really low-latencies all IDE devices must be DMA enabled with unmaskirq and if possible 32bit access enabled:
I discovered a small (but easy to correct) problem:
by default ATAPI CDROM driver run with DMA , unmaskirq and 32bit I/O all three disabled. You can tune this using hdparm -d 1 -u 1 -c 1 /dev/hdc or so , but the problem is that you can't do this when there is no CD in the drive.
It would be nice a to add an option to hdparm and/or the ATAPI CDROM driver, to force the mode changes, so that the distros could do this in the initscripts by default.
For example I have a MASHITA DVD ATAPI as hdc, and when mounting a CDROM and cp'ing the entire CD to the harddisk, when the DVD/CDROM drive is in untuned mode, the latencies go up to 20-70ms , but when tuning the CDROM drive with hdparm, the latencies go down to a rock-solid 2ms !
comments, suggestions ?
regards, Benno. sbenno@gardena.net Linux low-latency benchmarks: http://www.gardena.net/benno/linux/audio
- 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/
| |