Where do you "Set $SOUND_CARD_IRQ"?

Optimize your system for ultimate performance.

Moderators: khz, MattKingUSA

Nachei
Established Member
Posts: 122
Joined: Fri Feb 17, 2012 3:32 am
Contact:

Where do you "Set $SOUND_CARD_IRQ"?

Postby Nachei » Thu Aug 01, 2019 3:27 am

Hi, I'm going through the points of Realtime Config Quick Scan script in order to tune my new system, so far with great success, but now I've found something I don't know how to do:

Code: Select all

** Set $SOUND_CARD_IRQ to the IRQ of your soundcard to enable more checks.


Where exactly do you set that variable? I've tried in .bashrc and within the realTimeConfigQuickScan.pl script, but it either gets ignored or throws an error. Thank you in advance

User avatar
raboof
Established Member
Posts: 1639
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby raboof » Thu Aug 01, 2019 6:42 am

For example on the commandline:

Code: Select all

$ SOUND_CARD_IRQ=12 ./realTimeConfigQuickScan.pl

User avatar
CrocoDuck
Established Member
Posts: 1056
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby CrocoDuck » Thu Aug 01, 2019 8:16 am

I put a video on YouTube some time ago about this. Check it out: https://www.youtube.com/watch?v=MJbzWAVV198
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?

Nachei
Established Member
Posts: 122
Joined: Fri Feb 17, 2012 3:32 am
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby Nachei » Thu Aug 01, 2019 8:06 pm

Thank you for the responses. The video is unfortunately unwatchable, at least for my eyes/screen :roll: I can't distinguish what the terminal says. So I tried raboof's command:

Code: Select all

$ SOUND_CARD_IRQ=129 ./realTimeConfigQuickScan.pl


and I get:

Code: Select all

Can't locate QuickScanEngine.pm in @INC (you may need to install the QuickScanEngine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./realTimeConfigQuickScan.pl line 23.
BEGIN failed--compilation aborted at ./realTimeConfigQuickScan.pl line 23.


Then I modified it, using the way to start the script that appears in the readme file:

Code: Select all

$ SOUND_CARD_IRQ=129 perl -I ./ ./realTimeConfigQuickScan.pl


And then it works, but all it does is suppressing the message "** Set $SOUND_CARD_IRQ ..." at the bottom. Does it mean there are no more tests available for my machine, or should I do something else? Thank you.

User avatar
raboof
Established Member
Posts: 1639
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby raboof » Fri Aug 02, 2019 7:25 am

Nachei wrote:I tried raboof's command:

Code: Select all

$ SOUND_CARD_IRQ=129 ./realTimeConfigQuickScan.pl


and I get:

Code: Select all

Can't locate QuickScanEngine.pm...



That sounds like https://github.com/raboof/realtimeconfi ... n/issues/8 which should be fixed in https://github.com/raboof/realtimeconfi ... an/pull/23 since december - are you on the latest version of the script?

Nachei wrote:Then I modified it, using the way to start the script that appears in the readme file:

Code: Select all

$ SOUND_CARD_IRQ=129 perl -I ./ ./realTimeConfigQuickScan.pl


And then it works


Great!

Nachei wrote:all it does is suppressing the message "** Set $SOUND_CARD_IRQ ..." at the bottom. Does it mean there are no more tests available for my machine, or should I do something else?


This just means it didn't find any problems. I agree this could be clearer. Do you think https://github.com/raboof/realtimeconfi ... an/pull/29 would help?

User avatar
CrocoDuck
Established Member
Posts: 1056
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby CrocoDuck » Fri Aug 02, 2019 7:29 am

Nachei wrote:Thank you for the responses. The video is unfortunately unwatchable, at least for my eyes/screen :roll: I can't distinguish what the terminal says.


Aw no! I will perhaps make a better one in the future.
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?

User avatar
thetotalchaos
Established Member
Posts: 151
Joined: Mon Sep 29, 2014 8:29 pm
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby thetotalchaos » Fri Aug 02, 2019 4:33 pm

This seems to be removed in the latest versions of QuickScan. But just out of curiosity - What are those extra checks, that appear if you give the IRQ value properly?
Check out my latest music album The girl with the stars in her eyes
https://totalchaos-music.bandcamp.com/album/the-girl-with-the-stars-in-her-eyes

