How to get effective low-latency performance on your linux box
If you've ever experienced audio dropouts, xruns, jackd messages that belie the touted benefits of Linux as an audio platform, you've experienced my frustration. Luckily, there are some simple steps you can do that are not well known and easy to find on the web. Read on, and don't give up...
I assume you've read up on how to patch/and or use a low-latency linux kernel. We won't cover that here. Google for that elsewhere, there's plenty said about that everywhere else. You wouldn't be reading this if that were the problem!
Here's what we'll cover:
1)tuning the hard drive
2)tuning the pci bus
3)most importantly--TURNING OFF ACPI IN THE KERNEL
Ok, this is an example of what I put in my /etc/rc/rc.local file (it may be different for you if you're not using Slackware, but basically this script is executed at boot time to do some setup of the various user-tweaked subsystems):
echo "Setting hard disk drive to low-latency performance settings...."
/usr/sbin/hdparm -m 8 -d 1 -u 1 -c 1 /dev/hda
/sbin/setpci -d *:* latency_timer=20
The first line will tune your hard drive to use dma, or direcy memory access. This is a step that is also covered elsewhere, but I mention it here again anyway, since it's in the same script as the less well-known part of the solution, which I will explain. This 'hdparm' step will tune the hard drive to interfere less with audio performanceas it shuttles data back and forth from RAM. The 2nd line is the one I want to point out because I just learned this trick....this will lower the priority of some of the other PCI cards which might be hogging bus resources, in particular PCI bus controllers, or video cards. If you can, boost the setting of your audio card by finding it using 'lspci -v', and using 'setpci -s xx:xx.x latency_timer=f8', where xx:xx.x is your audio card's pci address given by 'lspci -v'.
AND THE BIGGEST MOST IMPORTANT, EVEN MORE CRITICAL FOR ME STEP....was to add this little line in my '/etc/lilo.conf' file (I don't know what it would be for grub, but you'll know if you use that):
This basically passes a boot-time option to the kernel to shut off the acpi subsystem, which really, because of IRQ settings, etc. on my system, was hogging the hell out of my sound cards otherwise weak resources. I was amazed to see that JACK (the jackd) and ALSA were giving me performance latencies as advertised: <2.5 msec!!! And, no more xruns (only on the initialzation of a JACK client did I get an xrun message, thereafter nothing at all---and I was playing the pipe-organ application 'aeolus' with all the stops out for hours....ditto the 'ams' synth...your mileage may vary of course, but try this--it worked like gangbusters for me!