Isolcpus...belongs where in Dietpi ...?

I did a bit of searching…found this, it may help
isolcpus is deprecated, kinda (codeblueprint.co.uk)

Doing a manpage, you might be able to setup a rc.local init script or something
Ubuntu Manpage: cset-shield - cpuset supercommand which implements cpu shielding

   # cset shield --cpu=1-3

   On a 4-way machine, this command will dedicate the first processor, CPU0, for the system
   set (unshielded) and the last three processors, CPU1, CPU2, CPU3, for the user set
   (shielded).

   The CPUSPEC will accept a comma separated list of CPUs and inclusive range specifications.
   For example, --cpu=1,3,5-7 will assign CPU1, CPU3, CPU5, CPU6, and CPU7 to the user (or
   shielded) cpuset and the inverse of that to the system (or unshielded) cpuset.

   If you do not like the names "system" and "user" for the unshielded and shielded sets
   respectively, or if those names are used already, then use the --sysset and --userset
   options.

stackoverflow even shows a bit more usage for that
performance - how to shield a cpu from the linux scheduler (prevent it scheduling threads onto that cpu)? - Stack Overflow

Thanks for the heads up,

But my question was not if I want to use isolcpus, but how to do it in Dietpi as there is a chain of start up events in Dietpi which are Dietpi specific.

I have read those articles as well before. I am not sure if that is the best way for my use case though: I have two CPUs with 4 cores each on my XU4. One CPU shall only be used for critical audio related processes and interrupts, so Network, USB and MPD itself. Each of them gets its own isolated core on the same physical CPU sharing the same cache

The other CPU with another 4 cores can handle with normal scheduler enabled all the other system tasks andapps like lighttpd, SSH etcetc.

So, the original provocated statement of that article “isolcpus is depreciated” I cant follow. Isolcpus does exectly what I want as my overall target is to minimize jitter and isolcpus works on that front very well:

@MichaIng can you have a look

I think I found it:
/boot/boot.ini
add isolcpus=3
to the # Kernel command-line parameters line Within " "

Just tested it, works like a charme…and the best is, that the dietpi-services CPU-affinity for a services works with it as well.

Sorry having asked such a beginners questions, but there are so many tutorials out there which are for other plattforms or other versions etc…I got a bit confused and could not find it.

Now, the next step would be:

Two Scripts which automated my manual settings:
Script “ISO”: Which changes the boot.ini and the dietpi-services Cpu-Affinity for MPD, Network and USB
Script “ORG”: Which basiacally brings all back to previsous defaults, so un-doing all the stuff of “ISO”.

I want to compare the audible effect of the settings change and it is important to do the easy and quick, other wise your brain is already confused and you hear stuff which is not there (psychoacoustical phenomen)…

…so any hints how to that are highly appreciated (I am obvisouly an enthusistic bloody beginner)

Completely independent of the DietPi-specific systemd services and boot order, this needs to be added to the kernel command-line. Where this can be edited is specific to the SBC, so no wonder that tutorials out there may not be helpful :wink:. The Odroid XU4 uses an older vendor kernel and bootloader, so /boot/boot.ini is correct there. On RPi it would be /boot/cmdline.txt, on other SBCs /boot/armbianEnv.txt or /boot/dietpiEnv.txt and on x86_64 /etc/dafault/grub + update-grub.

I just wanted to mention the per-process/service CPU affinity, but you found that already :slightly_smiling_face:.

Scripting the boot.ini change should be simple?
Scripting dietpi-services is not possible, since it has no CLI for those settings. But you can set the CPU affinities manually once, then check the files /etc/systemd/system/<name>.service.d/dietpi-process_tool.conf. Those contain the per-service systemd settings overrides created by dietpi-services. So you can script the creation of these config files/overrides. Without a reboot changes can be applied via:

systemctl daemon-reload # let systemd reread the systemd units/config files
systemctl restart <name> # restart the service called <name>
2 Likes

thanks a lot, I will try that…

I am now working on the C2 which has dietpiEnv.txt instead of boot.ini…

when i put isolcpus=3 in there, the boot takes 5 min and in the end nothing happened…

imlooked into boot.cmd and it looks like that the kernel commands are hardcoded, no ? so variables, but i cant see that a new command like isolcpus will be accepted…but i am not an experts in these kind of scripts.

