Linux Power Management development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Chen Yu <yu.c.chen@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	x86@kernel.org, John Stultz <john.stultz@linaro.org>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, Xunlei Pang <xlpang@redhat.com>,
	"3.17+" <stable@vger.kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH][RFC v5] timekeeping: Ignore the bogus sleep time if pm_trace is enabled
Date: Mon, 5 Sep 2016 09:54:20 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1609050941180.5647@nanos> (raw)
In-Reply-To: <20160904153739.GA5400@sharon>

On Sun, 4 Sep 2016, Chen Yu wrote:
> Hi Thomas, Rafael,
> On Fri, Sep 02, 2016 at 09:26:51PM +0200, Thomas Gleixner wrote:
> > On Wed, 31 Aug 2016, Rafael J. Wysocki wrote:
> > > On Monday, August 29, 2016 12:40:39 AM Chen Yu wrote:
> > > > +
> > > > +	/*
> > > > +	 * Make rtc-based persistent clock unusable
> > > > +	 * if pm_trace is enabled, only take effect
> > > > +	 * for timekeeping_suspend/resume.
> > > > +	 */
> > > > +	if (pm_trace_is_enabled() &&
> > > > +	    x86_platform.get_wallclock == mach_get_cmos_time) {
> > > > +		ts->tv_sec = 0;
> > > > +		ts->tv_nsec = 0;
> > > > +	}
> > > 
> > > I'm not sure about this.  Looks hackish.
> > 
> > Indeed. Can't you just keep track that pm_trace fiddled with the cmos clock
> > and then discard the value either in the core or in mach_get_cmos_time()
> The previous version is more straightforward, since
> it ignored the bogus rtc in core. Would you please take
> a glance at it too, thanks:
> https://patchwork.kernel.org/patch/9287347/

This is the same hackery just different:

> +bool persistent_clock_is_usable(void)
> +{
> +	/* Unusable if pm_trace is enabled. */
> +	return !((x86_platform.get_wallclock == mach_get_cmos_time) &&
> +	        pm_trace_is_enabled());
> +}

I really have no idea why this is burried in x86 land. The pm_trace hackery
issues mc146818_set_time() to fiddle with the RTC. So any implementation of
this is affected.

So that very piece of pmtrace code should keep track of the wreckage it did
to the RTC and provide the fact to the core timekeeping code which can then
skip the update.

Thanks,

	tglx

  reply	other threads:[~2016-09-05  7:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-28 16:40 [PATCH][RFC v5] timekeeping: Ignore the bogus sleep time if pm_trace is enabled Chen Yu
2016-08-31  0:31 ` Rafael J. Wysocki
2016-09-02 19:26   ` Thomas Gleixner
2016-09-04 15:37     ` Chen Yu
2016-09-05  7:54       ` Thomas Gleixner [this message]
2016-09-09  5:37         ` Chen Yu
2016-09-09 14:33           ` Thomas Gleixner
2016-09-10  9:40             ` Chen Yu

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=alpine.DEB.2.20.1609050941180.5647@nanos \
    --to=tglx@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xlpang@redhat.com \
    --cc=yu.c.chen@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox