How to run rtirq script when login to my pc?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
digitsun
Established Member
Posts: 91
Joined: Thu Mar 04, 2021 1:50 am
Has thanked: 13 times
Been thanked: 14 times

How to run rtirq script when login to my pc?

Post by digitsun »

----------------------
OS specs:

- OS: Debian 10
- Kernel: 4.19.0-14-rt-amd64[/code]
----------------------

Following many guides and comments I decided to install the rtirq script. But in Debian official repositories (even in Ubuntu repos) the packages is very old, so I downloaded it from official Rui PPA.

I edit /etc/default/grub and change with this:

Code: Select all

GRUB_CMDLINE_LINUX="threadirqs"
But I have a problem... I need to start the script manually when turn on my computer every time. I found this annoying, so How to run rtirq script when login to my pc?

PS: In this forum an old post about this topic is broken because the answers of a user disappeared (maybe that user delete his account), so this topic need it an updating.
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

The following should do the trick:

Code: Select all

sudo systemctl enable rtirq
sudo systemctl restart rtirq
User avatar
digitsun
Established Member
Posts: 91
Joined: Thu Mar 04, 2021 1:50 am
Has thanked: 13 times
Been thanked: 14 times

Re: How to run rtirq script when login to my pc?

Post by digitsun »

Thnaks for the hints! :)
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

No problem! And if things still don't start up at login don't hesitate to post! Also, with a real-time kernel you don't need the threadirqs option.
User avatar
sunrat
Established Member
Posts: 915
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 151 times
Been thanked: 242 times

Re: How to run rtirq script when login to my pc?

Post by sunrat »

autostatic wrote: Thu Mar 04, 2021 6:56 pm No problem! And if things still don't start up at login don't hesitate to post! Also, with a real-time kernel you don't need the threadirqs option.
A related question I've been meaning to ask for ages: is threadirqs kernel parameter needed for a low-latency kernel with PREEMPT eg. Liquorix?

Code: Select all

$ grep -e "CONFIG_IRQ_FORCED_THREADING=y" -e "CONFIG_PREEMPT=y" -e "CONFIG_PREEMPT_RT=y" /boot/config-`uname -r`
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_PREEMPT=y
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

