KERNEL 6.6.7 (improved latency)

More
23 Dec 2023 08:28 - 07 Jan 2024 20:22 #288870 by Mecanix
### DEPs
$ sudo apt update && sudo apt upgrade 
$ sudo apt install -y build-essential bin86 libncurses5-dev pkg-config libssl-dev dwarves bison flex gnupg libelf-dev libssl-dev wget qtbase5-dev debhelper rsync git

### KERNEL 6.6.7
$ git clone -b v6.6 --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-6.6
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/patch-6.6.7.xz
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.6/patch-6.6.7-rt18.patch.xz

$ unxz patch-6.6.7.xz
$ unxz patch-6.6.7-rt18.patch.xz
$ cp patch-6.6.7 patch-6.6.7-rt18.patch linux-6.6
$ rm patch-6.6.7 patch-6.6.7-rt18.patch

$ cd linux-6.6
$ cat patch-6.6.7 | patch -p1 
$ cat patch-6.6.7-rt18.patch | patch -p1
 
$ git add *
$ make xconfig
(Save and Exit gui)

$ scripts/config --disable SYSTEM_REVOCATION_KEYS 
$ scripts/config --disable DEBUG_INFO 
$ scripts/config --enable DEBUG_INFO_NONE 
$ scripts/config --set-str SYSTEM_TRUSTED_KEYS "" 

$ make -j$(nproc) deb-pkg LOCALVERSION=-linuxcnc
(as per Rodw's advice for all cores. See below post.)

$ cd ..

### INSTALL
$ sudo dpkg -i linux-image-6.6.7-rt18-linuxcnc_6.6.7-gffc253263a13-1_amd64.deb
$ sudo dpkg -i linux-headers-6.6.7-rt18-linuxcnc_6.6.7-gffc253263a13-1_amd64.deb
$ sudo reboot


* Custom driver installations, if any, will require re-installation. 
** Compiling took 3.5hrs on a i7 3.2Ghz
Last edit: 07 Jan 2024 20:22 by Mecanix.

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

More
23 Dec 2023 10:06 #288879 by andypugh
Are you sating that this gives better latency than the pre-packaged 6.10-rt kernel?

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

More
23 Dec 2023 10:47 #288889 by rodw
Andy, yes, I expect so. Just compliling the kernel from pristine sources improves latency over the debian ones. ANd latency has been observed as improving with each iteration of the pristine RT patch.
@Mechanix, I7's can have  a lot more than for cores. Mine has 20. check with echo $(nproc)
Use make -j$(nproc) to use them all

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

More
23 Dec 2023 10:47 #288890 by Mecanix
Noticed a 30% enhancement over the turtle-slow pre-packed 6.10 on an older workstation (2 cores). That's powering a laser cutter and a 3ax mill, both still over parport and so I need all I can get. However on the i7 (8 cores) powering the 2ax lathe and a 4ax mill (gigabyte ethernets) not-so-much difference.
 

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

More
23 Dec 2023 10:49 #288891 by rodw
That answers my question. use make -j8 next time to save  a lot of time.
The following user(s) said Thank You: Mecanix

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

More
23 Dec 2023 11:35 - 23 Dec 2023 11:39 #288895 by Mecanix
@Rodw

Given your advanced knowledge (I think you're the author of this kernel compiling routine if I recall) you would certainly know how to tweak those linux box to the bones and nerves?? All dirty laundry on core 0, the remaining 7cores for the cookin. Any comments?

$ sudo nano /etc/default/grub
#GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX_DEFAULT="skew_tick=1 rcu_nocb_poll rcu_nocbs=1-7 nohz=on nohz_full=1-7 kthread_cpus=0 irqaffinity=0 isolcpus=managed_irq,domain,1-7 intel_pstate=disable nosoftlockup tsc=nowatchdog"
$ sudo update-grub
Last edit: 23 Dec 2023 11:39 by Mecanix.

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

More
23 Dec 2023 12:40 #288902 by rodw
yeh, I thought the script looked famiiar. Saved me the need to update it
I have not done much other than isolcpus. 
If you are using mesa ethernet cards latency is no longer the limiting factor. Network latency is the issue.
network latency has been improving with each kernel version.
With mesa, the next thing to look at is to locate the IRQ (Interrupt Request) used by the NIC.
set Isolcpus=7 wil put the servo thread on core 7
Then you can set the irq affinity to also be on core 7 so the Real time stuff is al together
This can be set on the command line and its  pretty easy to find resouces with google
The following user(s) said Thank You: Mecanix

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

More
23 Dec 2023 12:43 #288903 by rodw
I might add that the servo thread only ever runs on one core. Whilst latency improves with adding additional isolated CPUS, I suspect its eye candy.
htop shows cpu useage per kernel which is interesting to watch

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

More
23 Dec 2023 13:38 - 23 Dec 2023 13:39 #288907 by Mecanix
Maintaining 4 machine-tools, involving two different kind of interface (parport & eth), not to mention 3 different computers and hardware ain't for the faint of heart.  One day this will all need to be consolidated but until then it makes it all very much fun and for good learning! Appreciate the IRQ heads up, I'll focus on that part and see if I can optimize from there. 
Last edit: 23 Dec 2023 13:39 by Mecanix.

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

More
23 Dec 2023 15:14 #288918 by chris@cnc

That answers my question. use make -j8 next time to save  a lot of time.

make -j `nproc`
Is the command to use all available cores.

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

Time to create page: 0.087 seconds
Powered by Kunena Forum