Re: [PATCH v2 23/25] timekeeping: Rework do_adjtimex() to use shadow_timekeeper

From: John Stultz
Date: Thu Oct 24 2024 - 18:26:31 EST


On Wed, Oct 9, 2024 at 1:29 AM Anna-Maria Behnsen
<anna-maria@xxxxxxxxxxxxx> wrote:
>
> From: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
>
> Updates of the timekeeper can be done by operating on the shadow timekeeper
> and afterwards copying the result into the real timekeeper. This has the
> advantage, that the sequence count write protected region is kept as small
> as possible.
>
> Convert do_adjtimex() to use this scheme and take the opportunity to use a
> scoped_guard() for locking.
>
> That requires to have a separate function for updating the leap state so
> that the update is protected by the sequence count. This also brings the
> timekeeper and the shadow timekeeper in sync for this state, which was not
> the case so far. That's not a correctness problem as the state is only used
> at the read sides which use the real timekeeper, but it's inconsistent
> nevertheless.
>
> Signed-off-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>

Again, the tk_shadow naming nit, but otherwise:
Acked-by: John Stultz <jstultz@xxxxxxxxxx>