New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 790898 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

powerd should emit DarkSuspendImminent for non-user-initiated canceled suspend attempts

Project Member Reported by derat@chromium.org, Dec 1 2017

Issue description

As discussed at https://crrev.com/c/798640/1/power_manager/powerd/policy/suspender.cc#b551, powerd's Suspender class currently contains code to emit a DarkSuspendImminent signal after a failed suspend attempt, even when the system isn't actually in dark resume.

It sounds like the reason this is present is because it's possible that the attempt was canceled as a result of a non-user-initiated wake event (e.g. WoWLAN). In this case, we'd want other processes on the system to do their usual dark resume preparations to handle the wakeup.

The current implementation still seems a bit wonky to me, in that the code doesn't check that DarkResume::IsEnabled() is enabled before sending the signal. It does call CanSafelyExitDarkResume() first, though.

Ravi is making changes for (I think) http://b/67747385 that should make it possible for powerd to identify the wake source, which should make it possible for us to follow the normal dark resume code path in this scenario.

In the meantime, I think I'm going to drop this unused (and untested) code from the normal-resume path in my refactoring change, while adding a TODO pointing at this bug to make sure that it's handled properly when possible.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Dec 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/87ef87790a2a24172e997d48ae548b41b5af18e9

commit 87ef87790a2a24172e997d48ae548b41b5af18e9
Author: Daniel Erat <derat@chromium.org>
Date: Sat Dec 02 01:57:56 2017

power: Refactor Suspender::Suspend.

Break up powerd's policy::Suspender class's Suspend() method
into smaller pieces.

Also update lockfile paths in docs/suspend_resume.md.

BUG=chromium:624203,chromium:790898
TEST=existing unit tests pass; also verified that normal
     suspend/resume works as before

Change-Id: Ib9ef3204041c850e96301497d9e65f1d7ff76eda
Reviewed-on: https://chromium-review.googlesource.com/798640
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>

[modify] https://crrev.com/87ef87790a2a24172e997d48ae548b41b5af18e9/power_manager/powerd/policy/suspender.cc
[modify] https://crrev.com/87ef87790a2a24172e997d48ae548b41b5af18e9/power_manager/docs/suspend_resume.md
[modify] https://crrev.com/87ef87790a2a24172e997d48ae548b41b5af18e9/power_manager/powerd/policy/suspender.h

Labels: Pri-3
Cc: coconutruben@chromium.org mqg@chromium.org puthik@chromium.org
Labels: -Pri-3 Pri-1
Owner: ravisadineni@chromium.org
Hi,

Nomenclature: 

suspend cancel : kernel bailed out of suspend attempt due to a increment in the wakeup count

suspend failure : kernel bailed out of suspend as one of the driver's callback returned -1 (failure).

Current way of handling wake events seem to be broken in the following remote case.  
     1. System tries to suspend (powerd_dbus_suspend with wakeup_count).
     2. In the path to suspend (when the kernel is calling the driver callbacks), user presses a key.
     3. Currently we wake up, see that wake up count incremented and suspend again without turning the screen on. 
     4. Thus a wake up event when suspending is always lost (unless external wake up count is provided which happens only in autotests).

Possible Fix:
  when suspend is cancelled (not failure) do a full resume (turns the screen on too).
Side effects of the fix: 
   1. In case if any of the drivers are malfunctioning (increments wakeup count on suspend path) we would see device going through the full idle cycle (current default timeout is 6 mins 30 secs) before retrying.
   2. Might annoy the user in case of a malfunctioning driver.
 
Note that if dark resume is enabled, we will turn the screen only for user initiated (input devices) resumes.


#3: I thought that it at least used to be the case that userspace would receive the key event that canceled suspend, and that when Chrome reported it to powerd, powerd would abort the suspend request instead of trying to suspend again. Does that not work in some cases?

If you're typing "powerd_dbus_suspend" directly into a shell on your test device, it's possible that the canceling key event might not be reported to powerd immediately if a report of user activity was already sent within the previous five seconds.
Status: Assigned (was: Available)

Sign in to add a comment