ODROID-XU4 Tweaks: A Collection of Popular Modifications

Like many others, I’m interested in getting the most out of my ODROID-XU4. During the time I’ve used it, I found out several tweaks that improved the speed or decreased the power consumption. In this article I would like to share what I have learned. This article is an authorized translation of the german article “ODROID-XU4: Tweaks unter Ubuntu 18.04 und Kernel 4.14”. The original German article can be found here: https://blaumedia.com/blog/odroid-xu4-tweaks-unter-ubuntu-18-04-und-kernel-4-14/

Note: Any changes to your system can potentially void your warranty and negatively impact the system’s stability, so every change is made on your own responsibility.

CPU overclocking and benchmarks

Hardkernel advises against changing the CPU clock speed values of the ODROID-XU4, since it can cause stability and heat issues. To prevent the latter problem, I recommend swapping the stock fan, as described in my article here: https://blaumedia.com/blog/odroid-xu4-luefter-und-kuehlkoerper-austausch/. The general problem is thermal throttling, automatically underclocking the processor to decrease the chance of damaging the hardware. Unfortunately, stability problems are inevitably left out until you have put together a perfectly functioning setup.

By default the four little cores, these are the processor's economical ARM cores, and the four BIG cores, performance focused cores, are operated with a maximum clock speed of 1.5 GHz and 2.0 GHz respectively. I'll explain below how to customize and compile the kernel to use 1.6 GHz and 2.1 GHz as maximum clock speeds. I couldn't find any problems or crashes during my 1 week test phase and would describe it as stable.

To illustrate the performance increase I did a small benchmark with sysbench. Here are the first of the results (lower is better):

Core-Type Benchmark result without overclock Benchmark result with overclock Difference
little.cores 35.644 seconds 33.408 seconds -6.27%
BIG.cores 21.695 seconds 20.624 seconds -4.94%
Both 13.583 seconds 12.994 seconds -4.34%

As you can see, with an increase of only 0.1 GHz you get much better performance. Especially the little cores because their base clock is only 1.5 GHz. The terminal commands are:

little.cores

$ taskset -c 0,1,2,3 sysbench --test=cpu --num-threads=4 run
BIG.cores
$ taskset -c 4,5,6,7 sysbench --test=cpu --num-threads=4 run
both cores

$ sysbench --test=cpu --num-threads=8 run

All commands were executed three times and the average was taken from the results. Of course the CPU Governor was set to performance. But now enough for the benchmarks! How can the CPU be overclocked? Thanks to ridge's observations in the code of the kernel, he wrote a little tutorial, available here: https://forum.odroid.com/viewtopic.php?f=93&t=30115 From the manual I copied the needed code; just log in as root and copy the following script into your terminal. The compilation can take up to 30 minutes - so in the meantime get yourself a coffee and check your email.

# Last update: 27. July 2019

# Cloning Git Repo
cd /tmp
git clone --depth 1 https://github.com/hardkernel/linux -b odroidxu4-4.14.y
cd linux

# paste the new clock rates
sed -i 's/<1500000000>/<1600000000>/g' arch/arm/boot/dts/exynos5422-cpus.dtsi
sed -i 's/<2000000000>/<2100000000>/g' arch/arm/boot/dts/exynos5422-cpus.dtsi

sed -i '/&cluster_a15_opp_table {/a \
opp-2100000000 { \
opp-hz = /bits/ 64 <2100000000>; \
opp-microvolt = <1312500>; \
clock-latency-ns = <140000>; \
};' arch/arm/boot/dts/exynos5800.dtsi

sed -i '/&cluster_a7_opp_table {/a \
opp-1600000000 { \
opp-hz = /bits/ 64 <1600000000>; \
opp-microvolt = <1250000>; \
clock-latency-ns = <140000>; \
};' arch/arm/boot/dts/exynos5800.dtsi

sed -i '/PLL_35XX_RATE(2000000000, 250, 3, 0),/i \
PLL_35XX_RATE(2100000000, 175, 2, 0),' drivers/clk/samsung/clk-exynos5420.c

sed -i '/{ 2000000, E5420_EGL_DIV0(3, 7, 7, 4), },/i \
{ 2100000, E5420_EGL_DIV0(3, 7, 7, 4), },' drivers/clk/samsung/clk-exynos5420.c

sed -i '/{ 1500000, E5420_KFC_DIV(3, 5, 3), },/i \
{ 1550000, E5420_KFC_DIV(3, 5, 3), },' drivers/clk/samsung/clk-exynos5420.c

# compile kernel, readme: https://wiki.odroid.com/odroid-xu4/software/building_kernel#y
apt update && apt install -y git gcc g++ build-essential libssl-dev bc
make odroidxu4_defconfig
make -j8
make modules_install
cp -f arch/arm/boot/zImage /media/boot
cp -f arch/arm/boot/dts/exynos5422-odroidxu3.dtb /media/boot
cp -f arch/arm/boot/dts/exynos5422-odroidxu4.dtb /media/boot
cp -f arch/arm/boot/dts/exynos5422-odroidxu3-lite.dtb /media/boot
sync
When it’s done compiling, you can restart the ODROID-XU4 with the “reboot” command in your terminal. On startup, it’ll pick the new kernel and will use the newly defined clock rates.