Nachei
Established Member
Posts: 122
Joined: Fri Feb 17, 2012 3:32 am
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby Nachei » Fri Aug 02, 2019 10:05 pm

Thank you again for all the info. It's been very useful and of great clarification to me.

raboof wrote:are you on the latest version of the script?


Aaah, nope, sorry, just noticed. I found that script a long time ago, and kept it in my computer; I didn't know that it was an "alive" project, and was afraid of not finding it later when I needed it, as I use it only the times I have to reinstall my audio distro (which I do as seldom as possible). I've tested the latest version now, and it works with both versions of the perl command (with or without the -I option). Other than that, the outputs are the same as in the older version.

raboof wrote:Do you think https://github.com/raboof/realtimeconfi ... an/pull/29 would help?


Thank you for the addition, I haven't used GitHub in my life, but I finally figured out that I had to copy that piece of code and paste it in the script from line 73 (correct me if I'm wrong). The script says "did not find multiple, ok", so great on that side... :)

CrockoDuck wrote:Aw no! I will perhaps make a better one in the future.


That would be great, I understand that you gods of Terminal only need an approximation to the thing, you can skip steps... But we poor power users sometimes thank being taken by the hand, command by command... :P

thetotalchaos wrote: just out of curiosity - What are those extra checks, that appear if you give the IRQ value properly?


As I mentioned at the bottom of post #4 of this thread, other than removing the "**set $SOUND_CARD_IRQ..." message, the script shows no change, no additional checks -I was intrigued too :) -. I apologize if my previous answer was not elaborate or emphatic enough. I requote for convenience:

Nachei wrote:...it works, but all it does is suppressing the message "** Set $SOUND_CARD_IRQ ..." at the bottom. Does it mean there are no more tests available for my machine, or should I do something else?


----------