sunrat wrote: Thu Mar 04, 2021 11:28 pmA related question I've been meaning to ask for ages: is threadirqs kernel parameter needed for a low-latency kernel with PREEMPT eg. Liquorix?
I need to look this up, I know PREEMPT_RT implies threadirqs (see https://wiki.linuxfoundation.org/realti ... /threadirq) but I'm not sure what the current state of affairs is with low-latency kernels. You can double check yourself maybe with the following command:

Code: Select all

ps -eo cmd | grep [i]rq
If the output matches when booted with and without the threadirqs parameter then you probably don't need it. You might also want to check with the following command:

Code: Select all

cat /proc/cmdline
And see if threadirqs is maybe already there as it is possible to force kernel parameters when building a kernel.
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

Did some quick research and if CONFIG_IRQ_FORCED_THREADING_DEFAULT is set to y then you don't need threadirqs. This might be a bit different for Liquorix kernels though as they seem to use their own config setting for this, FORCE_IRQ_THREADING. If the latter is set to y then you shouldn't need threadirqs. I'll update this in the wiki too.
User avatar
sunrat
Established Member
Posts: 915
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 151 times
Been thanked: 242 times

Re: How to run rtirq script when login to my pc?

Post by sunrat »

autostatic wrote: Fri Mar 05, 2021 10:40 am Did some quick research and if CONFIG_IRQ_FORCED_THREADING_DEFAULT is set to y then you don't need threadirqs. This might be a bit different for Liquorix kernels though as they seem to use their own config setting for this, FORCE_IRQ_THREADING. If the latter is set to y then you shouldn't need threadirqs. I'll update this in the wiki too.
The config I showed in my post above is from current 5.10.0-17.1-liquorix-amd64

Code: Select all

grep -e "THREADING" /boot/config-5.10.0-17.1-liquorix-amd64 
CONFIG_IRQ_FORCED_THREADING=y
# CONFIG_FORCE_IRQ_THREADING is not set
so your answer just prompts further confusion. I'll check with that ps command and get back shortly.
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

sunrat wrote: Fri Mar 05, 2021 11:10 am The config I showed in my post above is from current 5.10.0-17.1-liquorix-amd64

Code: Select all

grep -e "THREADING" /boot/config-5.10.0-17.1-liquorix-amd64 
CONFIG_IRQ_FORCED_THREADING=y
# CONFIG_FORCE_IRQ_THREADING is not set
so your answer just prompts further confusion. I'll check with that ps command and get back shortly.
Totally agree all these settings are confusing, hopefully the ps command provides some more clarity. In your case CONFIG_IRQ_FORCED_THREADING_DEFAULT doesn't seem to be there and CONFIG_FORCE_IRQ_THREADING is not set. So I assume a Liquorix kernel needs threadirqs if you want threaded IRQ's.
User avatar
sunrat
Established Member
Posts: 915
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 151 times
Been thanked: 242 times

Re: How to run rtirq script when login to my pc?

Post by sunrat »

A bit later - the results of that ps/grep command are vastly different when booted with threadirqs so I guess it needs to be added to kernel line in /etc/default/grub to be active. I'm not sure how much effect it will have or how to measure it.
I also just disabled Intel C-States before this and got a marked improvement in threshold of xruns measured with xruncounter. From:

Code: Select all

in complete 27 Xruns in 41407 cycles                                  
first Xrun happen at DSP load 79.73% in cycle 36483
process takes 8.29ms from total 10.67ms jack cycle time
To:

Code: Select all

in complete 3 Xruns in 45753 cycles                                  
first Xrun happen at DSP load 91.02% in cycle 42277
process takes 9.66ms from total 10.66ms jack cycle time
Last test for today, running xruncounter with threadirqs boot parameter seems to make a significant improvement again:

Code: Select all

Samplerate is 48000Hz 
Buffersize is 512 
Buffer/Periods  2
jack running with realtime priority
Xrun 1 at DSP load 99.35% use 10.38ms from 10.67ms jack cycle time
in complete 1 Xruns in 45677 cycles                                  
first Xrun happen at DSP load 99.35% in cycle 45661
process takes 10.38ms from total 10.67ms jack cycle time
I don't think it can get any better than that! Will test another time with lower buffers. Kernel parameters:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_idle.max_cstate=0 processor.max_cstate=1 threadirqs"
Apologies to OP for hijacking this topic but hopefully some of the additional info is helpful.
barbouze
Established Member
Posts: 186
Joined: Tue May 26, 2015 12:26 pm
Has thanked: 2 times
Been thanked: 16 times

Re: How to run rtirq script when login to my pc?

Post by barbouze »

sunrat wrote: Fri Mar 05, 2021 12:17 pm I don't think it can get any better than that! Will test another time with lower buffers. Kernel parameters:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_idle.max_cstate=0 processor.max_cstate=1 threadirqs"
Apologies to OP for hijacking this topic but hopefully some of the additional info is helpful.
You could add mitigations=off to that grub line IF you have an Intel CPU and are aware of the risk taken. More details here.
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

Already added that one to the System Configuration wiki. I'll look into adding the pstate, cstate and idle parameters.
User avatar
digitsun
Established Member
Posts: 91
Joined: Thu Mar 04, 2021 1:50 am
Has thanked: 13 times
Been thanked: 14 times

Re: How to run rtirq script when login to my pc?

Post by digitsun »

autostatic wrote: Thu Mar 04, 2021 6:56 pm No problem! And if things still don't start up at login don't hesitate to post! Also, with a real-time kernel you don't need the threadirqs option.
Wait a minute... What does mean exactly "with a real-time kernel you don't need the threadirqs option". I suppose that GRUB_CMDLINE_LINUX keeps empty when I use a RT kernel, like this:

Code: Select all

GRUB_CMDLINE_LINUX="" 
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: How to run rtirq script when login to my pc?

Post by autostatic »

With a real-time kernel you don't need to set the threadirqs option, you don't have to add it to /etc/default/grub. It's not necessary because threaded IRQ's are enabled by default on a real-time kernel and it's exactly this part of the real-time patchset that has been merged with the mainline kernel as an optional feature.
Post Reply