Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 229171 - CPU frequency scaling not restored correctly when hibernating on Core Duo CPUs
Summary: CPU frequency scaling not restored correctly when hibernating on Core Duo CPUs
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: pm-utils
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-19 06:18 UTC by cm1
Modified: 2015-03-05 01:18 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-09 13:48:35 UTC


Attachments (Terms of Use)

Description cm1 2007-02-19 06:18:51 UTC
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 13:48:35 UTC
Exactly that patch is in the latest pm-utils currently in FC-devel.

Read ya, Phil

Comment 2 cm1 2007-03-12 07:08:54 UTC
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.