Closed terencode closed 4 years ago
Are you talking about this one:
/usr/bin/amdgpu-clocks: ligne 123 : echo: erreur d'écriture : Argument invalide
?
This is about restoring profile to 0 (default):
echo 0 > /sys/class/drm/card0/device/pp_power_profile_mode
and for some reason kernel is complaining. Try it manually, and pass the contents of your own /sys/class/drm/card0/device/pp_power_profile_mode
...
Are you talking about this one: /usr/bin/amdgpu-clocks: ligne 123 : echo: erreur d'écriture : Argument invalide
Yes, sorry I don't know how to display it in english. I can't pass any number to it (tried [0..6]), it always says invalid argument.
cat /sys/class/drm/card0/device/pp_power_profile_mode
NUM MODE_NAME BUSY_SET_POINT FPS USE_RLC_BUSY MIN_ACTIVE_LEVEL
0 BOOTUP_DEFAULT*: 70 60 0 0
1 3D_FULL_SCREEN : 70 60 1 3
2 POWER_SAVING : 90 60 0 0
3 VIDEO : 70 60 0 0
4 VR : 70 90 0 0
5 COMPUTE : 30 60 0 6
6 CUSTOM : 0 0 0 0
Ah, this is because /sys/class/drm/card0/device/power_dpm_force_performance_level
needs to be set to manual.
In definitive, I think you should not be setting pp_power_profile_mode
but instead make sure power_dpm_force_performance_level
is set to auto.
I opened #12 which is mildly related because the script shouldn't restore after a resume from suspend anyway...
I think you should not be setting pp_power_profile_modebut instead make sure power_dpm_force_performance_level is set to auto.
The restore needs to set power_dpm_force_performance_level
to whatever it was before the script's first run, which is not necessarily 'auto'. This is more of an ordering issue. I've change the order and added level check before forcing profile to 0. Can you try this now, followed with service start & stop:
diff --git a/amdgpu-clocks b/amdgpu-clocks
index 9f28a62..ab8f67e 100755
--- a/amdgpu-clocks
+++ b/amdgpu-clocks
@@ -146,9 +146,11 @@ function set_custom_states() {
function backup_states() {
if [ ! -r ${BACKUP_STATE_FILE} ]; then
cp ${SYS_PP_OD_CLK} ${BACKUP_STATE_FILE}
+ if [ "x${PWR_LEVEL}" == "xmanual" ]; then
+ echo "FORCE_POWER_PROFILE: 0" >> ${BACKUP_STATE_FILE}
+ fi
echo "FORCE_PERF_LEVEL: $(cat ${PWR_LEVEL})" >> ${BACKUP_STATE_FILE}
echo "FORCE_POWER_CAP: $(cat ${PWR_CAP_FILE})" >> ${BACKUP_STATE_FILE}
- echo "FORCE_POWER_PROFILE: 0" >> ${BACKUP_STATE_FILE}
echo "Writen initial backup states to ${BACKUP_STATE_FILE}"
else
echo "Won't write initial state to ${BACKUP_STATE_FILE}, it already exists."
?
The restore needs to set power_dpm_force_performance_level to whatever it was before the script's first run, which is not necessarily 'auto'
If we carry on the reasoning, why would you force pp_power_profile_mode to 0 and not apply what it was set to before?
With your diff, I do not get the write error (although it seems like you made a typo "x${PWR_LEVEL}" == "xmanual"
so I removed those extra 'x')
If we carry on the reasoning, why would you force pp_power_profile_mode to 0 and not apply what it was set to before?
Because it would probably be a mess as it would require some logic for parsing the pp_power_profile_mode
which tends to have very different format across different GPUs & its format had changed more than once in different kernel versions (for the same hardware). Implementing such logic in bash would probably result in not so pretty and maybe even not so short shell code, I prefer to keep this script as readable and simple as reasonably possible.
But nevertheless, feel free to push a PR, if the implementation is reasonable I'd be happy to merge it...
With your diff, I do not get the write error (although it seems like you made a typo
"x${PWR_LEVEL}" == "xmanual"
so I removed those extra 'x')
Merged & got rid of x-es. Please check it out and close the issue if it works for you.
Because it would probably be a mess as it would require some logic for parsing the pp_power_profile_mode which tends to have very different format across different GPUs & its format had changed more than once in different kernel versions (for the same hardware). Implementing such logic in bash would probably result in not so pretty and maybe even not so short shell code, I prefer to keep this script as readable and simple as reasonably possible.
Make sense, maybe just add a note in the README about it.
Otherwise, no error now.
updated README, cheers!
Since https://github.com/sibradzic/amdgpu-clocks/commit/52a3acdc7a4d352202f3c70b48a4547c90a02cd4
I have a vega 64 card.