Re: [RFC patch 7/8] timekeeping: Implement a shadow timekeeper

From: John Stultz
Date: Fri Feb 22 2013 - 18:53:25 EST


On 02/21/2013 02:51 PM, Thomas Gleixner wrote:
Use the shadow timekeeper to do the update_wall_time() adjustments and
then copy it over to the real timekeeper.

Keep the shadow timekeeper in sync when updating stuff outside of
update_wall_time().

This allows us to limit the timekeeper_seq hold time to the update of
the real timekeeper and the vsyscall data in the next patch.

Signed-off-by: Thomas Gleixner<tglx@xxxxxxxxxxxxx>
---

So up to here it all looks ok to me (and not so different from my earlier attempts at the same).

The only gotcha here that I realized with my earlier patches, is that in order to do the shadow copy update properly, we are also going to need to merge the NTP state data into the timekeeper. Otherwise, we could run into odd cases where as we update the shadow copy, we change the NTP state which then would affect the non-shadow timekeeping state that is about to be updated. One example: A the leap second lands, and the tai offset gets bumped in the ntp state, while we do a similar counter adjustment to the shadow-copy. Then before the real/active timekeeper is updated, someone gets the tai offset and applies it to that pre-update timekeeper state, and gets an invalid tai time.

The down side is that the NTP state data is fairly large, and so adding it to the timekeeper will cause the memcopys to be a bit more painful.

I'm looking at the NTP code now to try to see if we can bound where the NTP state is accessed, so we can maybe thin out what ntp state is linked to timekeeper updates, and only move that data over to the timekeeper.

thanks
-john





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/