Bug 91914

Summary: pm-suspend aborts if highest numbered CPU offline, as of kernel 4.2
Product: pm-utils Reporter: Doug Smythies <dsmythies>
Component: GeneralAssignee: Richard Hughes <richard>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium CC: dsmythies
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Doug Smythies 2015-09-07 21:04:29 UTC
Kernel 4.2 includes a significant commit (87549141d516aee71d511138e27117c41e8aef68), after the patch the files and directory are present even if the CPU is offline. If the CPU is offline, writing to those files isn't allowed and so the echo in 94cpufreq fails.

If the failed echo is not the last pass through the loop, then
the bad exit code gets overwritten with a good one before
the loop exits. If the failed echo is the last pass through the loop, due to the highest numbered CPU being offline, then then 94cpufreq returns an error code and pm-suspend aborts.

So what is needed is something like (and this doesn't actually work yet):

hibernate_cpufreq()
{
        ( cd /sys/devices/system/cpu/
        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 the CPU is offline, skip, unless no file, i.e. CPU0.
+               [ $(cat "$x/online") = "1" -o ! -f "$x/online" ] || continue
Or
+               if [ $(cat "$x/online") = "1" ] || [ ! -f "$x/online" ]; then
+                       continue;
+                fi
Or something similar that actually works.

                # if our temporary governor is not available, skip.
                grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
                        "$x/cpufreq/scaling_available_governors" || continue
                savestate "${x}_governor" < "$gov"
                echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$gov"
        done )
}

Or just force a good return code at the end (which is what I'm doing now, so that I can move on):
Comment 1 Doug Smythies 2015-11-23 00:34:21 UTC
As of kernel 4.4-rc1 this bug becomes invalid, as the kernel was patched such that this issue no longer occurs.
I'll wait until kernel 4.4 is finished, check again, then set the status of this bug report to resolved.
Comment 2 Doug Smythies 2016-01-16 15:58:40 UTC
Changes in kernel 4.4 rendered this bug report invalid.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.