Public bug reported:

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).

Note: I also filed this same bug report upstream.
https://bugs.freedesktop.org/show_bug.cgi?id=91914

** Affects: pm-utils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to pm-utils in Ubuntu.
https://bugs.launchpad.net/bugs/1493156

Title:
  pm-suspend aborts if highest numbered CPU offline, as of kernel 4.2

Status in pm-utils package in Ubuntu:
  New

Bug description:
  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).

  Note: I also filed this same bug report upstream.
  https://bugs.freedesktop.org/show_bug.cgi?id=91914

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/1493156/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to