Re: How to use /etc/adjtime
On Fri 28 Jun 2024 at 17:03:47 (-0400), Stefan Monnier wrote:
> > David has said that chrony can do fancy things involving the hardware
> > clock. Maybe you should investigate that solution path.
>
> I'm trying to find out how to fix it Right, rather than how to work
> around the problem (I already know how to work around the problem).
>
> Fixing it right requires changing the code that reads the RTC time
> upon wakeup. In any case, thank you all for your help.
> Apparently none of you have the answer I'm looking for, but you did help
> me narrow down the scope and make more precise what I'm after.
>
> Indeed I see now that the time is read from RTC to set system time
> directly by the kernel in `kernel/time/timekeeping.c` and
> `drivers/rtc/class.c`.
> So The Right Solution™ apparently involves changes to the kernel.
I can only suggest what you might investigate, as the concepts are
way above my paygrade.
All the user processes are in user.slice, as seen by:
# systemd-cgls -u user.slice
There are commands shown in man systemctl called
freeze and thaw (its inverse):
freeze PATTERN...
Freeze one or more units specified on the command line using
cgroup freezer
Freezing the unit will cause all processes contained within
the cgroup corresponding to the unit to be suspended. Being
suspended means that unit's processes won't be scheduled to
run on CPU until thawed. Note that this command is supported
only on systems that use unified cgroup hierarchy. Unit is
automatically thawed just before we execute a job against the
unit, e.g. before the unit is stopped.
So could you suspend the system by invoking a system service to
freeze the control group the appropriate unit (user.slice) first?
When the system resumes, the thawing service would be set to run
after the service that steps the clock. (Don't use slewing.)
Cheers,
David.
Reply to: