Page 1 of 1

Jack/USB/Xruns

Posted: Tue Dec 24, 2019 10:46 am
by dormirj
hello again after a while,

i'm working on creating a stable recording setup with mixbus, a lenovo x250 and zoom h4n as audio interface. currently running ubuntu-studio with preempt lowlatency kernel.

i run jack at 48khz with 256/3 buffer/periods which is "good enough" in terms of latency for me, especially since i can monitor directly through the interface and i pretty much have 0 xruns, unless there is something really unexpected happening to the computer.

now - whenever i attach a mouse (currently deathadder essential) to the second usb port, i get xruns every 1-2 minutes. do you think it has something to do with this specific mouse or is it just in the nature of the usb implementation on the x250s mainboard that i can't run realtime audio when there are other devices also desiring the use of the usb bus?

...i can live with it, but it's kind of annoying to do all recording and mixing without a proper mouse.

if there's any config files you'd need to see or anything else, please let me know.

thanks for reading,
greetings;;
dormir

Re: Jack/USB/Xruns

Posted: Tue Dec 24, 2019 3:39 pm
by lilith
Is it only on that USB port? Likely your interface and your mouse are sharing the same IRQ.

Can you post the output of /etc/init.d/rtirq status?
And you can also read this thread: viewtopic.php?f=27&t=19276&hilit=IRQ+lilith

Re: Jack/USB/Xruns

Posted: Thu Dec 26, 2019 10:20 am
by dormirj
thansk for your reply.

rtirq status:
PID CLS RTPRIO NI PRI %CPU STAT COMMAND
446 FF 90 - 130 0.0 S irq/47-snd_hda_
103 FF 85 - 125 0.0 S irq/23-ehci_hcd
104 FF 85 - 125 1.3 S irq/40-xhci_hcd
106 FF 80 - 120 0.0 S irq/1-i8042
105 FF 79 - 119 0.0 S irq/12-i8042
47 FF 50 - 90 0.0 S irq/9-acpi
107 FF 50 - 90 0.0 S irq/8-rtc0
186 FF 50 - 90 0.0 S irq/42-rtsx_pci
188 FF 50 - 90 0.0 S irq/41-ahci[000
405 FF 50 - 90 0.0 S irq/44-mei_me
426 FF 50 - 90 0.0 S irq/45-i915
431 FF 50 - 90 0.0 S irq/46-iwlwifi
538 FF 50 - 90 0.0 S irq/48-snd_hda_
432 FF 49 - 89 0.0 S irq/46-s-iwlwif
7 TS - 0 19 0.1 R ksoftirqd/0
17 TS - 0 19 0.0 S ksoftirqd/1
23 TS - 0 19 0.0 S ksoftirqd/2
29 TS - 0 19 0.0 S ksoftirqd/3
lsusb:
Bus 001 Device 002: ID 8087:8001 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 005: ID 5986:0366 Acer, Inc
Bus 002 Device 006: ID 8087:0a2a Intel Corp.
Bus 002 Device 003: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 002 Device 002: ID 0bdb:193e Ericsson Business Mobile Networks BV
Bus 002 Device 007: ID 1532:006e Razer USA, Ltd
Bus 002 Device 009: ID 1686:0045 ZOOM Corporation H4 Digital Recorder
Bus 002 Device 008: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
so it seems that both physical usb ports are going through the same bus. not sure how to interpret irq status, since it doesn't list the usb devices or how would i be able to see that? thanks also for sharing your own journey and thread, i will dig deeper through it, but i think it doesn't relate too much. in my case i really don't use the computer for anything but running mixbus for recording and eq, dsp usage around 10%. still will try a few suggestions there for general optimization. will post if i happen to find something interesting or useful.

greetings;;

Re: Jack/USB/Xruns

Posted: Fri Dec 27, 2019 3:42 pm
by lilith
You could try to put the Zoom H4 on a bus which is different from Bus 2 (e.g. Bus 1 which is also USB 2.0) and keep the mouse in place. At least for a test.

Re: Jack/USB/Xruns

Posted: Mon Jan 06, 2020 8:58 am
by dormirj
Sadly i only have two usb ports which are located on the same bus on this machine, but i'm no longer sure it really is the mouse which causes the xruns. I've still encountered some even without the mouse in a recent recording session and i *believe* it maybe had something to do with pulseaudio? after killing pulseaudio i only had a very occasional xrun, still trying to get to absolute 0 - I really want to have that "reliable" feeling when making music or jamming...

anyway, after looking at the situation with the interrupts and realtime priorities, it seems to me that my internal soundcard snd_hda gets its proper 90 rtprio, but since i'm actually using an external usb interface for all audio duties, wouldn't i actually want to have usb priority higher than audio if the system prioritizer doesnt recognize the h4n as an audio device? is there maybe a way to give a very specific usb device a higher priority than the internal soundcard?

Re: Jack/USB/Xruns

Posted: Mon Jan 06, 2020 1:44 pm
by merlyn
There are a few ways of doing this.

(1) Disable the onboard soundcard in the BIOS

(2) Blacklist the hda kernel module

With both of those you no longer have onboard sound as an option.

(3) Edit rtirq.conf. The location of this varies with distribution, on my Arch system it is /etc/default/rtirq.conf

I have a PCI soundcard, and sometimes use a USB 1.1 device. In my rtirq.conf I have this :

Code: Select all

RTIRQ_NAME_LIST="snd_ice1 ohci"
ohci is USB 1.1. ehci is USB 2.0 and xhci is USB 3.

i8042 is the ps/2 controller so you don't need that to have realtime priority I don't think.

Re: Jack/USB/Xruns

Posted: Tue Jan 07, 2020 12:35 am
by dormirj
right on;

thanks for your suggestions!

i've blacklisted everything related to snd_hda since i couldn't find a way to disable soundcard in bios, i did however disable a lot of other unnecessary devices in the bios (usb 3.0, cardreader, modem, fingerprint-reader, etc.). also gave the main rt priority to ehci, since the h4n is using usb 2.0.

did a little test and recorded some 7 minutes without xruns or crackles. i'm not celebrating yet, but it's looking promising so far!

greetings;;

-------------[EDIT]----------------------------

so after more in-depth testing it seems everything is not better. i've tried different kernels and distributions (mx linux, ubuntu studio, avlinux) with lowlatency, rt kernels and liquorix, turned off anything i could imagine, realtime-scan utility gives me green light, realtime priority goes to the h4n which is the only usb device present, no networking, no bluetooth... still there is no way for me to be able to record in a stable environment, often i can make a recording of a few minutes, sometimes even an hour without xrun, sometimes i can even record 4-5 tracks and it works, but most of the time i get an xrun after 2-3 minutes while recording - this is just recording into mixbus from external audio source, no fx, no other software running on the computer.

is there some way to debug what is causing xruns? i'd really like to know what can keep doing this, i mean maybe it's an issue with the interface or some kind of hardware function that i've missed to turn off..

-------------[EDIT 2]----------------------------

one thing i have seen a few times now, not sure if it's all the time, sometimes xrun occurrance coincides with a dmesg output called:
NOHZ: local_softirq_pending 80
-------------[EDIT 3]----------------------------

added nohz=off to the bootline of the kernel, not sure if it did anything regarding the xrun performance, maybe they are a bit fewer? but i'm not cured yet. the digging goes on...