- Posts: 447
- Thank you received: 0
Latency, error finishing read, and IRQ affinity
2 years 8 months ago #293024
by Mecanix
Ah. You actually did mentioned, missed it, sry.
What's the required voodoo to verify/debug besides $ watch -n1 -d cat /proc/interrupts ?
Replied by Mecanix on topic Latency, error finishing read, and IRQ affinity
It should be run from /etc/rc.local and not as a policyscript for irqbalance.
Ah. You actually did mentioned, missed it, sry.
Code:
$ sudo nano /etc/default/grub
#GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX_DEFAULT="quiet isolcpus=1"
$ sudo update-grub
$ sudo nano /etc/rc.local
-----------------------------------------------------
#!/bin/sh -e
#
# IRQ Affinity by mozmck
sh '/etc/irqbalance.d/lcnc_irqpolicy.sh'
exit 0
-----------------------------------------------------
$ sudo chmod +x /etc/rc.local
$ sudo systemctl daemon-reload
$ sudo systemctl status rc-local
What's the required voodoo to verify/debug besides $ watch -n1 -d cat /proc/interrupts ?
Please Log in to join the conversation.
2 years 8 months ago #293025
by rodw
Replied by rodw on topic Latency, error finishing read, and IRQ affinity
If this is stickied now, is this the right section? It might be better in Installing linuxcncMade this sticky, thank you.
Please Log in to join the conversation.
2 years 8 months ago #293026
by Mecanix
One thing for sure, this hack works flawlessly for =>4 cores cpus. Remarkable enhancement I'd like to add. Recommend!!!
Replied by Mecanix on topic Latency, error finishing read, and IRQ affinity
(my take:) I wouldn't bother spending time on those expired dual-core dinosaurs, @mozmck. As soon as you "isolcpus=1" this in grub you instantly lose irqbalance. The service won't even start regardless if the script is ran from a policy or by using rc.local custom/adapted script from rc.local.I haven't tested it myself yet, but I know I have a dual-core or two around here that I can try it on. Probably be next week or so before I can find time to do that.
One thing for sure, this hack works flawlessly for =>4 cores cpus. Remarkable enhancement I'd like to add. Recommend!!!
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
Less
More
- Posts: 22007
- Thank you received: 3
2 years 8 months ago #293033
by tommylight
Replied by tommylight on topic Latency, error finishing read, and IRQ affinity
That or "driver boards", what would be more appropriate?If this is stickied now, is this the right section? It might be better in Installing linuxcnc
Please Log in to join the conversation.
2 years 8 months ago #293035
by cmorley
Replied by cmorley on topic Latency, error finishing read, and IRQ affinity
Should probably be added to official docs..
Please Log in to join the conversation.
2 years 8 months ago #293049
by mozmck
Replied by mozmck on topic Latency, error finishing read, and IRQ affinity
Here is a script which will do the following:
There are a few kernel options that *might* be helpful in reducing latency that can be enabled by uncommenting the relevant sections.
There are a couple of lines at the end which disable syncing the system clock to internet time servers. This syncing has in the past been one cause of realtime errors. This might should be made default???
To use, save the script as "rt_setup", make it executable, and run it with sudo because it needs root privileges.
Then you'll need to reboot the PC.
One improvement would be to detect dual-core systems or ones without irqbalance and do something different for the IRQ affinity.
****** UPDATE ******
I updated this script and moved it to the first post in this thread.
- Set up isolcpus and a couple of other kernel arguments
- Run update-grub
- Create the IRQ affinity policy script for irqbalance
- Set up irqbalance to use the script.
There are a few kernel options that *might* be helpful in reducing latency that can be enabled by uncommenting the relevant sections.
There are a couple of lines at the end which disable syncing the system clock to internet time servers. This syncing has in the past been one cause of realtime errors. This might should be made default???
To use, save the script as "rt_setup", make it executable, and run it with sudo because it needs root privileges.
Code:
sudo ./rt_setup
One improvement would be to detect dual-core systems or ones without irqbalance and do something different for the IRQ affinity.
****** UPDATE ******
I updated this script and moved it to the first post in this thread.
Please Log in to join the conversation.
2 years 8 months ago #293261
by Ekholm
I got the error in the picture. can't find folder
Replied by Ekholm on topic Latency, error finishing read, and IRQ affinity
Attachment not found
I got the error in the picture. can't find folder
Please Log in to join the conversation.
2 years 8 months ago #293264
by Mecanix
Replied by Mecanix on topic Latency, error finishing read, and IRQ affinity
I got the error in the picture. can't find folder
Code:
$ sudo apt update && sudo apt upgrade
$ sudo apt install irqbalance
$ sudo ./rt_setup
Please Log in to join the conversation.
2 years 8 months ago #293267
by mozmck
Replied by mozmck on topic Latency, error finishing read, and IRQ affinity
Is irqbalance installed? - Oops, should have refreshed the page before sending. I don't know where else the config file for irqbalance would be than /etc/default
What linux distribution are you running?
What linux distribution are you running?
Please Log in to join the conversation.
2 years 8 months ago #293295
by hmnijp
Replied by hmnijp on topic Latency, error finishing read, and IRQ affinity
quotes seem to be missing here? ($2 == 10.10.10.1) →→→ ($2 == "10.10.10.1")Something like this should work:
Code:#!/bin/bash MASK=$( printf "%X" $((1<<`lscpu -e=CPU | tail -1`)) ) NIC=`awk 'BEGIN{nic=""} {if ($1=="iface") {tmpnic = $2} if ($1=="address") {if ($2 == 10.10.10.1) {nic = tmpnic}}} END{print(nic)}' /etc/network/interfaces` if [ "$NIC" != "" ]; then grep $NIC /proc/interrupts | cut -d ":" -f 1 | while read -r IRQ; do echo $MASK > /proc/irq/$IRQ/smp_affinity done fi exit 0"
Please Log in to join the conversation.
Time to create page: 0.080 seconds
