Bug#880203: After suspend&resume, cpufreq/scaling_max_freq is ignored - (wild hack) shell script
- To: 880203@bugs.debian.org
- Subject: Bug#880203: After suspend&resume, cpufreq/scaling_max_freq is ignored - (wild hack) shell script
- From: Leon Meier <Leon.Meier@yandex.ru>
- Date: Wed, 1 Nov 2017 13:02:19 +0100
- Message-id: <[🔎] a438f241-90c8-9ff0-591e-12eb94e59127@yandex.ru>
- Reply-to: Leon Meier <Leon.Meier@yandex.ru>, 880203@bugs.debian.org
- In-reply-to: <5587a8a5-0a7f-97f7-2452-d7ebbf5cdba0@yandex.ru>
- References: <1509446219.2748.35.camel@decadent.org.uk> <d6a5f770-fdbe-9d6a-127a-4d6abfe4d191@yandex.ru> <handler.880203.D880203.150944624227212.notifdone@bugs.debian.org> <5587a8a5-0a7f-97f7-2452-d7ebbf5cdba0@yandex.ru> <d6a5f770-fdbe-9d6a-127a-4d6abfe4d191@yandex.ru>
On 31.10.2017 13:25, Leon Meier wrote:
On 31.10.2017 11:39, Debian Bug Tracking System wrote:
Yes, but that doesn't mean we can do anything about it.
Why not simply re-issue the request setting the performance-level after
resume?
You could at least suggest a script similar to the following one to be
added to /lib/systemd/system-sleep.
#!/bin/sh
### Ensure that the frequency is stored/restored upon resume
case "${1}" in
pre)
# Store the old frequency
for i in `seq 0 7`; do cat
/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq >
/tmp/scaling_max_freq$i; done
;;
post)
# Wild hack: insert a junk value first
for i in `seq 0 7`; do echo 999999999999999 >
/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq; done
# Set the old frequency
for i in `seq 0 7`; do
cat /tmp/scaling_max_freq$i >
/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq
rm -f /tmp/scaling_max_freq$i;
done
;;
esac
Exercise for the reader: automatically determine the number of CPUs,
ensure that created files have fresh names, that there is sufficient
unused space in /tmp, and that proper error handling is done if it is
not the case.
However, really, this is much better done in the kernel manipulating
p-states directly rather than through the overkill of wild hacks and
invoking a shell script modifying various places in the file system.
Reply to: