[Khadas WiP] VIM4 NVMe IO Errors

I tried that before posting yesterday but the ondemand directory doesn’t exist anywhere in that structure

I guess cat /sys/devices/system/cpu/cpufreq/policy4/scaling_governor will show schedutil and /etc/default/cpufrequtils doesn’t exist?

khadas@Khadas:~$ cat /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
performance
khadas@Khadas:~$ cat /etc/default/cpufrequtils 
# WARNING: this file will be replaced on board support package upgrade
ENABLE=true
MIN_SPEED=500000
MAX_SPEED=2208000
GOVERNOR=conservative
khadas@Khadas:~$ 

Thank you! Both settings make no sense. So there’s cpufreq-utils installed and configured for ‘conservative’ (keeping the CPU clockspeeds at 500 MHz) while whatever other script sets cpufreq governor to performance wasting all the time energy.

At least what Khadas copied over from my script code to their fenix-hardware-optimization script can not work this way and probably never worked.

The best setting would be ondemand with io_is_busy since resulting in lower idle consumption and best storage performance at the same time: rockchip_linux_defconfig: use the CPUFreq governor 'ondemand' as default · radxa/kernel@55f540c · GitHub (the comments there).

And on Amlogic platforms with their reported instabilities related to cpufreq scaling most probably setting lowest cpufreq to 1000 MHz would be smart as well. Does a cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies show values lower than 1000000?

Would be interesting to get the DVFS OPP tables for A311D2/VIM4. Could be done by running sbc-bench and exporting MODE=extensive before running the benchmark, e.g. by calling it this way: MODE=extensive sbc-bench.sh

Here you go…

khadas@Khadas:~$ cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies
500000 666000 1000000 1200000 1392000 1512000 1608000 1704000 1800000 1896000 2016000  

I get ‘Installing needed tools (can’t build cpuminer)’ when I run this.

I had a look at the cpuminer-multi github repository and there seems to be a lot of dependencies mentioned that I can’t install.

I tried to build it manually but it fails spectacularly.

Thank you both. cpuminer isn’t really important since it was all about reading out the various OPP tables and in the meantime I got them: JVnV Pastebin – View paste – Untitled

So supply voltage for all cpufreqs below 1.3 GHz is always the same as such it shouldn’t matter much whether the board idles at 500 MHz or 1 GHz. But if as in @ps23Rick’s case cpufreq governor is really set to performance then in fact the board idles at 2.0/2.2GHz which is just a waste of energy.

Does your installation also output performance twice with this:

cat /sys/devices/system/cpu/cpufreq/policy?/scaling_governor

A better setting would IMO be /etc/default/cpufrequtils containing this:

# WARNING: this file will be replaced on board support package upgrade
ENABLE=true
MIN_SPEED=1000000
MAX_SPEED=2208000
GOVERNOR=ondemand

since then the code snippet inside the fenix-hardware-optimization script would actually work. This would result in lower idle consumption while keeping I/O performance up. But if cpufreq governor is set to performance anyway by a different mechanism/script then of course this all doesn’t matter :slight_smile:

yes, both instances of scaling_governor are performance on mine as well.

The script did complete BTW and there’s some interesting stuff in the log file so thanks for that.

Then there’s some script or startup service adjusting this since kernel config defaults to schedutil. If you call sensors with your board being idle for a while you get with all sensors close to 50°C, right?

Does this change significantly after editing /etc/default/cpufrequtils with the values above, followed by an systemctl restart cpufrequtils, followed by half an hour waiting and then calling sensors again?

And BTW: what do you use for cooling? The usual fansink?

I’ve got the usual fan sink (active cooling?)… it cycles on-n-off periodically even when the machine is idle other than the occasional cron job…

Should I try adjusting that config file/script you mentioned or ? In my case I had the two different settings — one performance and one conservative if I recall. Seems like something might be a little off perhaps if the setting in the file above is not being honored.

I’m using the ‘active cooling’ fansink. The temp hovers around 50 degrees and the fan cycles on-off every minute or so.

I had a look at the rc scripts and found that init.d/cpufrequtils was set to ondemand, 0, 0 but according to /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors, the governors available are performance and schedutil.

I changed it to schedutil, 50000, 208000 but it didn’t make any difference because it seems something else is setting it to performance on boot.

I did echo “schedutil” | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
and cat /sys/devices/system/cpu/cpufreq/policy?/scaling_governor
gave me
schedutil
performance

but it didn’t stick.

just discovered that cpufrequtils won’t start because it says the governor is not available no matter what I set it to - I guess it just defaults to performance?

I feel this has gone a long way of topic now - should we start a new thread?

Hello @RIGeek @technodevotee @JeremiahCornelius @deepvim @foxsquirrel

We have some improgress about the NVMe SSD issues, as we don’t have too much SSD models, so we need your help to check the SSDs on your side.

Before testing, you need to follow the steps below to upgrade the kernel.

$ wget https://dl.khadas.com/.test/linux-dtb-amlogic-5.4_1.1.6_arm64.deb
$ wget https://dl.khadas.com/.test/linux-image-amlogic-5.4_1.1.6_arm64.deb
$ sudo dpkg -i linux-dtb-amlogic-5.4_1.1.6_arm64.deb linux-image-amlogic-5.4_1.1.6_arm64.deb
$ sync
$ sudo reboot

After reboot double check the kernel version.

$ uname -a
Linux Khadas 5.4.180 #1.1.6 SMP PREEMPT Mon Oct 10 16:14:32 CST 2022 aarch64 aarch64 aarch64 GNU/Linux
2 Likes

How many merge conflicts have you dismissed while bringing Amlogic’s 5.4.125 up to 5.4.180?

I just did the same test under I did before.

With my Netac N930 Pro plugged into the board, I created an image of the eMMC using dd to it. I copied the image from the NVMe to my NAS and compared the two files.

They were the same, when they were always different before on Ubuntu-Gnome.

I ‘burned’ the image from my NAS to an SD card and can boot from it. That never worked on Ubuntu-Gnome before.

So far, it seems better.

I can try some tests tonight my time here in California and see how things go… I’ve got a spare NVMe drive — one of the Crucial models I can test with.

@tkaiser … If we want to manually review the changes between the versions of the amlogic code-base specific to the VIM 4, does the general public have access to that stuff? Just curious… I’ve got a lot of C/C++ experience over the decades with embedded devices, albeit not w/ Linux but I’d be happy to look over the changes for anything looking odd or not right for some reason. :man_shrugging::thinking:

Sure.

Here is the 5.4.180 Khadas is using: GitHub - khadas/linux at khadas-vims-5.4.y

Here is the real upstream 5.4.217 LTS: https://github.com/gregkh/linux/tree/linux-5.4.y

The process has been explained by Willy over at Radxa forum (who deal with the exact same problem: vendor BSP kernels you can’t trust at all): The radxa bsp kernel patches : from 5.10.67 to 5.10.123 - ROCK 5 Series - Radxa Forum

Great… Thanks @tkaiser !! I’ll probably take peek at some point this week. Much appreciated!

Wow… I just read a little … Seems like there are some very knowledgable people participating there – yourself included obviously… I’m not sure I’m up to speed on things but hoping that perhaps there are some people here aside from a few people that have chimed in already that can help weed through all this stuff… lots to learn! Thanks for the links!

I just installed the new kernel. I just started recompiling the RetroPie package. That should take about 48 hours, if successful. I will report back with my results.