RAM Overclocking and Benchmarks

The clock rate of RAM determines how high the data rate is set. Quite simply: the faster the clock rate, the higher the bandwidth. Hardkernel made it very easy to overclock the ODROID-XU4 RAM. By default it runs at 825 MHz and it is extremely easy to overclock it to 933 MHz. All you have to do is look for the line setenv ddr_freq 825 in /media/boot/boot.ini and replace the 825 with 933. Otherwise, I have the code ready for you again:

$ sed -i 's/setenv ddr_freq 825/setenv ddr_feq 933/' /media/boot/boot.ini
What improvements in performance can you expect? I have again carried out a small benchmark with sysbench. The following command was used:
$ sysbench --test=memory --memory-block-size=1K --memory-total-size=10G --num-threads=1 run
The total execution time improved from 10.733 seconds to 10.592 seconds - a change of -1.31%. In this case, everyone should decide for themselves whether to accept an increased power consumption for this "performance improvement". I, for my part, have enabled 933 MHz. The small ODROID-XU4 tweaks provide the good overall package 🙂

Improve IO Speed

Assign USB3.0 ports and Ethernet port to BIG.cores As the source for the following contribution a thank you to Obihoernchen and the blog post here: https://obihoernchen.net/1416/odroid-xu4-tune-network-and-usb-speed/ The following is from his blog post and was taken over by me for this post for ODROID-XU4 Tweaks. You should definitely have a look at his blog!

By default, tasks/events created by the Ethernet or USB ports (interrupts) are distributed to all cores. So it can happen that a little.core gets assigned the task to download 10 GB from the Internet, where a BIG.core could complete it in a much shorter time. To make sure that this is done by the BIG.cores in the future, you should make sure at the beginning that the service irqbalance is deactivated:

# systemctl disable irqbalance
Then we open the file /etc/rc.local and insert the following before the exit 0:

usb2

# echo 6 > /proc/irq/103/smp_affinity_list
usb3
#echo 5 > /proc/irq/104/smp_affinity_list
network (usb3)
#echo 4 > /proc/irq/105/smp_affinity_list
According to Obihoernchen's benchmarks, transfers were up to 100 Mbit (12.5 MB/s) faster. For me, this is now a standard setting.

Using UASP for USB 3.0 Hard Drives

This is a general tip and has no code example ready but, it is one of my favorite ODROID-XU4 tweaks. As described and tested in my article ODROID-XU4: SSD vs. eMMC comparison (Boost!), https://blaumedia.com/blog/odroid-xu4-ssd-vs-emmc-boost/ Back then, I could warmly recommend using an SSD with a SATA-to-USB adapter that supports UASP. Here again is a table from that article:

Type Read (Cache) Read (Direct) Write
eMMC 804.54 MB/s 155.44 MB/s 45.0 MB/s
SSD (without UASP) 890.57 MB/s 106.09 MB/s 125.00 MB/s
SSD (with UASP) 888.20 MB/s 343.56 MB/s 205.00 MB/s

The UASP adapters offer an enormous increase in performance.

Reducing power consumption

Many people certainly use the ODROID-XU4 as a small energy-saving home server - just like me. To reduce the power consumption in 24/7 operation a little, here are a few tips.

Disabling cpu cores

There is hardly any effort required to deactivate individual cores. But first you have to know that CPU0-CPU3 is your little.cores and CPU4-7 are your BIG.cores. Depending on which requirements you have on your ODROID-XU4, you should consider which cores to deactivate.

Replace the 0 at cpu0 with your wished core

# echo 0 > /sys/devices/system/cpu/cpu0/online

Downclocking GPU

Again the following tip comes from Obihoernchen's blog. This time it's about downclocking the GPU, the graphics processor of the ODROID-XU4. In pure server mode, it always runs at a maximum clock rate of 600 MHz; without being used. The Obihoernchen blog has also carried out measurements again and could probably achieve a power savings of about 20%!

To reach that benefit, you have to install the sysfsutils package with APT:

# apt update && apt install sysfsutils
Then we have to add the following in /etc/sysfs.conf depending on your kernel (with uname -a you can find out which one you started):

if kernel 3.10 then insert following:

# devices/11800000.mali/dvfs_max_lock = 177
if kernel 4.9 then insert following:
# devices/platform/11800000.mali\:/devfreq/11800000.mali\:/governor = powersave
if kernel 4.14 then insert following:
# devices/platform/11800000.mali/devfreq/devfreq0/governor = powersave
With a final “systemctl restart sysfsutils” the lower clocking is active.

Be the first to comment

Leave a Reply