What would be the right wqy of putting isolcpus into c2 then ? boot.cmd and recompile ?

Add it in dietpiEnv.txt to extraargs=, so that it looks like that:

extraargs=net.ifnames=0 isolcpus=3

With armbianEnv.txt it would be the same.

I tried that, unfortunately it does not work. Is there a specific order where to place it in dietpiEnv.txt?

What worked is to add it into the Kernel command string at the end in boot.cmd and recompile boot.scr

But…I would love to do it the right way as you suggested in dietpiEnv.txt

Your hint on the scripts for switching services affinities work like a charme…I can now switch back and fore in 2 sec to listen to the difference…and I will include the deidication of hardware IRQ to separate isolated cores as well, so we have eth0, USB (USB-DAC), and MPD sitting each on isolated cores and CPU0 for the housekeeping non-isolated

Please show:

grep extraargs /boot/dietpiEnv.txt /boot/boot.scr

I have no idea what it was this morning…but now it works as intended…thanks for holding my hand on this…(Vorführeffekt)…

1 Like

Great, a little simpler than via boot.scr recompiling :slightly_smiling_face:.

Let’s see: DeepL Translate: The world's most accurate translator
But the question is whether it is such a common term in English :slightly_smiling_face:.

Sorry, I tested further…it is not solved, it even worse than I thought:

I have had originally isolated as a test core 3 with boot.cmd and recompile. Got core 3 isolated.

Now, to be clean again:
I took all the isolcpus statements out of boot.cmd and recompiled. I took everything out of dietpiEnv.txt as well.

Unexpected Result:
We still have core 3 isolated now, no matter what i do (reboot, poweroff, take it from the PSU):

root@DietPi:~# cat /sys/devices/system/cpu/isolated
3
root@DietPi:~# grep extraargs /boot/dietpiEnv.txt /boot/boot.scr
/boot/dietpiEnv.txt:extraargs=net.ifnames=0
grep: /boot/boot.scr: binary file matches

So, I guess some with the compile from boot.cmd—>boot.scr goes wrong.

Even if I delete /rename boot.scr and create a complete new boot.scr, I still have core 3 isolated.

There is no isolcpus=3 at the extraargs line in /boot/dietpiEnv.txt. The hardcoded entry in /boot/boot.scr seems to be present. It has a binary header, so the grep output is expected.

Please try to remove isolcpus=3 from boot.cmd, then recompiled boot.scr, assure that isolcpus=3 is not within boot.scr (open with nano to be 100% sure), then add to /boot/dietpiEnv.txt the way I posted further above, and see whether this works as expected. You can also verify the current cmdline via:

cat /proc/cmdline

You are right, it is in the binary header of boot.scr.

It is no longer in boot.cmd…and I recompiled three times now…it stays in boot.scr…and I even deleted boot.scr before compiling…the compile always generates something else than what we have in boot.cmd

this is so screwed up…I will burn a new image on a highest quality sd-card to be sure that this is not a sd-card issue…

btw:

I get always the folowing error when starting on the C2 with a new image:

 Get:5 https://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]
│ Err:2 http://armbian.hosthatch.com/apt bullseye InRelease
│   Connection failed [IP: 2a01:6f0:ffff:5663::1 80]

and later:

APT update

│  - Command: apt-get -y update
│  - Exit code: 255
│  - DietPi version: v8.7.1 (MichaIng/master) | HW_MODEL: 12 | HW_ARCH: 3 |
│ DISTRO: 6
│  - Image creator: DietPi Core Team
│  - Pre-image: from scratch
│  - Error log:
│ Hit:1 https://deb.debian.org/debian bullseye InRelease
│ Hit:2 https://deb.debian.org/debian bullseye-updates InRelease
│ Hit:3 https://deb.debian.org/debian-security bullseye-security InRelease
│ Hit:4 https://deb.debian.org/debian bullseye-backports InRelease
│ Err:5 http://armbian.hosthatch.com/apt bullseye InRelease
│   Connection failed [IP: 2a01:6f0:ffff:5663::1 80]
│ Reading package lists...

and

APT upgrade

