public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kodiak furr <boxerspam1@gmail.com>
To: xiaoming wang <xiaoming.wang@intel.com>
Cc: gregkh@linuxfoundation.org, linux-pm@vger.kernel.org,
	rjw@rjwysocki.net, Chuansheng Liu <chuansheng.liu@intel.com>,
	len.brown@intel.com, linux-kernel@vger.kernel.org, pavel@ucw.cz
Subject: Re: [PATCH 2/2] PM / sleep: Asynchronous threads for dpm_complete
Date: Mon, 25 Aug 2014 09:27:12 -0500	[thread overview]
Message-ID: <53fb47c5.019c3c0a.6cdb.02e1@mx.google.com> (raw)
In-Reply-To: <1408979617-14140-2-git-send-email-xiaoming.wang@intel.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 3513 bytes --]

kodiak furr liked your message with Boxer for Android.

On Aug 25, 2014 10:13 AM, xiaoming wang <xiaoming.wang@intel.com> wrote:
>
> In analogy with commits 5af84b82701a and 97df8c12995, 
> using asynchronous threads can improve the overall 
> resume time significantly. 
>
> This patch is for dpm_complete phase. 
>
> Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com> 
> Signed-off-by: xiaoming wang <xiaoming.wang@intel.com> 
> --- 
> drivers/base/power/main.c |   38 ++++++++++++++++++++++++++++++++++---- 
> 1 files changed, 34 insertions(+), 4 deletions(-) 
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c 
> index f9fe1b3..00c4bf1 100644 
> --- a/drivers/base/power/main.c 
> +++ b/drivers/base/power/main.c 
> @@ -889,14 +889,15 @@ void dpm_resume(pm_message_t state) 
>   * @dev: Device to handle. 
>   * @state: PM transition of the system being carried out. 
>   */ 
> -static void device_complete(struct device *dev, pm_message_t state) 
> +static void device_complete(struct device *dev, pm_message_t state, bool async) 
> { 
> void (*callback)(struct device *) = NULL; 
> char *info = NULL; 
>
> if (dev->power.syscore) 
> - return; 
> + goto Complete; 
>
> + dpm_wait(dev->parent, async); 
> device_lock(dev); 
>
> if (dev->pm_domain) { 
> @@ -928,6 +929,17 @@ static void device_complete(struct device *dev, pm_message_t state) 
> device_unlock(dev); 
>
> pm_runtime_put(dev); 
> + 
> +Complete: 
> + complete_all(&dev->power.completion); 
> +} 
> + 
> +static void async_complete(void *data, async_cookie_t cookie) 
> +{ 
> + struct device *dev = (struct device *)data; 
> + 
> + device_complete(dev, pm_transition, true); 
> + put_device(dev); 
> } 
>
> /** 
> @@ -940,27 +952,45 @@ static void device_complete(struct device *dev, pm_message_t state) 
> void dpm_complete(pm_message_t state) 
> { 
> struct list_head list; 
> + struct device *dev; 
>
> trace_suspend_resume(TPS("dpm_complete"), state.event, true); 
> might_sleep(); 
>
> INIT_LIST_HEAD(&list); 
> mutex_lock(&dpm_list_mtx); 
> + pm_transition = state; 
> + 
> + /* 
> +   * Advanced the async threads upfront, 
> +   * in case the starting of async threads is 
> +   * delayed by non-async resuming devices. 
> +   */ 
> + list_for_each_entry(dev, &dpm_prepared_list, power.entry) { 
> + reinit_completion(&dev->power.completion); 
> + if (is_async(dev)) { 
> + get_device(dev); 
> + async_schedule(async_complete, dev); 
> + } 
> + } 
> + 
> while (!list_empty(&dpm_prepared_list)) { 
> - struct device *dev = to_device(dpm_prepared_list.prev); 
> + dev = to_device(dpm_prepared_list.prev); 
>
> get_device(dev); 
> dev->power.is_prepared = false; 
> list_move(&dev->power.entry, &list); 
> mutex_unlock(&dpm_list_mtx); 
>
> - device_complete(dev, state); 
> + if (!is_async(dev)) 
> + device_complete(dev, state, false); 
>
> mutex_lock(&dpm_list_mtx); 
> put_device(dev); 
> } 
> list_splice(&list, &dpm_list); 
> mutex_unlock(&dpm_list_mtx); 
> + async_synchronize_full(); 
> trace_suspend_resume(TPS("dpm_complete"), state.event, false); 
> } 
>
> -- 
> 1.7.1 
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in 
> the body of a message to majordomo@vger.kernel.org 
> More majordomo info at  http://vger.kernel.org/majordomo-info.html 
> Please read the FAQ at  http://www.tux.org/lkml/ 
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2014-08-25 14:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 15:13 [PATCH 1/2] PM / sleep: Asynchronous threads for dpm_prepare xiaoming wang
2014-08-25 15:13 ` [PATCH 2/2] PM / sleep: Asynchronous threads for dpm_complete xiaoming wang
2014-08-25 14:27   ` kodiak furr [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-19 20:29 [PATCH 1/2] PM / sleep: Asynchronous threads for dpm_prepare xiaoming wang
2014-08-19 20:29 ` [PATCH 2/2] PM / sleep: Asynchronous threads for dpm_complete xiaoming wang

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=53fb47c5.019c3c0a.6cdb.02e1@mx.google.com \
    --to=boxerspam1@gmail.com \
    --cc=chuansheng.liu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=xiaoming.wang@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox