Skip to content

Conversation

@clopez
Copy link

@clopez clopez commented Dec 18, 2023

  • The defconfigs from the RPi Kernel set powersave as the default CPU governor, which is a bad idea as that reduces performance by setting the CPU frequency to the minimum one.

  • In case of a buildroot build user-space is not configured by default to change the CPU governor, so powersave will remain the CPU governor and it will slow down everything.

  • This patch unsets the selection of powersave as the default CPU governor.

  • Then the CPU governor that will be selected as default after this patch will be the Linux's default one that is either one of: ondemand, schedutil or performance depending on the Kernel version and the hardware. For modern Kernels (>v5.6) schedutil is the one preferred for ARM hardware. See Linux Kernel commit: https://git.kernel.org/linus/f259eab3ea0e7e

  • This patch was submitted upstream (both to the RPi kernel defconfigs and to upstream buildroot but was not accepted). See: https://lists.buildroot.org/pipermail/buildroot/2023-October/677641.html and configs: stop defaulting to the powersave governor raspberrypi/linux#5666

  • This PR already updates all RPi defconfigs, but in the future if new defconfigs are added for RPi boards then this command can be used to automate updating them:

for f in configs/raspberrypi*_defconfig; do
  if ! grep -q "board/raspberrypi/default-cpu-governor.fragment" "$f"; then
    sed -i 's,BR2_LINUX_KERNEL=y,BR2_LINUX_KERNEL=y\nBR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/raspberrypi/default-cpu-governor.fragment",' "$f"
  fi
done

* The defconfigs from the RPi Kernel set `powersave` as the default
  CPU governor, which is a bad idea as that reduces performance by
  setting the CPU frequency to the minimum one.

* In case of a buildroot build user-space is not configured by default
  to change the CPU governor, so `powersave` will remain the CPU
  governor and it will slow down everything.

* This patch unsets the selection of `powersave` as the default CPU
  governor.

* Then the CPU governor that will be selected as default after this
  patch will be the Linux's default one that is either one of:
  `ondemand`, `schedutil` or `performance` depending on the Kernel
  version and the hardware. For modern Kernels (>v5.6) `schedutil`
  is the one preferred for ARM hardware. See Linux Kernel commit:
  https://git.kernel.org/linus/f259eab3ea0e7e

* This patch was submitted upstream (both to the RPi kernel defconfigs
  and to upstream buildroot but was not accepted). See:
  https://lists.buildroot.org/pipermail/buildroot/2023-October/677641.html
  and raspberrypi/linux#5666

* In oder to update all the defconfigs this command can be used:

  for f in configs/raspberrypi*_defconfig; do
    if ! grep -q "board/raspberrypi/default-cpu-governor.fragment" "$f"; then
      sed -i 's,BR2_LINUX_KERNEL=y,BR2_LINUX_KERNEL=y\nBR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/raspberrypi/default-cpu-governor.fragment",' "$f"
    fi
  done
@clopez clopez requested a review from magomez December 18, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant