cpu_frequency restore wrong governor

Bug #743682 reported by Mathieu Bérard
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
powernap
Fix Released
Undecided
Andres Rodriguez
powernap (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Binary package hint: powernap

Hello,

when first invoked, the /etc/pm/power.d/cpu_frequency script save the active governor to /var/run/powernap/cpu_governor.default for latter restoration.
However that might happen when the active governor is not (yet) set to the desired one.
For example during the boot sequence.

In my case the desired active governor (ondemand) is set at boot time by the cpufrequtils init.d script.
However during the boot sequence powernap is started before cpufrequtils (at least here), and the governor written in /var/run/powernap is the wrong one (performance, which was active before cpufrequtils run)

Latter when powernap runs the powersave actions, it correctly set the governor to 'powersave', but when the recover actions are taken, cpu_frequency set the governor to performance (which is what /var/run/powernap/cpu_governor.default contains) not ondemand (which was the active governor just before powernap became idled).

I have modified /etc/pm/power.d/cpu_frequency to acheive a behavior that seems more correct to me.
Now /var/run/powernap/cpu_governor.default is written for latter restoration each time the governor is about to be set to powersave, not just when the script is first invoked.

That way powernap doesn't silently override the governor set by cpufrequtils init.d script, or any governor change made when the machine is not idled.

Tags: patch
Revision history for this message
Mathieu Bérard (mathieu-berard) wrote :
tags: added: patch
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Mathieu,

Thank your for reporting bugs and trying to make PowerNap and Ubuntu Server better.

I have looked into this and in fact this is not an issue with PowerNap directly, but rather with acpi-support/ondemand init scripts.

 1. When the machine boots up, then it executes the acpi-support init script
 2. This init scripts, also executes the /etc/acpi/power.sh script.
 3. Then, the power.sh script, executes pm-powersave (which cases all the scripts installed by powernap to be executing during boot time)
 4. Way after this is done, the /etc/init.d/ondemand init script sets the CPUFREQ to ondemand.

This mean that the ondemand frequency is set to ondemand way after pm-powersave has been executed, causing the cpu_frequency script to save the "incorrect" governor.

Thank you for pointing this out. Your patch looks good. I'm merging it.

Cheers,

Changed in powernap:
status: New → In Progress
assignee: nobody → Andres Rodriguez (andreserl)
Changed in powernap (Ubuntu):
assignee: nobody → Andres Rodriguez (andreserl)
status: New → In Progress
Changed in powernap (Ubuntu):
status: In Progress → Confirmed
importance: Undecided → Wishlist
assignee: Andres Rodriguez (andreserl) → nobody
Changed in powernap:
status: In Progress → Fix Committed
Revision history for this message
Mathieu Bérard (mathieu-berard) wrote :

Well... power management infrastructure really begins to look like a spaghetti bowl of entangled shell scripts to me (but that's not the point of this bug report).

Thank you for your corrected analysis and for committing the patch !

Changed in powernap (Ubuntu):
importance: Wishlist → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package powernap - 2.6-0ubuntu1

---------------
powernap (2.6-0ubuntu1) natty; urgency=low

  * debian/copyright: Update upstream authors and license years.
  * powernap/monitors/IOMonitor.py: If processes do not have a command line,
    search regex in the 'Name:' field of /proc/<PID>/status (LP: #735452)
  * actions/cpu_frequency: Fix saving/restoring of wrong governor (LP: #743682)
    Thanks to Mathieu Berard for the patch.
    - Additionally, save 'ondemand' as default when acpi-support and ondemand
      are run on boot to handle special case when running on battery.
  * debian/powernap.{preinst,postinst}: Add logic to handle the upgrade of
    the config file as format has changed. (LP: #744588)
    - install copy of config file in /usr/share/powernap to help with this.
 -- Andres Rodriguez <email address hidden> Mon, 28 Mar 2011 17:38:34 -0400

Changed in powernap (Ubuntu):
status: Confirmed → Fix Released
Changed in powernap:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.