Latency, error finishing read, and IRQ affinity

More
2 years 8 months ago #293024 by Mecanix

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.

More
2 years 8 months ago #293025 by rodw

Made this sticky, thank you.
If this is stickied now, is this the right section? It might be better in Installing linuxcnc

Please Log in to join the conversation.

More
2 years 8 months ago #293026 by Mecanix

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.
 
(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. 

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.

More
2 years 8 months ago #293033 by tommylight

If this is stickied now, is this the right section? It might be better in Installing linuxcnc
That or "driver boards", what would be more appropriate?

Please Log in to join the conversation.

More
2 years 8 months ago #293035 by cmorley
Should probably be added to official docs..

Please Log in to join the conversation.

More
2 years 8 months ago #293049 by mozmck
Here is a script which will do the following:
  1. Set up isolcpus and a couple of other kernel arguments
  2. Run update-grub
  3. Create the IRQ affinity policy script for irqbalance
  4. 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
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.

Please Log in to join the conversation.

More
2 years 8 months ago #293261 by Ekholm
 

Attachment not found


I got the error in the picture. can't find folder

Please Log in to join the conversation.

More
2 years 8 months ago #293264 by Mecanix

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.

More
2 years 8 months ago #293267 by mozmck
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?

Please Log in to join the conversation.

More
2 years 8 months ago #293295 by hmnijp

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"
 
quotes seem to be missing here?  ($2 == 10.10.10.1) →→→ ($2 == "10.10.10.1")

Please Log in to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum