Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odroid N2 | FIFO and Round Robin CPU scheduling policy not supported #5693

Open
scetu opened this issue Aug 19, 2022 · 7 comments
Open

Odroid N2 | FIFO and Round Robin CPU scheduling policy not supported #5693

scetu opened this issue Aug 19, 2022 · 7 comments
Labels
External bug 🐞 For bugs which are not caused by DietPi. Kernel related 🧬 Odroid N2

Comments

@scetu
Copy link

scetu commented Aug 19, 2022

Creating a bug report/issue

Required Information

  • DietPi version | cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=7
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
G_LIVE_PATCH_STATUS[0]='not applicable'
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bullseye
  • Kernel version | uname -a
    Linux odroid 5.10.123-meson64 #22.05.3 SMP PREEMPT Wed Jun 22 07:23:04 UTC 2022 aarch64 GNU/Linux
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    Odroid N2 (aarch64)
  • Power supply used | (EG: 5V 1A RAVpower)
    12V A2
  • SD card used | (EG: SanDisk ultra)
    EEMC 64GB

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
    Docker
  • Was the software title installed freshly or updated/migrated?
    freshly installed today
  • Can this issue be replicated on a fresh installation of DietPi?
    Most probably yes
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

  1. Install Docker from dietpi-software
  2. Go to dietpi-services and try to apply predefined Highest priority
  3. image
  4. After service restart services fails to load
    image

Expected behaviour

  • Service should eb started and preset applied

Actual behaviour

  • described in "Steps to reproduce"

Extra details

  • This preset is working on RPi 4B, but not on Odroid N2+
  • High Priority preset works and service can start
  • There were other minor errors which I saw today on Odroid N2+ for the first time after getting it in addition to my Raspberry Pis, also related to Docker, so maybe it is upstream error
@Joulinar
Copy link
Collaborator

Can you reboot your system and share following

journalctl -u docker. Service

@scetu
Copy link
Author

scetu commented Aug 20, 2022

Highest priority
image

after reboot...

root@odroid:~# journalctl -u docker
-- Journal begins at Sat 2022-08-20 15:12:30 CEST, ends at Sat 2022-08-20 15:13:02 CEST. --
Aug 20 15:12:38 odroid systemd[2087]: docker.service: Failed to set up CPU scheduling: Operation not permitted
Aug 20 15:12:38 odroid systemd[1]: Started Docker Application Container Engine.
Aug 20 15:12:38 odroid systemd[2087]: docker.service: Failed at step SETSCHEDULER spawning /usr/bin/dockerd: Operation not permitted
Aug 20 15:12:38 odroid systemd[1]: docker.service: Main process exited, code=exited, status=214/SETSCHEDULER
Aug 20 15:12:38 odroid systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 20 15:12:40 odroid systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.
Aug 20 15:12:40 odroid systemd[1]: Stopped Docker Application Container Engine.
Aug 20 15:12:40 odroid systemd[2108]: docker.service: Failed to set up CPU scheduling: Operation not permitted
Aug 20 15:12:40 odroid systemd[2108]: docker.service: Failed at step SETSCHEDULER spawning /usr/bin/dockerd: Operation not permitted
Aug 20 15:12:40 odroid systemd[1]: Started Docker Application Container Engine.
Aug 20 15:12:40 odroid systemd[1]: docker.service: Main process exited, code=exited, status=214/SETSCHEDULER
Aug 20 15:12:40 odroid systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 20 15:12:42 odroid systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.
Aug 20 15:12:42 odroid systemd[1]: Stopped Docker Application Container Engine.
Aug 20 15:12:42 odroid systemd[2111]: docker.service: Failed to set up CPU scheduling: Operation not permitted
Aug 20 15:12:42 odroid systemd[2111]: docker.service: Failed at step SETSCHEDULER spawning /usr/bin/dockerd: Operation not permitted
Aug 20 15:12:42 odroid systemd[1]: Started Docker Application Container Engine.
Aug 20 15:12:42 odroid systemd[1]: docker.service: Main process exited, code=exited, status=214/SETSCHEDULER
Aug 20 15:12:42 odroid systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 20 15:12:44 odroid systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Aug 20 15:12:44 odroid systemd[1]: Stopped Docker Application Container Engine.
Aug 20 15:12:44 odroid systemd[1]: docker.service: Start request repeated too quickly.
Aug 20 15:12:44 odroid systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 20 15:12:44 odroid systemd[1]: Failed to start Docker Application Container Engine.

High priority
image

Aug 20 15:15:58 odroid systemd[1]: Started Docker Application Container Engine.

@Joulinar
Copy link
Collaborator

Joulinar commented Aug 20, 2022

looks like Docker don't like to have CPU scheduling set

Aug 20 15:12:42 odroid systemd[2111]: docker.service: Failed to set up CPU scheduling: Operation not permitted
Aug 20 15:12:42 odroid systemd[2111]: docker.service: Failed at step SETSCHEDULER spawning /usr/bin/dockerd: Operation not permitted

@MichaIng
Copy link
Owner

I guess it's the CPU scheduling class which is the issue. And to be true, giving the whole Docker engine realtime is probably dangerous, as there are a lot of low priority processes included, the engine itself and the wrapping container system services, like probably logging as such things.

However, it seems to be a kernel flag which causes this in combination with systemd: https://stackoverflow.com/questions/34018956/sched-setscheduler-error-eperm-after-installing-libpam-systemd

We need to replicate this is a simple dummy service.

@MichaIng
Copy link
Owner

While it is not what I'd recommend, I just tested the highest possible CPU and I/O classes and priorities (as well as the "Highest Priority" preset) on Docker on VM and there it works without issues:

root@VM-Bullseye:~# cat /etc/systemd/system/docker.service.d/dietpi-process_tool.conf
# WARNING: Do not manually edit this file, use "dietpi-services" to adjust values!
[Service]
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=99
IOSchedulingClass=realtime
IOSchedulingPriority=0
...
root@VM-Bullseye:~# cat /etc/systemd/system/docker.service.d/dietpi-process_tool.conf
# WARNING: Do not manually edit this file, use "dietpi-services" to adjust values!
[Service]
CPUSchedulingPolicy=fifo
IOSchedulingClass=realtime
CPUSchedulingPriority=50

Probably a limitation of the Odroid N2 kernel? Needs further testing.

@scetu
Copy link
Author

scetu commented Sep 19, 2022

Unfortunately, I have only one Odroid N2 and it is already in production use with "High priority" preset applied. Maybe somebody else could help with testing of these tweaks.

@MichaIng MichaIng added this to the v8.12 milestone Dec 4, 2022
@MichaIng MichaIng modified the milestones: v8.12, v8.13 Dec 18, 2022
@MichaIng MichaIng changed the title Cannot apply preset priority to docker service Odroid N2 | FIFO and Round Robin CPU scheduling policy not supported Jan 14, 2023
@MichaIng MichaIng added External bug 🐞 For bugs which are not caused by DietPi. Kernel related 🧬 and removed Investigating 🤔 labels Jan 14, 2023
@MichaIng
Copy link
Owner

Verified: FIFO and Round Robin are both generally not permitted on Odroid N2 for whatever reason. On x86_64 VMs and Raspberry Pi it works without issues:

root@OdroidN2:~# chrt -f --pid 1 5094
chrt: failed to set pid 5094's policy: Operation not permitted
root@OdroidN2:~# chrt -r --pid 1 5094
chrt: failed to set pid 5094's policy: Operation not permitted
root@OdroidN2:~# chrt -o --pid 0 5094
root@OdroidN2:~#

Must be a kernel limitation. I'll test this on some other SBCs tomorrow.

@MichaIng MichaIng modified the milestones: v8.13, v8.14 Jan 15, 2023
@MichaIng MichaIng modified the milestones: v8.14, v8.15 Feb 11, 2023
@MichaIng MichaIng removed this from the v8.15 milestone Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External bug 🐞 For bugs which are not caused by DietPi. Kernel related 🧬 Odroid N2
Projects
None yet
Development

No branches or pull requests

3 participants