From: Joel Daniels <jdaniels@sent.com>
To: John Stultz <john.stultz@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@kernel.org>
Cc: Joel Daniels <jdaniels@sent.com>, linux-kernel@vger.kernel.org
Subject: Time keeping while suspended in the presence of persistent clock drift
Date: Thu, 9 Dec 2021 10:55:53 -0700 [thread overview]
Message-ID: <5af5d2a5-767c-d313-3be6-cb6f426f1980@sent.com> (raw)
Hi,
I have an x86 laptop whose CMOS (RTC) clock gains an extra 3.75 seconds
per day that it is suspended (S3) or off. It keeps time quite accurately
while awake using the TSC clock source. I use the machine about 1 hour
per day with the machine in the S3 sleep state for the remaining 23
hours. The machine is not usually connected to a network and I do not
run an NTP daemon (though I do not believe this is relevant). When cold
booting, I correct for the CMOS clock drift using hwclock before making
the filesystem writable. When resuming from suspend-to-ram (S3),
however, I must either use hwclock again (causing the system time to
jump backwards and potentially upsetting programs like make) or use a
large slew rate (absolute value greater than 1000 PPM) to correct the
system clock. As far as I can tell there is currently no way to inform
the kernel of my CMOS clock drift. Is this correct? I am considering
writing a patch to make the kernel compensate for the drift of the
persistent and/or RTC clock(s) when injecting sleep time. The patch
would require user space to inform the kernel of the drift (probably via
sysfs). Does this seem like a good approach? Regards, Joel Daniels
next reply other threads:[~2021-12-09 17:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 17:55 Joel Daniels [this message]
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
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=5af5d2a5-767c-d313-3be6-cb6f426f1980@sent.com \
--to=jdaniels@sent.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®