]> Pileus Git - ~andy/linux/commitdiff
PM / Sleep: Warn about system time after resume with pm_trace
authorShuah Khan <shuah.kh@samsung.com>
Wed, 26 Jun 2013 22:27:35 +0000 (16:27 -0600)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 27 Jun 2013 20:14:46 +0000 (22:14 +0200)
pm_trace uses the system's Real Time Clock (RTC) to save the magic
number.  The 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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/main.c

index 0828070d38b4dfc58f34a88c0b11c7c9b6708104..1d1bf630e6e900d5354413a6176b60b6a948a979 100644 (file)
@@ -530,6 +530,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;