│  - Command: apt-get -y upgrade
│  - Exit code: 100
│  - DietPi version: v8.7.1 (MichaIng/master) | HW_MODEL: 12 | HW_ARCH: 3 |
│ DISTRO: 6
│  - Image creator: DietPi Core Team
│  - Pre-image: from scratch
│  - Error log:
│ Reading package lists...
│ Building dependency tree...
│ Reading state information...
│ Calculating upgrade...
│ The following packages will be upgraded:
│   armbian-firmware base-files curl dpkg libc-bin libc-l10n libc6 libcurl4
│   libgnutls30 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0

and later when doing a Samba connection to the NAS
APT update

│  - Command: apt-get -y update
│  - Exit code: 255
│  - DietPi version: v8.8.1 (MichaIng/master) | HW_MODEL: 12 | HW_ARCH: 3 |
│ DISTRO: 6
│  - Image creator: DietPi Core Team
│  - Pre-image: from scratch
│  - Error log:
│ Hit:1 https://deb.debian.org/debian bullseye InRelease
│ Hit:2 https://deb.debian.org/debian bullseye-updates InRelease
│ Hit:3 https://deb.debian.org/debian-security bullseye-security InRelease
│ Hit:4 https://deb.debian.org/debian bullseye-backports InRelease
│ Err:5 http://armbian.hosthatch.com/apt bullseye InRelease
│   Connection failed [IP: 2a01:6f0:ffff:5663::1 80]
│ Reading package lists...

Not sure if that might be the root cause as well…

That /apt/ index looks wrong, at least not default Armbian repository. Please show:

cat /etc/apt/sources.list.d/armbian.list

It should be:

deb http://apt.armbian.com/ bullseye main

hence no /apt/ path element. If this is a mirror, then obviously it isn’t reachable.
EDIT: Ah, I think it is the result of the mirror redirector. So then the mirror near you is down. Can you run apt update and show the full URL of the mirror?


Please verify:

grep 'isolcpus=3' /boot/boot.cmd

doesn’t generate any output and then nano /boot/boot.scr that it really does contain isolcpus=3 (in plain text area below the binary header, which is only a one-line hash). If so, please show the command you use to recompile it. Also try to do a reboot, verify that nano /boot/boot.cmd does still not contain isolcpus=3. If so, there is no chance that re-compiling boot.scr contains it, as long as you do really use /boot/boot.cmd as input.

I did used your statement above…I could not use a different one…as I can only do copy and paste…and yes, it was not in cmd, but still in scr…which is weird…I will now set the system new up and retry if the is reproducable

The URLs I will chcek in a moment…I am again installing now…but something is here fundamentally wrong as I cant SSH after reboot…no connection…connection only comes back afer I plugged the power.

http://armbian.hosthatch.com/apt/dists/bullseye/InRelease is down…

cat /etc/apt/sources.list.d/armbian.list
cat: /etc/apt/sources.list.d/armbian.list: No such file or directory

apt update

Hit:1 https://deb.debian.org/debian bullseye InRelease
Hit:2 https://deb.debian.org/debian bullseye-updates InRelease
Hit:3 https://deb.debian.org/debian-security bullseye-security InRelease
Hit:4 https://deb.debian.org/debian bullseye-backports InRelease
Err:5 http://armbian.hosthatch.com/apt bullseye InRelease
  Connection failed [IP: 2a01:6f0:ffff:5663::1 80]
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://apt.armbian.com/dists/bullseye/InRelease  Connection failed [IP: 2a01:6f0:ffff:5663::1 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

The good news: isolcpus in dietpiEnv.txt works now. The trick was to write it with one space into the first line and not into a new line…if now NOHZ_full would work as well, I would be in audio paradise…

to check all available apt source list do following

for i in /etc/apt/sources.list{,.d/*.list}; do echo "$i:"; cat "$i"; done

THX…I will…when I am back at home in 2 days…

This is what I tried to make clear here: Isolcpus...belongs where in Dietpi ...? - #8 by MichaIng
It needs to be added to the existing line.

Ah the file is /etc/apt/sources.list.d/dietpi-armbian.list, the mirror is chosen by the mirror director at apt.armbian.com. That particular mirror seems to be up again, at least I can access it here.

THX for the heads up…yes, I can now do the install without any errors…I guess I need to have a look into backup my sd-cards…in ordernot to be dependant if there servers are up and running…