IRQ affinity on PC Debian Bookworm

More
08 Nov 2023 14:05 #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
08 Nov 2023 14:13 #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
09 Nov 2023 10:34 #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
09 Nov 2023 16:07 - 09 Nov 2023 16:09 #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: 09 Nov 2023 16:09 by EricKeller.

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

More
09 Nov 2023 19:32 #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
09 Nov 2023 19:36 #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.

More
19 Nov 2023 14:17 #285898 by JohnnyCNC
I just found a Core i5 HP Compaq Pro 4300 I5-3470S CPU @ 2.9GHz 4 cores that provides good latency. But, I am having trouble with my USB Pendant disconnecting. Would playing with the IRQ to core assignment help with this?

 

 
Attachments:

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

More
19 Nov 2023 17:32 #285922 by tommylight
Probably not.
Try using USB2.0 or the black colored ones, not the blue ones.
A lot of cheap USB2.0 devices will have issues with USB3.0 and 3.1 ports, some USB3.0 sticks will switch back to 2.0 as soon as you start to copy something to/from.

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

More
19 Nov 2023 23:42 #285973 by JohnnyCNC
I'll give that a try.

Thanks

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

More
21 Nov 2023 00:25 #286121 by JohnnyCNC
All of the USB ports on this machine are black. I tried moving devices around and it seems to be better but not completely OK. I have a wireless keyboard/mouse dongle, Touch-screen connection, Vista P4-SE pendant, and a USB to Ethernet adapter. This PC had been sitting for a couple of years so I am going to exercise all of the connectors really well just in case they are dirty.

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

Time to create page: 0.103 seconds
Powered by Kunena Forum