diff mbox

[v3] power: Add warning message about incorrect system date and time after resume when pm_trace is enabled

Message ID 1372285655-2450-1-git-send-email-shuah.kh@samsung.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Shuah Khan June 26, 2013, 10:27 p.m. UTC
pm_trace uses the system's Real Time Clock (RTC) to save the magic number.
Reason for this is that the RTC is the only reliably available piece of
hardware during resume operations where a value can be set that will
survive a reboot.

Consequence is that after a resume (even if it is successful) your system
clock will have a value corresponding to the magic number instead of the
correct date/time! It is therefore advisable to use a program like ntp-date
or rdate to reset the correct date/time from an external time source when
using this trace option.

There is no run-time message to warn users of the consequences of enabling
pm_trace. Adding a warning message to pm_trace_store() will serve as a
reminder to users to set the system date and time after resume.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 kernel/power/main.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Pavel Machek June 26, 2013, 11:18 p.m. UTC | #1
On Wed 2013-06-26 16:27:35, Shuah Khan wrote:
> pm_trace uses the system's Real Time Clock (RTC) to save the magic number.
> Reason for this is that the RTC is the only reliably available piece of
> hardware during resume operations where a value can be set that will
> survive a reboot.
> 
> Consequence is that after a resume (even if it is successful) your system
> clock will have a value corresponding to the magic number instead of the
> correct date/time! It is therefore advisable to use a program like ntp-date
> or rdate to reset the correct date/time from an external time source when
> using this trace option.
> 
> There is no run-time message to warn users of the consequences of enabling
> pm_trace. Adding a warning message to pm_trace_store() will serve as a
> reminder to users to set the system date and time after resume.
> 
> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>

Acked-by: Pavel Machek <pavel@ucw.cz>
Rafael Wysocki June 27, 2013, 12:32 p.m. UTC | #2
On Thursday, June 27, 2013 01:18:08 AM Pavel Machek wrote:
> On Wed 2013-06-26 16:27:35, Shuah Khan wrote:
> > pm_trace uses the system's Real Time Clock (RTC) to save the magic number.
> > Reason for this is that the RTC is the only reliably available piece of
> > hardware during resume operations where a value can be set that will
> > survive a reboot.
> > 
> > Consequence is that after a resume (even if it is successful) your system
> > clock will have a value corresponding to the magic number instead of the
> > correct date/time! It is therefore advisable to use a program like ntp-date
> > or rdate to reset the correct date/time from an external time source when
> > using this trace option.
> > 
> > There is no run-time message to warn users of the consequences of enabling
> > pm_trace. Adding a warning message to pm_trace_store() will serve as a
> > reminder to users to set the system date and time after resume.
> > 
> > Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
> 
> Acked-by: Pavel Machek <pavel@ucw.cz>

Queued up for 3.11.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel/power/main.c b/kernel/power/main.c
index d77663b..480fe06 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -528,6 +528,10 @@  pm_trace_store(struct kobject *kobj, struct kobj_attribute *attr,
 
 	if (sscanf(buf, "%d", &val) == 1) {
 		pm_trace_enabled = !!val;
+		if (pm_trace_enabled) {
+			pr_warn("PM: Enabling pm_trace changes system date and time during resume.\n"
+				"PM: Correct system time has to be restored manually after resume.\n");
+		}
 		return n;
 	}
 	return -EINVAL;