All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: x86@kernel.org
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Thomas Gleixner <tglx@linutronix.de>, Len Brown <lenb@kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	Xunlei Pang <xlpang@redhat.com>
Subject: Re: [PATCH 2/2][RFC v6] PM / sleep: save/restore RTC time after resumed if pm_trace enabled
Date: Tue, 8 Nov 2016 20:43:12 +0800	[thread overview]
Message-ID: <20161108124312.GC7191@yu-desktop-1.sh.intel.com> (raw)
In-Reply-To: <3bf82cf55c4f5ce3286f6c3fc0b2b7e4b2e5ded3.1478589736.git.yu.c.chen@intel.com>

Hi all,


On Tue, Nov 08, 2016 at 05:02:14PM +0800, Chen Yu wrote:
> Previously the bogus CMOS RTC sleep time has been ignored if pm_trace
> is enabled, however once the system successfully resumed back,
> any further read to CMOS RTC would return an error. Actually it is
> more user-friendly to bring the system back to normal after resumed.
> 
> This patch has registered an pm notifier to restore the RTC to the
> value before been overwitten by pm_trace.
> 
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Len Brown <lenb@kernel.org>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Xunlei Pang <xlpang@redhat.com>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---

Please ignore this version for now,
the atomic variable below is unnecessary since
pm_trace has disabled the async suspend.

And in order to allow the users to adjust rtc after resume,
we can clear the pm_trace_rtc_abused directly and warn users of
the broken rtc. (Without save/restore).

>  drivers/base/power/trace.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> index aa9109a..1e6c611 100644
> --- a/drivers/base/power/trace.c
> +++ b/drivers/base/power/trace.c
> @@ -10,6 +10,7 @@
>  #include <linux/pm-trace.h>
>  #include <linux/export.h>
>  #include <linux/rtc.h>
> +#include <linux/suspend.h>
>  
>  #include <linux/mc146818rtc.h>
>  
> @@ -76,6 +77,11 @@
>  
>  bool pm_trace_rtc_abused __read_mostly;
>  static unsigned int dev_hash_value;
> +struct rtc_time_save {
> +	struct rtc_time time;
> +	atomic_t saved;
> +};
>
 

      reply	other threads:[~2016-11-08 12:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08  9:00 [PATCH 0/2][RFC v6] Ignore bogus sleep time if pm_trace is enabled Chen Yu
2016-11-08  9:00 ` Chen Yu
2016-11-08  9:00 ` [rtc-linux] " Chen Yu
     [not found] ` <cover.1478589736.git.yu.c.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-08  9:01   ` [PATCH 1/2][RFC v6] timekeeping: Ignore the " Chen Yu
2016-11-08  9:01     ` Chen Yu
2016-11-08  9:01     ` [rtc-linux] " Chen Yu
     [not found]     ` <e0ed3331627184f3da6243b00cfa69dd78e85514.1478589736.git.yu.c.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-08 12:50       ` Chen Yu
2016-11-08 12:50         ` Chen Yu
2016-11-08 12:50         ` [rtc-linux] " Chen Yu
2016-11-08  9:02 ` [PATCH 2/2][RFC v6] PM / sleep: save/restore RTC time after resumed if pm_trace enabled Chen Yu
2016-11-08 12:43   ` Chen Yu [this message]

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=20161108124312.GC7191@yu-desktop-1.sh.intel.com \
    --to=yu.c.chen@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xlpang@redhat.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 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.