linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joel Daniels" <jdaniels@sent.com>
To: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Thomas Gleixner" <tglx@linutronix.de>
Cc: "John Stultz" <john.stultz@linaro.org>,
	"Stephen Boyd" <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	linux-rtc@vger.kernel.org, x86@kernel.org
Subject: Re: Time keeping while suspended in the presence of persistent clock drift
Date: Wed, 15 Dec 2021 15:05:01 -0700	[thread overview]
Message-ID: <5fb8b880-8fea-4e53-a00c-994bf4890f8a@www.fastmail.com> (raw)
In-Reply-To: <YbphWpMl7W0Qzs+d@piout.net>


>> > I would like to provide a way for user space to inform the kernel
>> > that the persistent clock drifts so it can make a corresponding
>> > adjustment when resuming from a long suspend period.
>> >
>> > In my use case it would be enough for me to set this parameter on
>> > boot. In use cases with continuous network access, NTP daemons
>> > could be enhanced to periodically update this parameter with the
>> > daemon's best estimate of the persistent clock drift.
>> 
>> That needs some thought. The RTC people (cc'ed now) might have opionions
>> on that.
>> 
>
> The RTC subsystem already has two interfaces to correct the drift of an
> RTC. However, this is currently limited to RTC that have hardware
> support for this feature. I guess we could had software emulation of the
> feature to be able to correct for any RTCs  but this will raise many
> design questions, like how often the correction has to happen, what to
> do with RTC that have a counter that doesn't reset when setting their
> time, etc...
>
> I guess this would be able to solve your particular issue has you will
> need a mechanism to handle when you overshoot the regular correction
> timer.
>
> However, everything falls down once the machine is turned off, making
> the whole effort moot...

Today two mechanism are regularly used to correct for rtc drift while
the machine is powered off: the hwclock program and chronyd with the
"-s" option. They both rely on the RTC running at the same rate when
the machine is on or off. So I agree with you that trying to emulate
hardware RTC drift correction in software is not going to work well.

      reply	other threads:[~2021-12-15 22:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5af5d2a5-767c-d313-3be6-cb6f426f1980@sent.com>
     [not found] ` <b074f506-2568-4506-9557-4a9bc9cbea83@www.fastmail.com>
     [not found]   ` <87wnkbuuuz.ffs@tglx>
     [not found]     ` <4bb238e1-e8fa-44e6-9f5e-d047d1d4a892@www.fastmail.com>
2021-12-14 13:57       ` Time keeping while suspended in the presence of persistent clock drift Thomas Gleixner
2021-12-14 17:43         ` Joel Daniels
2021-12-15 21:06           ` John Stultz
2021-12-15 21:32             ` Alexandre Belloni
2021-12-15 22:02               ` John Stultz
2021-12-15 22:33                 ` Thomas Gleixner
2021-12-15 23:10                   ` John Stultz
2021-12-15 22:42             ` Joel Daniels
2021-12-15 23:26               ` John Stultz
2021-12-15 23:36                 ` Alexandre Belloni
2021-12-16  0:09                   ` Joel Daniels
2021-12-15 23:28               ` Alexandre Belloni
2021-12-15 21:42         ` Alexandre Belloni
2021-12-15 22:05           ` Joel Daniels [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=5fb8b880-8fea-4e53-a00c-994bf4890f8a@www.fastmail.com \
    --to=jdaniels@sent.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).