<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>I have been attempting to get passed through sound cards working
      and have been encountering issues.  Apart from the extra
      complication of windows, I've been testing with a real-time audio
      app like yoshimi, and I get audio lag/glitches.  I've been
      tracking down the causes of these glitches and have found several
      things that contribute.  So far, on two setups I have, I've found:</p>
    <ul>
      <li>>1ms long SMIs on a GA-990FX motherboard, caused
        exclusively by parallel disk writes (I am running a 5-disk array
        on it)<br>
      </li>
      <li>The linux radeon driver (on the host) occasionally locking up
        a core for 10-35ms at a time (I think this has been fixed since
        the 4.19 series)<br>
      </li>
      <li>When console messages get sent to a serial port, it locks up a
        core for the duration of the message. (This is a known problem
        that is still being worked on)</li>
      <li>qemu's emulated (uhci) USB seems to hold up a vCPU for a few
        ms somewhere in the guest's interrupt handler</li>
    </ul>
    <p>I've been able to track these down with some combination of</p>
    <p>- the SMI (hwlat) detector in ftrace<br>
      - the irqsoff tracer in ftrace<br>
      - cyclictest<br>
      - guesswork<br>
    </p>
    <p> I have found workarounds for the above, however I am still
      having trouble with one box - I get glitches every minute or two. 
      My investigation is so far stuck at hits from the irqsoff tracer
      that contain lines like this:</p>
    <p><tt>alsa-sin-31611     1d...    0us#: _raw_spin_lock_irq</tt><tt><br>
      </tt><tt>alsa-sin-31611     1d... 4448us :
        snd_pcm_group_unlock_irq</tt><tt><br>
      </tt></p>
    <p>So, questions:</p>
    <p>- when I get output like the above from an irqsoff trace, how do
      I probe further?</p>
    <p>- are there any other tools that could help with debugging these
      sorts of problems?<br>
    </p>
    <p>- I understand that for IRQs to get routed properly from host to
      guest, the device needs to have a per-device (per-function?) IRQ
      status bit that can be used to aid in routing.  How do I confirm
      that the device in question has this bit?</p>
    <p>- how do I check that IRQs are being routed to the guest
      optimally?  What do I watch out for?  How do I check if it's using
      irqfd?<br>
    </p>
    - does MSI really help?  Will it save any more more than, say, 100us
    in IRQ response latency?<br>
    <p>(I am able to swap in a sound card that works; I have a cheap USB
      dongle that hasn't given me any problems yet.  I still want to see
      what options I have though.)</p>
    <p><br>
    </p>
  </body>
</html>