[Pm-utils] Fix mishandling of cpufreq save/restore
Victor Lowther
victor.lowther at gmail.com
Thu Mar 6 17:04:32 PST 2008
There are a couple of Ubuntu bugs floating around about this issue.
when running with 94cpufreq, all the cpus will be set to "performance"
after resume on some systems. This happens when two cpus share the same
core, or otherwise are forced to use the same cpufreq settings -- the
cpufreq info for all but one of hte processors is just symlinked to a
different processor. The attached patch fixes that issue, and I
have pushed it to fd.o master.
pm/sleep.d/94cpufreq | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq
index 9157fb4..cfb0c60 100755
--- a/pm/sleep.d/94cpufreq
+++ b/pm/sleep.d/94cpufreq
@@ -7,12 +7,17 @@
hibernate_cpufreq()
{
( cd /sys/devices/system/cpu/
- for x in cpu[0-9]*/cpufreq/scaling_governor ; do
- [ -f "$x" ] || continue
+ for x in cpu[0-9]*; do
+ # if cpufreq is a symlink, it is handled by another cpu. Skip.
+ [ -L "$x/cpufreq" ] && continue
+ gov="$x/cpufreq/scaling_governor"
+ # if we do not have a scaling_governor file, skip.
+ [ -f "$gov" ] || continue
+ # if our temporary governor is not available, skip.
grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
- "${x%/*}/scaling_available_governors" || continue
- savestate "${x%%/*}_governor" $(cat "$x")
- echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$x"
+ "$x/cpufreq/scaling_available_governors" || continue
+ savestate "${x}_governor" $(cat "$gov")
+ echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$gov"
done )
}
--
Victor Lowther
Ubuntu Certified Professional
More information about the Pm-utils
mailing list