On Wed, 2004-09-29 at 09:55, Mark Knecht wrote:
Lee Revell wrote:
Oops, sorry, I meant microseconds. I was
actually looking at a trace
when I wrote this, and Ingo's tracer prints milliseconds, and I screwed
up the conversion. It looks like 2-3 usecs to determine where the
interrupt came from if two devices share an irq.
Thanks Lee. That's very compatible with my back-of-the-envelope
calculations. However, I believe that number assumes that the leading
interrupt device is not interrupting and you only had to determine that
the real interrupt came from the sound card. Assuming a shared
interrupt, and assuming that a USB controller is the first and the sound
card is the second device, what delay is encountered by the sound card
when both devices interrupt at the same time?
I understand that there is probably a few microseconds extra delay as
the system determines that there are two interrupt devices pending. How
long is it, however, before the UCB interrupt handler does all it's work
and hands off to the sound card interrupt handler (or sound card driver)
so that it can get started?
It looks like about one microsecond to dispatch the irq to the correct
handler. Mouse activity produces at most a 20-30 usec delay in jackd,
regardless of whether the interrupt is shared. So this matches my other
estimate of 50 usecs or so in the USB interrupt handler.
I grant you that this will should not amount to 500uS
worth of delay,
but then we need to add in the possibilities of other, higher priority
interrupts coming along during that window and further delaying the
sound card getting it's work don before the Jack frame runs out.
This is the beauty of the 2.6 kernel with the VP patches. If you
configure the IRQ threading correctly, it is impossible for interrupts
from other IRQ lines to interrupt the sound card at all. The only thing
that can delay the sound card interrupt is if the system is already
processing another interrupt from the same line (like, say, USB). Since
the USB irq handler is very fast, this should never be a problem.
For me this is not a mere curiosity. Yesterday I
brought up FC2 and
then, with much help from Steve Harris and Fernando, got a new Planet
kernel installed. No sooner than I had started Jack I then started using
my USB mouse and getting huge xruns. Since USB is shared with the sound
chip I think it's an example of what we ae talking about here.
Not quite. If you have a USB sound card it's a different ball game,
because you don't just have two separate devices sharing the interrupt,
you actually have them competing for USB bus bandwidth. Although it
should work if they are on different USB controllers. Unfortunately I
am not an expert on USB so I can't help much more.
Lee