IRQ affinity on PC Debian Bookworm

More
2 years 11 months ago #284869 by EricKeller
I had trouble setting the irq affinity of my hm2/ethernet card so it was handled by one of the cores controlled by lcnc.  PCW helped me get it to work, I had given up too early in my previous efforts.  It's simple to do at the command line. I still haven't gotten a script to change it.  It would be nice to have a script, because it would be better to keep other irq handlers off the lcnc cpus.

Here are my notes:
Look at /proc/interrupts to see what interrupt your device is on.
Ethernet on my dell optiplex is enp0s31f6 on irq 130
So to set irq 130 to cpu 3 use the following:
sudo -i echo “8” /proc/irq/130/smp_affinity 
You have to use sudo -i or be logged in as root.
The "8" is a bitmask. On my computer, the bitmask is usually "f" to allow any of the 4 processors. If you mistakenly set it to zero, it gets ignored.
If you have more than 4 processors, there will be more digits in the mask.
Kernel.org article about this: docs.kernel.org/core-api/irq/irq-affinity.html

It can be set at boot time  www.kernel.org/doc/html/v4.19/admin-guid...rnel-parameters.html

Next task is to look into how irq balancing is done.  For lcnc, balancing is bad.

If anyone has a script to do this, it would be great if you could post it.
 

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #284870 by EricKeller
I'm thinking about trying the kernel command line "acpi_irq_nobalance"
I think that puts all the irqs on cpu0
Then moving the ethernet irq to cpu3

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #284930 by rodw
I thought that CPU 0 was the default thread everything gets thrown onto. It therefore should be preferred to move the servo thread and the ethernet IRQ onto another CPU but keep them together.  eg. CPU 3

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago - 2 years 11 months ago #284949 by EricKeller
It's my understanding is that acpi balances the irqs across all the cpus. That's what I see on my systems. I haven't tried "nobalance" yet, but I expect that will leave everything on cpu0, which I understand is the default behavior for intel (pc?) systems

The servo thread itself doesn't have a irq, there must be a timer lcnc uses that does? Not sure which one to move.
Last edit: 2 years 11 months ago by EricKeller.

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #284963 by rodw
Correct, IRQ (Interrupt Requests) relate to  hardware which linuxcnc isnt. eg its the hardware requesting the kernel to allocate some CPU time.
Back in the DOS days, you would chain a task onto the timer interrupt but now you create a thread (which is just a timer based  process)
from  memory, there is a task called something like rtapiapp which is the servo thread that shows up on a kernel trace. if you use isolcpus=3, the RT thread will be isolated to that core.

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #284964 by EricKeller
right, the task runs on the isolated core. But it seems like it's started a timer irq handler, which may not have a moveable irq. If it is movable, it should be on an isolated core. There are extra timers on the intel architecture, but they usually aren't used for various reasons.

Please Log in or Create an account to join the conversation.

Time to create page: 0.176 seconds
Powered by Kunena Forum