With this, I've gone through the whole QuickScan script and everything shows "good", except "Kernel with Real-Time Preemption", which, if I'm correct, is no longer needed (I'm optimizing Ubuntu Studio 19, which has a low latency kernel).

In addition to this, as my computer has SSD, I applied this optimization for SSD https://linuxmusicians.com/viewtopic.php?t=14970 by Crocoduck I found via his site (https://thecrocoduckspond.wordpress.com/2016/05/15/a-look-at-ubuntu-studio-16-04/. Great article, by the way):

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="threadirqs quiet elevator=noop"


Stability has been greatly improved, and I can now record at 5.8ms latency with Guitarix and Reaper, but I still get occasional pops and Xruns, which I don't know where they come from. My laptop is 2 years old, it has 16Gb Ram, SSD and an i7 processor (2.70GhZ, 2 cores, 4 threads), and yet I've had these pops both in this distro and its predecessor Ubuntu Studio 16 (never had this problem with my previous 32 bits machine). Could you suggest what I could test next, for further optimization? Thank you.

User avatar
CrocoDuck
Established Member
Posts: 1056
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby CrocoDuck » Sat Aug 03, 2019 6:27 am

thetotalchaos wrote:This seems to be removed in the latest versions of QuickScan. But just out of curiosity - What are those extra checks, that appear if you give the IRQ value properly?


As far as I am aware, the IRQ checks are still included in the latest version (me from the future: yep, they are, just checked). The IRQ check will check whether there is some hardware that shares the same IRQ as your audio device. IRQ is used by the OS to prioritize access to hardware, so ideally you do not want your sound device to have the same IRQ as other things, or these other things might steal priority away from the soundcard. In my experience, this IRQ tuning is not really that important, but mileage varies by system.

Here how I typically use realtimeConfigQuickscan to check IRQ.

Starting from my laptop booted up with my USB soundcard umplugged:

Code: Select all

dmesg -wH


This will open dmesg in realtime mode. This means we will see the kernel messages in realtime. Then, I plug my USB soundcard. I will see lines like these popping up:

Code: Select all

[  +4.176360] usb 2-2: new high-speed USB device number 5 using xhci_hcd
[  +0.140814] usb 2-2: New USB device found, idVendor=1397, idProduct=0507, bcdDevice= 1.12
[  +0.000006] usb 2-2: New USB device strings: Mfr=1, Product=3, SerialNumber=0
[  +0.000004] usb 2-2: Product: UMC202HD 192k
[  +0.000003] usb 2-2: Manufacturer: BEHRINGER


This shows the soundcard being registered by the Kernel, and being handled by the xhci_hcd driver. Then, I look at /proc/interrupts, where all devices IRQ settings are shown:

Code: Select all

cat /proc/interrupts


The output:

Code: Select all

           CPU0       CPU1       CPU2       CPU3       
  0:          6          0          0          0  IR-IO-APIC   2-edge      timer
  1:          0          9          0          0  IR-IO-APIC   1-edge      i8042
  8:          0          0          1          0  IR-IO-APIC   8-edge      rtc0
  9:          0       1231          0          0  IR-IO-APIC   9-fasteoi   acpi
 12:          0          0          0        159  IR-IO-APIC  12-edge      i8042
 18:          0          0          0          0  IR-IO-APIC  18-fasteoi   i801_smbus
 23:          0          0         33          0  IR-IO-APIC  23-fasteoi   ehci_hcd:usb1
 40:          0          0          0          0  DMAR-MSI   0-edge      dmar0
 41:          0          0          0          0  DMAR-MSI   1-edge      dmar1
 42:          0          0          0          0  IR-PCI-MSI 458752-edge      PCIe PME, pciehp
 43:          0          0          0          0  IR-PCI-MSI 462848-edge      PCIe PME
 44:          0          0          0          0  IR-PCI-MSI 464896-edge      PCIe PME
 45:          0          0          0      99655  IR-PCI-MSI 327680-edge      xhci_hcd
 46:     176862          0          0          0  IR-PCI-MSI 512000-edge      ahci[0000:00:1f.2]
 47:          0          0         21          0  IR-PCI-MSI 360448-edge      mei_me
 48:          0          0          0          0  IR-PCI-MSI 1048576-edge      enp2s0
 49:          0          0          0        373  IR-PCI-MSI 442368-edge      snd_hda_intel:card1
 50:      85238          0          0          0  IR-PCI-MSI 32768-edge      i915
 51:          0      14993          0          0  IR-PCI-MSI 1572864-edge      iwlwifi
 52:          0          0        211          0  IR-PCI-MSI 49152-edge      snd_hda_intel:card0
NMI:          0          0          0          0   Non-maskable interrupts
LOC:     188824     175136     193560     176545   Local timer interrupts
SPU:          0          0          0          0   Spurious interrupts
PMI:          0          0          0          0   Performance monitoring interrupts
IWI:       8417         60        186         50   IRQ work interrupts
RTR:          2          0          0          0   APIC ICR read retries
RES:      27161      43382      41311      31474   Rescheduling interrupts
CAL:      20740      21841      22411      22860   Function call interrupts
TLB:      40764      39825      38169      35888   TLB shootdowns
TRM:          0          0          0          0   Thermal event interrupts
THR:          0          0          0          0   Threshold APIC interrupts
DFR:          0          0          0          0   Deferred Error APIC interrupts
MCE:          0          0          0          0   Machine check exceptions
MCP:          4          5          5          5   Machine check polls
HYP:          0          0          0          0   Hypervisor callback interrupts
HRE:          0          0          0          0   Hyper-V reenlightenment interrupts
HVS:          0          0          0          0   Hyper-V stimer0 interrupts
ERR:          0
MIS:          0
PIN:          0          0          0          0   Posted-interrupt notification event
NPI:          0          0          0          0   Nested posted-interrupt event
PIW:          0          0          0          0   Posted-interrupt wakeup event


In there you will see that devices handled by xhci_hcd are on IRQ 45. Then, I can run realtimeConfigQuickScan like this:

Code: Select all

env SOUND_CARD_IRQ=45 perl realTimeConfigQuickScan.pl


Which will complete the IRQ check, finding no conflincts (yay!).

For your infomration, SOUND_CARD_IRQ is an environment variable, which is a variable you define in your shell. Many programs search for environment variables to achieve various things. The command above, making use of the env commands, just sets a new environment variable SOUND_CARD_IRQ for the execution of of the following command (perl realTimeConfigQuickScan.pl). Then, the variable is destroyed, so it will not alter your shell permanently. You can read more here: https://wiki.archlinux.org/index.php/En ... _variables

The moral of the story is: when something tells you to set an ALL_CAPITALS thing, most likely it is an environment variable. To check IRQ with realTimeConfigQuickscan, you just have to somehow find which kernel driver handles your device and then look it up on /proc/interrupts. dmesg is not the only way, but to me it is easiest with external devices.

Hope it helps/clarifies.
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?

User avatar
raboof
Established Member
Posts: 1639
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby raboof » Sat Aug 03, 2019 8:41 am

Nachei wrote:
raboof wrote:are you on the latest version of the script?


I didn't know that it was an "alive" project


There haven't been many updates - I'm not actively tuning my system at the moment so there's not many lessons to encode. I'd be happy to accept contributions though!

Nachei wrote:
raboof wrote:Do you think https://github.com/raboof/realtimeconfi ... an/pull/29 would help?


Thank you for the addition, I haven't used GitHub in my life, but I finally figured out that I had to copy that piece of code and paste it in the script from line 73 (correct me if I'm wrong). The script says "did not find multiple, ok", so great on that side... :)


Thanks for reviewing, merged!

Nachei wrote:
thetotalchaos wrote: just out of curiosity - What are those extra checks, that appear if you give the IRQ value properly?


other than removing the "**set $SOUND_CARD_IRQ..." message, the script shows no change


The output is now clearer with https://github.com/raboof/realtimeconfi ... l/29/files : when the IRQ is specified, the script checks there's no other modules using the same IRQ.

Nachei wrote:the whole QuickScan script and everything shows "good", except "Kernel with Real-Time Preemption", which, if I'm correct, is no longer needed


It's certainly way less essential than it used to be, though it may still help. Perhaps add a note to https://wiki.linuxaudio.org/wiki/system ... ime_kernel ?

Nachei wrote:In addition to this, as my computer has SSD, I applied this optimization for SSD https://linuxmusicians.com/viewtopic.php?t=14970 by Crocoduck I found via his site (https://thecrocoduckspond.wordpress.com/2016/05/15/a-look-at-ubuntu-studio-16-04/. Great article, by the way):

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="threadirqs quiet elevator=noop"


Stability has been greatly improved


Cool! Would be nice if someone could add that to the script? :)

Nachei wrote:I still get occasional pops and Xruns, which I don't know where they come from.


It's hard to say - better monitoring tools for this would be so nice!

User avatar
English Guy
Established Member
Posts: 469
Joined: Wed Oct 17, 2012 7:28 pm
Location: England

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby English Guy » Sat Aug 03, 2019 9:28 am

Nachei wrote:Thank you for the responses. The video is unfortunately unwatchable, at least for my eyes/screen :roll: I can't distinguish what the terminal says. So I tried raboof's command:

Code: Select all

$ SOUND_CARD_IRQ=129 ./realTimeConfigQuickScan.pl


and I get:

Code: Select all

Can't locate QuickScanEngine.pm in @INC (you may need to install the QuickScanEngine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./realTimeConfigQuickScan.pl line 23.
BEGIN failed--compilation aborted at ./realTimeConfigQuickScan.pl line 23.


Then I modified it, using the way to start the script that appears in the readme file:

Code: Select all

$ SOUND_CARD_IRQ=129 perl -I ./ ./realTimeConfigQuickScan.pl


And then it works, but all it does is suppressing the message "** Set $SOUND_CARD_IRQ ..." at the bottom. Does it mean there are no more tests available for my machine, or should I do something else? Thank you.

I had a problem like this with a video and solved it by changing the quality setting at the bottom.

Nachei
Established Member
Posts: 122
Joined: Fri Feb 17, 2012 3:32 am
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby Nachei » Sun Aug 04, 2019 4:30 am

Thank you again for all the responses. I love it when I get to know a bit better how everything works at the "guts" level...

@Crocoduck:

thank you for the system to check IRQ. I was doing it in a different way and I wasn't sure if I did it right; I checked interrupts with

Code: Select all

cat /proc/interrupts
, looking for a line that had something to do with sound. In my case that was

Code: Select all

snd_hda_intel:card0
, corresponding to number 129, and that's what I used. Your explanation puts in the open, also, a doubt I had always had: so the script must be run with the interface connected... (for some reason I always assumed that "checking your system" was just limited to the computer, and having the interface connected or not was irrelevant for QuickScan...)

