Bug 229171 - CPU frequency scaling not restored correctly when hibernating on Core Duo CPUs
CPU frequency scaling not restored correctly when hibernating on Core Duo CPUs
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: pm-utils (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-19 01:18 EST by cm1
Modified: 2015-03-04 20:18 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-03-09 08:48:35 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description cm1 2007-02-19 01:18:51 EST
Description of problem:

CPU scaling governor incorrectly restored after hibernate on Core Duo CPUs

Version-Release number of selected component (if applicable):

pm-utils-0.19-3

How reproducible:

You need a Core Duo system to reproduce this bug (not sure whether it
works on Core 2 Duo systems as well)

Steps to Reproduce:
1. Set the CPU frequency scaling governor to "ondemand"
2. Hibernate
3. Turn system back on
  
Actual results:

Frequency scaling governor is set to "userspace"

Expected results:

Frequence scaling governor should be set to "ondemand"

Additional info:

The bug is caused by /etc/pm/hooks/94cpufreq setting CPU0 to "userspace" before
reading the state of CPU1. For some reason, setting the governor for CPU0 also
sets the governor for CPU1, thus the governor saved in the second loop iteration
for CPU1 will be "userspace" and this state will be saved as such.

Upon resume (thaw), the first CPU gets set to "ondemand" and the second CPU is
set to "userspace" which, as described above, will set both CPUs to "userspace".

A not very elegant but working fix could look like this (note the two separate
loops -- one to save the current state of all CPUs, one to set all CPUs to
"userspace"):

hibernate_cpufreq()
{
        [ -d /sys/devices/system/cpu/ ] || return 0
        pushd /sys/devices/system/cpu/ >/dev/null 2>&1
        for x in $(ls -1) ; do
                [ -d $x/cpufreq ] || continue
                [ -f $x/cpufreq/scaling_governor ] || continue

                savestate ${x}_governor $(cat $x/cpufreq/scaling_governor)
        done

        for x in $(ls -1) ; do
                [ -d $x/cpufreq ] || continue
                [ -f $x/cpufreq/scaling_governor ] || continue
                sh -c "echo userspace > $x/cpufreq/scaling_governor" >/dev/null 2>&1
        done
        popd >/dev/null 2>&1
}
Comment 1 Phil Knirsch 2007-03-09 08:48:35 EST
Exactly that patch is in the latest pm-utils currently in FC-devel.

Read ya, Phil
Comment 2 cm1 2007-03-12 03:08:54 EDT
Oops -- sorry. Next time I'll look closer before submitting a bug ;)

Note You need to log in before you can comment on or make changes to this bug.