Ubuntu – How to adjust IRQ priority in Ubuntu 12.04


The question says it all. I see some tutorials online for earlier editions of Ubuntu, but am having a hard time for 12.04.

Best Answer

Questions like this are very important when running pro audio applications. As you see, and as I have experienced myself many times in the past, Askubuntu.com has a tendency to tell us that we don't need an answer to these kinds of questions. For these narrowly focused questions, you'll find more friendly help on places like the LinuxMusicians forum or the OpenSourceMusicians IRC channel (# opensourcemusicians).

I run KX Studio (which is a pro audio distribution on top of Kubuntu) and I have gotten a lot of help at both #kxstudio and #ardour IRC channels.

Anyway, here's how you do it now that I have figured it out with help from the above resources.

Use these commands to discover the USB bus and IRQ of your audio device:

  • lsusb (or lsusb -t)
  • lspci (or lspci -v)
  • cat /proc/interrupts

In my case, my USB audio interface is ehci_hcd:usb2 on IRQ 23. It may not be easy to figure it out, but if you cross reference the above listings you'll figure out which IRQ is of interest after some detective work. See below for more tips.

Next, install rtirq
See the Ubuntu Wiki:

Now edit the file /etc/default/rtirq (as sudo). And look for the line that contains RTIRQ_NAME_LIST=

If you want IRQ 23 to have the highest priority, add it to the front of the list like so:

RTIRQ_NAME_LIST="23 usb i8042 snd"

However, in my case, I would rather use the name of the device in case the IRQ assignment changes for some unknown reaason. So I specify it like this:

RTIRQ_NAME_LIST="ehci_hcd:usb2 usb i8042 snd"

Just put the device (or IRQ) at the front of the list for highest priority. It is a space delimited list.

Save the file, then run:

sudo /etc/init.d/rtirq restart

There is no need to reboot. You'll see the resulting IRQ priorities listed from the command above. But if you want to see them again later, run:

sudo /etc/init.d/rtirq status

And check cat /proc/interrupts if desired.

Some extra tips, as promised:

Using lsusb I found that my audio interface was on USB Bus 001 Device 003.

Next, using lspci -v I found that I have 3 USB controllers. I found one listed like this: 00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1. The flags in that listed included these: Flags: bus master, medium devsel, latency 0, IRQ 23. So, assuming I picked the right USB controller (the one controlling Bus 01), those flags told me that I am interested in IRQ 23.

Next, /proc/interrupts told me that IRQ 23 has the device name ehci_hcd:usb2 associated with it.

I also used tree /sys/bus/usb/drivers/usb/ and cat /proc/asound/cards to cross reference info to pick the correct USB controller.

You might also find the following Perl script useful: