From patchwork Wed Jun 26 22:27:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 2789061 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 982209F968 for ; Wed, 26 Jun 2013 22:27:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B48282023D for ; Wed, 26 Jun 2013 22:27:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C02D920215 for ; Wed, 26 Jun 2013 22:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753337Ab3FZW1l (ORCPT ); Wed, 26 Jun 2013 18:27:41 -0400 Received: from qmta05.emeryville.ca.mail.comcast.net ([76.96.30.48]:54418 "EHLO qmta05.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753234Ab3FZW1k (ORCPT ); Wed, 26 Jun 2013 18:27:40 -0400 Received: from omta07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by qmta05.emeryville.ca.mail.comcast.net with comcast id tAPh1l0081GXsucA5ATghA; Wed, 26 Jun 2013 22:27:40 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta07.emeryville.ca.mail.comcast.net with comcast id tATe1l00F0MU7Qa8UATemn; Wed, 26 Jun 2013 22:27:39 +0000 Received: from orthanc.internal (orthanc.internal [192.168.1.24]) by mail.gonehiking.org (Postfix) with ESMTP id D950D8014A; Wed, 26 Jun 2013 16:27:42 -0600 (MDT) From: Shuah Khan To: pavel@ucw.cz, rjw@sisk.pl, len.brown@intel.com Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, shuahkhan@gmail.com Subject: [PATCH v3] power: Add warning message about incorrect system date and time after resume when pm_trace is enabled Date: Wed, 26 Jun 2013 16:27:35 -0600 Message-Id: <1372285655-2450-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.7.10.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1372285660; bh=Eejlo5LaLJLKQYld3/0Kly9dCaZxfPUIk3WGoMrIWI8=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=rEYb5PlGTfQ9x5+WWcAPb+ZobzViE+rR9QgzAqE1L7ODxUaz78sX5y9zFtw+YcWRF WmndEqgpqBm6eNIBJviB/G7yxIhdp5uB9mUCtpu83ABrgpJ4fIK6vluc904SvI/h3x ndwKRB9RiDptHR/F97RMxkrapCgB3AaTxo+Ro6FZ5XIehspNB1mL9zp02YYwL7dgbV dRZzVJmSmsHeFy9TGAhFStGeXtCzKi8lBLM9u6CZXCxoPhuiqSsoOVAElKzElQbtkq 8zhIXvNFFmNQxEBGWMel/mD1JXRFJs4vYadmf1T69dFmn3PHZ3OMkSYAx2nzxBhCuX dQRxCuaxmEtiQ== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Pavel Machek --- kernel/power/main.c | 4 ++++ 1 file changed, 4 insertions(+) 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;