* [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit
@ 2017-07-19 19:45 Mark Salyzyn
2017-07-19 20:40 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Mark Salyzyn @ 2017-07-19 19:45 UTC (permalink / raw)
To: linux-kernel
Cc: rjw, len.brown, pavel, linux-pm, a.zummo, alexandre.belloni,
linux-rtc, Mark Salyzyn
Permits power state and battery life diagnosis.
Since one is not guaranteed to have a persistent hardware clock to
report Suspended for in milliseconds, we report at a higher level
at just the entry and exit points for suspend and hibernate.
Feature activated by CONFIG_RTC_SHOW_TIME_*
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
v2:
- merge suspend and hibernate into a single patch
---
kernel/power/hibernate.c | 4 +++-
kernel/power/suspend.c | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e1914c7b85b1..0b5460f9189b 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -32,11 +32,11 @@
#include <linux/ctype.h>
#include <linux/genhd.h>
#include <linux/ktime.h>
+#include <linux/rtc.h>
#include <trace/events/power.h>
#include "power.h"
-
static int nocompress;
static int noresume;
static int nohibernate;
@@ -342,6 +342,7 @@ int hibernation_snapshot(int platform_mode)
pm_message_t msg;
int error;
+ rtc_show_time("PM: hibernation entry");
pm_suspend_clear_flags();
error = platform_begin(platform_mode);
if (error)
@@ -409,6 +410,7 @@ int hibernation_snapshot(int platform_mode)
thaw_kernel_threads();
Cleanup:
swsusp_free();
+ rtc_show_time("PM: hibernation exit");
goto Close;
}
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 3ecf275d7e44..f44d2152ab3f 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -26,6 +26,7 @@
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/ftrace.h>
+#include <linux/rtc.h>
#include <trace/events/power.h>
#include <linux/compiler.h>
#include <linux/moduleparam.h>
@@ -579,6 +580,7 @@ int pm_suspend(suspend_state_t state)
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
return -EINVAL;
+ rtc_show_time("PM: suspend entry");
error = enter_state(state);
if (error) {
suspend_stats.fail++;
@@ -586,6 +588,7 @@ int pm_suspend(suspend_state_t state)
} else {
suspend_stats.success++;
}
+ rtc_show_time("PM: suspend exit");
return error;
}
EXPORT_SYMBOL(pm_suspend);
--
2.14.0.rc0.284.gd933b75aa4-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit
2017-07-19 19:45 [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit Mark Salyzyn
@ 2017-07-19 20:40 ` Rafael J. Wysocki
2017-07-19 21:23 ` Mark Salyzyn
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-07-19 20:40 UTC (permalink / raw)
To: Mark Salyzyn
Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Len Brown,
Pavel Machek, Linux PM, Alessandro Zummo, Alexandre Belloni,
linux-rtc
On Wed, Jul 19, 2017 at 9:45 PM, Mark Salyzyn <salyzyn@android.com> wrote:
> Permits power state and battery life diagnosis.
>
> Since one is not guaranteed to have a persistent hardware clock to
> report Suspended for in milliseconds, we report at a higher level
> at just the entry and exit points for suspend and hibernate.
>
> Feature activated by CONFIG_RTC_SHOW_TIME_*
>
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
>
> v2:
> - merge suspend and hibernate into a single patch
So now I guess you realize that this conflicts with
https://patchwork.kernel.org/patch/9850217/ and it actually would make
sense for it to go on top of that?
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit
2017-07-19 20:40 ` Rafael J. Wysocki
@ 2017-07-19 21:23 ` Mark Salyzyn
2017-07-19 21:31 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Mark Salyzyn @ 2017-07-19 21:23 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Len Brown,
Pavel Machek, Linux PM, Alessandro Zummo, Alexandre Belloni,
linux-rtc
On 07/19/2017 01:40 PM, Rafael J. Wysocki wrote:
> On Wed, Jul 19, 2017 at 9:45 PM, Mark Salyzyn <salyzyn@android.com> wrote:
>> Permits power state and battery life diagnosis.
>>
>> Since one is not guaranteed to have a persistent hardware clock to
>> report Suspended for in milliseconds, we report at a higher level
>> at just the entry and exit points for suspend and hibernate.
>>
>> Feature activated by CONFIG_RTC_SHOW_TIME_*
>>
>> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
>>
>> v2:
>> - merge suspend and hibernate into a single patch
> So now I guess you realize that this conflicts with
> https://patchwork.kernel.org/patch/9850217/ and it actually would make
> sense for it to go on top of that?
>
> Thanks,
> Rafael
I see. It would make sense to merge the concepts a bit since the prints
are at the same locations.
Optimization idea: rtc_show_time() in my patch series should be able to
support varargs, never be _disabled_ (CONFIG_RTC_SHOW_TIME_NONE idea is
dropped) and the function would be a drop-in replacement for pr_info,
but add the specified timestamp before the newline. Change it's name to
pr_info_show_time() instead to reflect this adjustment.
I would also prefer that the base messages in patch/980217 be "PM:
suspend entry" and "PM: suspend exit", only because I believe 1.6billion
Linux devices would not need to be retooled, and besides these messages
are shorter/sweeter.
Anyone disagree with some more over-engineering (pr_info_show_time() and
varargs)
-- Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit
2017-07-19 21:23 ` Mark Salyzyn
@ 2017-07-19 21:31 ` Rafael J. Wysocki
0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-07-19 21:31 UTC (permalink / raw)
To: Mark Salyzyn
Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Rafael J. Wysocki,
Len Brown, Pavel Machek, Linux PM, Alessandro Zummo,
Alexandre Belloni, linux-rtc
On Wed, Jul 19, 2017 at 11:23 PM, Mark Salyzyn <salyzyn@android.com> wrote:
> On 07/19/2017 01:40 PM, Rafael J. Wysocki wrote:
>>
>> On Wed, Jul 19, 2017 at 9:45 PM, Mark Salyzyn <salyzyn@android.com> wrote:
>>>
>>> Permits power state and battery life diagnosis.
>>>
>>> Since one is not guaranteed to have a persistent hardware clock to
>>> report Suspended for in milliseconds, we report at a higher level
>>> at just the entry and exit points for suspend and hibernate.
>>>
>>> Feature activated by CONFIG_RTC_SHOW_TIME_*
>>>
>>> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
>>>
>>> v2:
>>> - merge suspend and hibernate into a single patch
>>
>> So now I guess you realize that this conflicts with
>> https://patchwork.kernel.org/patch/9850217/ and it actually would make
>> sense for it to go on top of that?
>>
>> Thanks,
>> Rafael
>
>
> I see. It would make sense to merge the concepts a bit since the prints are
> at the same locations.
Exactly.
> Optimization idea: rtc_show_time() in my patch series should be able to
> support varargs, never be _disabled_ (CONFIG_RTC_SHOW_TIME_NONE idea is
> dropped) and the function would be a drop-in replacement for pr_info, but
> add the specified timestamp before the newline. Change it's name to
> pr_info_show_time() instead to reflect this adjustment.
>
> I would also prefer that the base messages in patch/980217 be "PM: suspend
> entry" and "PM: suspend exit", only because I believe 1.6billion Linux
> devices would not need to be retooled, and besides these messages are
> shorter/sweeter.
I can change the messages in patch/980217 if that helps.
> Anyone disagree with some more over-engineering (pr_info_show_time() and
> varargs)
Hmm, do it as a macro maybe?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit
@ 2017-07-19 19:48 Mark Salyzyn
0 siblings, 0 replies; 5+ messages in thread
From: Mark Salyzyn @ 2017-07-19 19:48 UTC (permalink / raw)
To: linux-kernel
Cc: rjw, len.brown, pavel, linux-pm, a.zummo, alexandre.belloni,
linux-rtc, prarit, andy.shevchenko, Mark Salyzyn
Permits power state and battery life diagnosis.
Since one is not guaranteed to have a persistent hardware clock to
report Suspended for in milliseconds, we report at a higher level
at just the entry and exit points for suspend and hibernate.
Feature activated by CONFIG_RTC_SHOW_TIME_*
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
v2:
- merge suspend and hibernate into a single patch
---
kernel/power/hibernate.c | 4 +++-
kernel/power/suspend.c | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e1914c7b85b1..0b5460f9189b 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -32,11 +32,11 @@
#include <linux/ctype.h>
#include <linux/genhd.h>
#include <linux/ktime.h>
+#include <linux/rtc.h>
#include <trace/events/power.h>
#include "power.h"
-
static int nocompress;
static int noresume;
static int nohibernate;
@@ -342,6 +342,7 @@ int hibernation_snapshot(int platform_mode)
pm_message_t msg;
int error;
+ rtc_show_time("PM: hibernation entry");
pm_suspend_clear_flags();
error = platform_begin(platform_mode);
if (error)
@@ -409,6 +410,7 @@ int hibernation_snapshot(int platform_mode)
thaw_kernel_threads();
Cleanup:
swsusp_free();
+ rtc_show_time("PM: hibernation exit");
goto Close;
}
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 3ecf275d7e44..f44d2152ab3f 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -26,6 +26,7 @@
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/ftrace.h>
+#include <linux/rtc.h>
#include <trace/events/power.h>
#include <linux/compiler.h>
#include <linux/moduleparam.h>
@@ -579,6 +580,7 @@ int pm_suspend(suspend_state_t state)
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
return -EINVAL;
+ rtc_show_time("PM: suspend entry");
error = enter_state(state);
if (error) {
suspend_stats.fail++;
@@ -586,6 +588,7 @@ int pm_suspend(suspend_state_t state)
} else {
suspend_stats.success++;
}
+ rtc_show_time("PM: suspend exit");
return error;
}
EXPORT_SYMBOL(pm_suspend);
--
2.14.0.rc0.284.gd933b75aa4-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-19 21:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19 19:45 [PATCH v2 3/4] PM: Print wall time at suspend & hibernate entry and exit Mark Salyzyn
2017-07-19 20:40 ` Rafael J. Wysocki
2017-07-19 21:23 ` Mark Salyzyn
2017-07-19 21:31 ` Rafael J. Wysocki
2017-07-19 19:48 Mark Salyzyn
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.