Closed wentasah closed 2 years ago
@benedond Can you test this on both TX2 and i.MX8? If it works well, we remove the imx8-specific policy and replace it with this.
I am just trying to run some configuration at TX2. I am getting:
root@tegra-ubuntu:~/experiments/20_test_demos# ./run_tx2.sh
Cooling down to 60°C, current Cortex_A57_temp temperature: 35.5°C, time: 0s...
Done
Opening ./test_tx2.csv
Running: demos-sched -p imx8_per_process -c config_tx2.yaml
0.0s 35.5°C >>> 09:56:13.895 [info] Activating power management (power policy: 'imx8_per_process', args: '')
>>> 09:56:13.917 [error] Exception: Failed to initialize power policy imx8_per_process: map::at
It should be the current demos compiled from per-process branch.
Don't use -p imx8_per_process
, but -p per_process
.
How are the frequencies currently handled? It seems that there might be some problem with conversion/rounding.
Listing the frequencies out on tx2 gives:
345600 499200 652800 806400 960000 1113600 1267200 1420800 1574400 1728000 1881600 2035200
I suppose that DEmOS handles them in MHz, so I set, e.g., 345
as the lowest one.
This gives the following exception:
>>> 10:24:03.749 [error] Exception: Attempted to set CPU frequency for `policy0` to `345000000` Hz, which is less than the supported minimum of `345600000` Hz
Ok, I set it to 345.6
, which in turn gives:
>>> 10:27:16.212 [error] Exception: yaml-cpp: error at line 5, column 38: bad conversion
It seems that floats are not supported, so I change the config to 346
, in that case, the program complains again:
>>> 10:29:12.792 [error] Exception: Attempted to set CPU frequency for `policy0` to `346000000` Hz, but this CPU supports only the following frequencies: ~345 MHz, ~499 MHz, ~652 MHz, ~806 MHz, 960 MHz, ~1113 MHz, ~1267 MHz, ~1420 MHz, ~1574 MHz, 1728 MHz, ~1881 MHz, ~2035 MHz
DEmOS internally uses frequencies in Hz, but the config format accepts uints interpreted as MHz.
https://github.com/CTU-IIG/demos-sched/blob/master/src/config.cpp#L441 https://github.com/CTU-IIG/demos-sched/blob/master/src/config.cpp#L507 https://github.com/CTU-IIG/demos-sched/blob/master/src/cpufreq_policy.hpp#L40
I think it should be enough to adjust these 3 lines to switch to kHz/Hz or accept float values. Also, some test configs in test_config
may need adjustment if the units are changed.
EDIT: also these two: https://github.com/CTU-IIG/demos-sched/blob/master/src/config.cpp#L73 https://github.com/CTU-IIG/demos-sched/blob/master/src/config.cpp#L214
@benedond I've added the required changes to this PR (mainly commit df48116), but there seems to be another problem: #67.
I am still testing the freq. setting under DEmOS on TX2. Currently, I am unable to run the test script due to some discrepancy between the available frequencies and maximal allowed frequency.
Available frequencies according to /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
are
345600 499200 652800 806400 960000 1113600 1267200 1420800 1574400 1728000 1881600 2035200
Current settings before the experiment show:
>>> root@tegra-ubuntu:~/experiments/20_test_demos# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
2035200
>>> root@tegra-ubuntu:~/experiments/20_test_demos# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
345600
>>> root@tegra-ubuntu:~/experiments/20_test_demos# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand
But then I run demos-sched and get the following error complaining about supported maximum being 1420800
:
root@tegra-ubuntu:~/experiments/20_test_demos# ./run_tx2.sh
Cooling down to 60°C, current Cortex_A57_temp temperature: 37.5°C, time: 0s...
Done
Opening ./test_tx2.csv
Running: demos-sched -p per_process -c config_tx2.yaml
0.0s 37.5°C >>> 07:33:38.600 [info] Activating power management (power policy: 'per_process', args: '')
>>> 07:33:38.648 [error] Exception: Attempted to set CPU frequency for `policy1` to `1574400000` Hz, which is more than the supported maximum of `1420800000` Hz
Frequencies 1574400 1728000 1881600 2035200
are not allowed by demos-sched for some reason even though the demos-sched itself hints them whenever some frequency is set in a wrong way:
>>> 07:17:11.578 [error] Exception: Attempted to set CPU frequency for `policy0` to `346000000` Hz, but this CPU supports only the following frequencies: 345.6 MHz, 499.2 MHz, 652.8 MHz, 806.4 MHz, 960 MHz, 1113.6 MHz, 1267.2 MHz, 1420.8 MHz, 1574.4 MHz, 1728 MHz, 1881.6 MHz, 2035.2 MHz
Probably some stupidity in NVIDIA's cpufreq driver. Does it work if you comment out the following code? https://github.com/CTU-IIG/demos-sched/blob/df48116528bf13dfdd2472764e2906ba4b98562b/src/cpufreq_policy.hpp#L184-L189
Probably some stupidity in NVIDIA's cpufreq driver. Does it work if you comment out the following code?
The bounds are also enforced by the cpufreq interface, as you probably already found out, so this will just error out with some IO error. :)
The bounds are also enforced by the cpufreq interface, as you probably already found out, so this will just error out with some IO error. :)
No. At least on TX2, we verified that you are allowed to write a higher frequency manually without any error, but the actual frequency stays at what is set in scaling_max_freq
.
Oh, right, not enforced, but clamped.
This is just a simple modification of imx8-per-process. If it works well, we'll replace imx8-per-process with this platform independent policy.