From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: John Stultz <john.stultz@linaro.org>
Cc: Joel Daniels <jdaniels@sent.com>,
Thomas Gleixner <tglx@linutronix.de>,
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 22:32:44 +0100 [thread overview]
Message-ID: <Ybpe/ND+MQq6tqoR@piout.net> (raw)
In-Reply-To: <CALAqxLXf6TmOn_jCOv68oop=4On+CN-p_KkN-70BDt9OjQhzUw@mail.gmail.com>
On 15/12/2021 13:06:30-0800, John Stultz wrote:
> I'm not really active in this space much anymore, but a few of my
> (possibly wrongheaded) thoughts:
>
> > [A] On machines with a persistent clock how is userspace supposed
> > to be sure what drift to measure? Can it assume that the drift
> > of the persistent clock used for sleep time injection is the
> > same as the drift of /dev/rtc? This seems dangerous.
>
> Yea, there can be multiple RTCs as well.
>
> > [B] Sleep time injection can come from the "persistent clock" or,
> > if there is no persistent clock, from an RTC driver. I'd like
> > to correct for drift from the perisistant clock but not touch
> > the RTC driver sleep time injection mechanism. Is this
> > acceptable or do people feel that any drift correction should
> > work with both mechanisms in order to ensure a polished
> > interface?
>
> This dual interface comes from the desire to support both the more
> atomic/earlier correction we can do w/ the persistent_clock interface
> while holding the timekeeping lock, while also supporting RTC devices
> that may sleep when being read, or may have dependencies that aren't
> ready that early in resume.
>
> Admittedly having two separate abstractions here is a bit of a pain,
> and fixing just one side doesn't make it better.
>
> > [C] Some users may want to correct for drift during suspend-to-RAM
> > but during suspend-to-disk they might boot into some other
> > operating system which itself sets the CMOS RTC. Hopefully,
> > this could be solved from userspace by changing the drift
> > correction parameter to 0 just before a suspend-to-disk
> > operation.
>
> Oof. This feels particularly complex and fragile to try to address.
>
> > I suspect that there are other things about which I should also be
> > worried if only I were less ignorant. That is why I am asking here.
>
> Personally, I'm not sure this warrants adding new userland interfaces
> for. I'd probably lean towards having the RTC framework internally
> measure and correct for drift, rather than adding an extra knob in
> userland.
>
I'd rather lean towards the timekeeping code doing that. The RTC
subsystem doesn't know which RTC has to be used.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2021-12-15 21:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 17:55 Time keeping while suspended in the presence of persistent clock drift Joel Daniels
2021-12-09 18:06 ` Joel Daniels
2021-12-11 13:36 ` Thomas Gleixner
2021-12-13 13:39 ` Joel Daniels
2021-12-14 13:57 ` Thomas Gleixner
2021-12-14 17:43 ` Joel Daniels
2021-12-15 21:06 ` John Stultz
2021-12-15 21:32 ` Alexandre Belloni [this message]
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
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=Ybpe/ND+MQq6tqoR@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=jdaniels@sent.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