From: Pavel Machek <pavel@ucw.cz>
To: Joseph Swantek <joseph.swantek@motorola.com>
Cc: rjw@rjwysocki.net, len.brown@intel.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / suspend: Catch wake-up requests in suspend_again
Date: Tue, 30 Sep 2014 22:38:40 +0200 [thread overview]
Message-ID: <20140930203839.GA14283@amd> (raw)
In-Reply-To: <CACB9iXzNUA5+kLkDC=_w2PLB9TkLSXwxsesbL5pJbOrkYYYwLA@mail.gmail.com>
On Fri 2014-09-26 17:44:24, Joseph Swantek wrote:
> It is possible during the processing of suspend_again() that a
> wake-up request (i.e. pm_stay_awake()) be made by a driver in response
> to an outside event (i.e. hw interrupt, etc.). Currently, when
> suspend_again() requests to re-enter suspend, suspend_enter() runs
> to re-enter suspend. The pm_wakeup_pending() function is called to check
> for any wake-up requests. However, this function is essentially disabled
> because the events_check_enabled flag is set to false by the previous
> run through suspend_enter(). This causes any wake-up request made
> during the processing of suspend_again() to be delayed until the next
> time the kernel resumes sometime in the future.
>
> To resolve this issue, if suspend_again() votes to re-enter
> suspend_enter() the count of wake-up requests is re-evaluated
> and the events_check_enabled flag set correctly based on the
> presence of wake-up requests that occurred during suspend_again().
>
> @@ -188,8 +188,25 @@ static void platform_suspend_recover(suspend_state_t
> state)
>
> static bool platform_suspend_again(suspend_state_t state)
> {
> - return state != PM_SUSPEND_FREEZE && suspend_ops->suspend_again ?
> + int count;
> + bool suspend = state != PM_SUSPEND_FREEZE &&
> + suspend_ops->suspend_again ?
> suspend_ops->suspend_again() : false;
> +
> + if (suspend) {
> + /*
> + * pm_get_wakeup_count() gets an updated count of wakeup events
> + * that have occured and will return false (i.e. abort suspend)
> + * if a wakeup event has been started during suspend_again() and
> + * is still active. pm_save_wakeup_count() stores the count
> + * and enables pm_wakeup_pending() to properly analyze wakeup
> + * events before entering suspend in suspend_enter().
> + */
> + suspend = pm_get_wakeup_count(&count, false) &&
> + pm_save_wakeup_count(count);
> + }
> +
> + return suspend;
> }
That seems rather whitespace damaged.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next parent reply other threads:[~2014-09-30 20:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CACB9iXzNUA5+kLkDC=_w2PLB9TkLSXwxsesbL5pJbOrkYYYwLA@mail.gmail.com>
2014-09-30 20:38 ` Pavel Machek [this message]
2014-09-30 22:20 [PATCH] PM / suspend: Catch wake-up requests in suspend_again Joe Swantek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140930203839.GA14283@amd \
--to=pavel@ucw.cz \
--cc=joseph.swantek@motorola.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.