So I guess what I had tested so far was the inner sound card. I've tested the interface now too, following your system, and I get the same successful result, no overlapping IRQs. However, in addition to your output, I also get a few additional error lines; does anybody know what's their cause and if they are important, or can be ignored? They appear exactly the same no matter what USB port I use, or if it is USB 2 or 3:

Equivalent output:

Code: Select all

[ago 4 05:24] usb 1-1: new high-speed USB device number 6 using xhci_hcd
[  +0,126641] usb 1-1: New USB device found, idVendor=17cc, idProduct=1001, bcdDevice= 0.32
[  +0,000002] usb 1-1: New USB device strings: Mfr=12, Product=7, SerialNumber=13
[  +0,000001] usb 1-1: Product: Komplete Audio 6
[  +0,000000] usb 1-1: Manufacturer: Native Instruments
[  +0,000001] usb 1-1: SerialNumber: 18A7AB36


And additional lines:

Code: Select all

[  +0,017013] usb 1-1: cannot get ctl value: req = 0x83, wValue = 0x806, wIndex = 0xd00, type = 4
[  +0,000003] usb 1-1: 13:0: cannot get min/max values for control 8 (id 13)
[  +0,000154] usb 1-1: cannot get ctl value: req = 0x83, wValue = 0xb01, wIndex = 0xd00, type = 4
[  +0,000001] usb 1-1: 13:0: cannot get min/max values for control 11 (id 13)
[  +0,000191] usb 1-1: cannot get ctl value: req = 0x83, wValue = 0xc01, wIndex = 0xd00, type = 4
[  +0,000002] usb 1-1: 13:0: cannot get min/max values for control 12 (id 13)


@Raboof:

you're welcome, and I'm happy that now I can add GitHub and perl to my resume, just because I copy-pasted some stuff... :P

Building a real-time kernel seems a bit of a stretch for me, so I'm going to try other optimizations first; the reason I installed Ubuntu Studio was because of it being an audio-tailored distro, precisely trying to avoid this kind of "heavy stuff" (at least heavy for me, of course in this forum there are different levels of competence and some people will compile several kernels every day before breakfast :) ). Besides, the worst part is that there's no guarantee that, after going through all the works, it would improve the stability of my system, if the problem is elsewhere...

So now I'm going to see what else I find in this forum re:optimization, and I will open a new thread if(when) I run into a new obstacle... Thank you everybody...

@English Guy:

I have to say your message puzzled me at first, then I understood maybe you wanted to quote only the two lines about the video being difficult to watch, but you quoted the whole post instead, am I right? Thank you for the suggestion, it's been a while since I've had to change manually the resolution in YouTube videos because most of the time they choose for you the right one automatically (and if resolution goes down sometimes, it's usually due to slow connection speed, which you cannot control, and goes back to normal when speed goes up again). Just to be sure I checked the video's resolution options, and there was just one option available, so in that sense, great relief that it wasn't my eyes only... :P

User avatar
CrocoDuck
Established Member
Posts: 1056
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: Where do you "Set $SOUND_CARD_IRQ"?

Postby CrocoDuck » Sun Aug 04, 2019 11:33 am

Nachei wrote:

Code: Select all

[  +0,017013] usb 1-1: cannot get ctl value: req = 0x83, wValue = 0x806, wIndex = 0xd00, type = 4
[  +0,000003] usb 1-1: 13:0: cannot get min/max values for control 8 (id 13)
[  +0,000154] usb 1-1: cannot get ctl value: req = 0x83, wValue = 0xb01, wIndex = 0xd00, type = 4
[  +0,000001] usb 1-1: 13:0: cannot get min/max values for control 11 (id 13)
[  +0,000191] usb 1-1: cannot get ctl value: req = 0x83, wValue = 0xc01, wIndex = 0xd00, type = 4
[  +0,000002] usb 1-1: 13:0: cannot get min/max values for control 12 (id 13)



I have no idea about what that means, to be honest. If you have no trouble, just leave it. My guess is that your interface has some hardware control that the Kernel doesn't know how to handle properly. If you do not experience reduction in functionality or performance, just leave it.

Nachei wrote:you're welcome, and I'm happy that now I can add GitHub and perl to my resume, just because I copy-pasted some stuff... :P

Ha! Oldest trick in the book.
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?


Return to “System Tuning and Configuration”

Who is online

Users browsing this forum: MSN [Bot] and 1 guest