You are not logged in.
Pages: 1
I have a usb sound card and would like to assign a dedicated IRQ to it, to reduce latency.
I have onboard usb but also bought a usb pcie card with usb ports on it. The onboard usb provides several physical ports, but I think it's a hub, because no matter which port I use, the devices all get the same bus number. That's why I got the pcie card; to use it exclusively for the soundcard, such that it has its own IRQ.
But now I read something about MSI/MSI-X, and wonder if I actually need a dedicated pci card?
The USB controller of my onboard usb supports MSI, which, according to this, "permits a device to allocate 1, 2, 4, 8, 16 or 32 interrupts".
lspci -v tells me something like
Capabilities: [50] MSI: Enable+ Count=1/8 Maskable- 64bit+It's driven by xhci_hcd and xhci_pci.
What I want is that either:
*) when I plug in a usb device in any of the onboard ports, a dedicated IRQ is created for it.
*) or a certain number of "free" IRQs is created initially, and every attached device get's the next free one.
At the moment this doesn't work; as I wrote above, all devices are on the same bus and therefore have the same IRQ, right?
Is it possible at all to do that with MSI? I thought maybe there is a kernel option for the xhci driver or module to do this? Sorry if that question doesn't make sense, I don't know much about this stuff.
(On a side note; when I plug in the PCIE card into the slot and boot, it uses MSI-X
Capabilities: [68] MSI-X: Enable+ Count=8 Masked-and 5 new IRQs are created, even though I don't plug in any device....unfortunately attaching devices doesn't work yet, because the card needs "external" power for which I don't have a cable yet (credits to R00KIE and firekage). So I don't know about the PCIE....Anyways, the question here is about the onboard usb, which uses MSI)
Thanks a lot for your help!
Stefan
Last edited by stri (2015-04-15 05:50:00)
Offline
I don't have any good answers for you -- it ha been a long time since I have had to reallocate IRQs in Linux. I am curious as to why you believe this is necessary? You really cannot assign an interrupt to a USB peripheral on a USB bus; they are, by nature, pretty much a polled device. You can allocate an interrupt for the USB controller. In reading your post I think you understand this, I just wanted to state it explicitly for other readers of the thread. Audio is reasonably low bandwidth and data flow at predictable rates both in and out making it reasonably easy manage quality of service. Why do you feel the need for a dedicated interrupt for such a low bandwidth well buffered device when the time to respond to an interrupt is infinitesimal compared to the USB poll time? It seems you would want dedicated interrupts for high bandwidth highly asynchronous stuff like gigabit Ethernet or hard disk transfers.
Now, dedicated DMA channels on the other hand....
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Thanks a lot for taking the time to answer!
I have a midi keyboard to make music on the computer, and read it's good to use separate irq's for midi controllers and sound cards (see e.g. post number 6 at linuxmusicians). I don't know if this is actually relevant in a modern computer, however, I thought it was simple to fix, so I thought it doesn't hurt.
In my intuitive understanding, too many devices create too much traffic, and this can lead to ALSA buffer "xruns".
For live performance the total latency should be small (time between a key is pressed and the sound exits from the speaker). The total latency depends, amongst others, on the ALSA buffer size (see the page on the alsa-project, or the JACK page on the Arch wiki). The buffer guarantees that there is a constant stream of audio without interruptions.
large buffer<=>high latency<=>stable audio.
small buffer<=>low latency<=> possibly unstable audio, i.e. clicks and interruptions
There are many inexpensive USB sound systems which produce very good quality at very low latency if the USB is good on the motherboard, but not all.
I interpret "...if the USB is good on the motherboard..." to be related to the post at the linuxmusicians link above, basically meaning that not too many devices should hang on one usb controller?
Currently I have (at least) the following devices on a single usb controller:
*) midi keyboard
*) midi control surface
*) usb sound card
*) mouse
*) keyboard (logitech unified controller)
*) wireless card
I have too little experience to say when xruns actually occur; for example, I noticed once that I could produce xruns if and only if I moved my mouse curser, but I can't reproduce this and it may be due to things other than usb.
I have zero clue how usb devices work (computers in general). Since you used the expression "polling" in your post, I did a bit of reading, but I don't know many things, e.g.
1) does each device have its own polling frequency, or does the usb controller poll them all with the same freq?
2) more importantly, how to calculate a ballpark estimate of whether there could ever be too much traffic (triggering xruns) if the above devices all hang on one controller?
Thanks a lot,
Stefan
Offline
Pages: 1