# R7800 cpu scaling unnecessary?

Based on some excellent feedback from @moeller0 on this thread here , from the testing I've done it seems the R7800 is uncessarily slowing itself down.

If I set the min frequency scaling for core0 and 1 to this:

``````cat 1725000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
cat 1725000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
``````

Latency appears to be quite a bit more consistent, with no apparent negative downsides. (I was expecting to see temperatures increase when cpu frequencies were locked to the max, but they do not seem to be correlated.)

The only thing that does seem to correlate with rises in temperature is cpu usage and/or system load. Without any rise in temperature, I'm assuming theres no

So I guess my question is, is there any benefit to allowing the cpu scaling to throttle all the way down to 384MHz ?

I notice this as well even with schedutil governor.
Maybe try setting scaling_min_freq to the one only higher than 384Mhz?

I’ve tried all the different frequencies, but only 1.7ghz seemed to provide a noticeabley more stable latency with sqm. (If I’m being completely honest, there’s not much difference, but it is there)

The most striking thing out of all this is that there doesn’t appear to be any obvious benefit why frequencies scaled down exists - at least for the R7800. I’d be very interested if anyone else has done any similar tests.

Did you measure power consumption?

Side note - is building that as simple as adding `CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y` to `target/linux/ipq806x/config-5.4`?

Any suggestions how to do that? I didn’t find any obvious hooks under /sys filesystem

You will find some explanations in the comments in QSDK

https://source.codeaurora.org/quic/qsdk/oss/system/openwrt/tree/target/linux/ipq806x/base-files/etc/init.d/powerctl?h=NHSS.QSDK.6.1.r1

``````	# Change the minimum operating frequency for CPU0.
# This is required for cases where large amount of network traffic is sent
# instantaneously  without any ramp-up time , when CPU is at minimum perf level.
# At 384 MHz, CPU0 stays fully busy in softirq context and doesn't move to ksoftirqd, and
# doesn't give any other thread including cpufreq thread a chance to run.
# Hence, the CPU frequency is locked up at 384MHz till the traffic is stopped.
# Increasing the min frequency for CPU0 to 800 MHz (L2=1GHz), allows 4 Gbps instantaneous
# traffic without any hangs/lockups.
#
# CPU1 min frequency also has to be increased because there is a hardware constraint
# kraits cannot operate at 384MHz when L2 is at 1GHz.
``````
1 Like

Yes. I also added `CONFIG_ARM_CPU_TOPOLOGY=y` and `CONFIG_SCHED_MC=y`.

I am concerned about manually editing the kernel config... perhaps one needs to untar the kernel source on the target hardware, then copy `target/linux/ipq806x/config-5.4` to `.config` and run `make menuconfig` on the R7800 to get a natively produced `.confg`?

make kernel_menuconfig is he way to change kernel configuration.

Doing that will change the default config even if you didn't select anything in the menu

Yes, but did you look at the changes? Is it possible that they are meaningless or alternatively are simply missed because the config did not keep up with the kernel?

This is interesting..

``````make kernel_menuconfig CONFIG_TARGET=generic
<<< write out and save without modifying anything >>>
``````

That lead to quite a few changes to `target/linux/ipq806x/config-5.4` ... I guess that means the upstream kernel code dictated these? A few additions that took me by surprise are:

``````+CONFIG_ETHERNET_PACKET_MANGLE=y
+CONFIG_GRO_CELLS=y
+CONFIG_HZ=100
+CONFIG_HZ_100=y
``````

Complete diff:

``````diff --git a/target/linux/ipq806x/config-5.4 b/target/linux/ipq806x/config-5.4
index c9668da356..f5b2f34001 100644
--- a/target/linux/ipq806x/config-5.4
+++ b/target/linux/ipq806x/config-5.4
@@ -49,7 +49,6 @@ CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ARCH_TIMER=y
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
-# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE=y
CONFIG_ARM_CPUIDLE=y
@@ -59,7 +58,6 @@ CONFIG_ARM_GIC=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_ARM_L1_CACHE_SHIFT=6
CONFIG_ARM_L1_CACHE_SHIFT_6=y
-# CONFIG_ARM_LPAE is not set
CONFIG_ARM_MODULE_PLTS=y
CONFIG_ARM_PATCH_IDIV=y
CONFIG_ARM_PATCH_PHYS_VIRT=y
@@ -67,9 +65,7 @@ CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_ARM_QCOM_CPUFREQ_NVMEM=y
CONFIG_ARM_QCOM_CPUIDLE=y
# CONFIG_ARM_SMMU is not set
-# CONFIG_ARM_SP805_WATCHDOG is not set
CONFIG_ARM_THUMB=y
-# CONFIG_ARM_THUMBEE is not set
CONFIG_ARM_UNWIND=y
CONFIG_ARM_VIRT_EXT=y
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
@@ -89,8 +85,6 @@ CONFIG_CPUFREQ_DT_PLATDEV=y
CONFIG_CPU_32v6K=y
CONFIG_CPU_32v7=y
CONFIG_CPU_ABRT_EV7=y
-# CONFIG_CPU_BIG_ENDIAN is not set
-# CONFIG_CPU_BPREDICT_DISABLE is not set
CONFIG_CPU_CACHE_V7=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_COPY_V6=y
@@ -108,8 +102,6 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_HAS_ASID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-# CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND is not set
CONFIG_CPU_IDLE=y
@@ -151,7 +143,6 @@ CONFIG_CRYPTO_ZSTD=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_GPIO=y
CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_USER is not set
CONFIG_DMA_ENGINE=y
CONFIG_DMA_OF=y
@@ -159,13 +150,13 @@ CONFIG_DMA_REMAP=y
CONFIG_DMA_VIRTUAL_CHANNELS=y
CONFIG_DTC=y
CONFIG_DT_IDLE_STATES=y
-# CONFIG_DWMAC_DWC_QOS_ETH is not set
# CONFIG_DWMAC_GENERIC is not set
CONFIG_DWMAC_IPQ806X=y
# CONFIG_DWMAC_QCOM_ETHQOS is not set
CONFIG_DYNAMIC_DEBUG=y
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
+CONFIG_ETHERNET_PACKET_MANGLE=y
CONFIG_FIXED_PHY=y
CONFIG_FIX_EARLYCON_MEM=y
@@ -195,6 +186,7 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_SYSFS=y
+CONFIG_GRO_CELLS=y
CONFIG_HANDLE_DOMAIN_IRQ=y
CONFIG_HARDEN_BRANCH_PREDICTOR=y
CONFIG_HARDIRQS_SW_RESEND=y
@@ -249,6 +241,8 @@ CONFIG_HWMON=y
CONFIG_HWSPINLOCK=y
CONFIG_HWSPINLOCK_QCOM=y
CONFIG_HW_RANDOM=y
+CONFIG_HZ=100
+CONFIG_HZ_100=y
CONFIG_HZ_FIXED=0
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
@@ -273,7 +267,6 @@ CONFIG_KPSS_XCC=y
CONFIG_KRAITCC=y
CONFIG_KRAIT_CLOCKS=y
CONFIG_KRAIT_L2_ACCESSORS=y
-CONFIG_LEDS_TRIGGER_DISK=y
CONFIG_LIBFDT=y
CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_LOCK_SPIN_ON_OWNER=y
@@ -365,7 +358,6 @@ CONFIG_PAGE_POOL=y
CONFIG_PCI=y
CONFIG_PCIEAER=y
CONFIG_PCIEPORTBUS=y
-# CONFIG_PCIE_BW is not set
CONFIG_PCIE_DW=y
CONFIG_PCIE_DW_HOST=y
CONFIG_PCIE_QCOM=y
@@ -406,6 +398,7 @@ CONFIG_PINCTRL_MSM=y
# CONFIG_PINCTRL_SDM660 is not set
# CONFIG_PINCTRL_SDM845 is not set
# CONFIG_PINCTRL_SM8150 is not set
+CONFIG_PLUGIN_HOSTCC="g++"
CONFIG_PM_OPP=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_MSM=y
@@ -460,6 +453,7 @@ CONFIG_RFS_ACCEL=y
CONFIG_RPS=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_I2C_AND_SPI=y
+CONFIG_RTC_MC146818_LIB=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
# CONFIG_SDM_CAMCC_845 is not set
# CONFIG_SDM_DISPCC_845 is not set
@@ -469,7 +463,6 @@ CONFIG_RWSEM_SPIN_ON_OWNER=y
# CONFIG_SDM_LPASSCC_845 is not set
# CONFIG_SDM_VIDEOCC_845 is not set
CONFIG_SERIAL_8250_FSL=y
-# CONFIG_SERIAL_AMBA_PL011 is not set
CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_MSM=y
CONFIG_SERIAL_MSM_CONSOLE=y
@@ -500,7 +493,6 @@ CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
CONFIG_THERMAL_GOV_STEP_WISE=y
CONFIG_THERMAL_HWMON=y
CONFIG_THERMAL_OF=y
-# CONFIG_THUMB2_KERNEL is not set
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_TIMER_OF=y
CONFIG_TIMER_PROBE=y
@@ -514,10 +506,8 @@ CONFIG_UBIFS_FS_ZSTD=y
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
CONFIG_UNWINDER_ARM=y
-# CONFIG_UNWINDER_FRAME_POINTER is not set
CONFIG_USB=y
CONFIG_USB_COMMON=y
-# CONFIG_USB_EHCI_HCD is not set
CONFIG_USB_SUPPORT=y
CONFIG_USE_OF=y
CONFIG_VDSO=y
``````

Those changes are for multiple reasons.
First is because OpenWrt generic config added some new symbols or in this case they removed the hardcoded HZ value and now the upstream default is used.
Second is in case that in point release bump new symbols were introduced to the kernel.

So when you do make kernel_menuconfig you will refresh the kernel config to take both of those cases, this is normal and expected.
You will often see this if the config was not refreshed for a while like in IPQ806x case.

Please use make kernel_menuconfig to enable or disable any symbols as that way you are sure that all dependecies are included as well as that kernel config ordering is not broken

2 Likes