Re: 11 minute RTC update (was Re: Remove RTC UIP)

From: Bryan Henderson
Date: Wed Mar 29 2006 - 12:30:06 EST


> I think it isn't. Ideally ntpd should open /dev/rtcX and write the
> time, but I'm not sure if it belongs to it or if a simple
> hwclock --systohc /dev/rtcX should be used.

It makes a lot more sense to use hwclock than to duplicate its
function in ntpd. Besides the downside of having to maintain two
programs that do the same thing, it creates a difficult interaction
problem if a user uses both, because hwclock tries to work with the
systematic drift rate of the clock, and if hwclock is not the only
thing setting it, it can get all messed up. hwclock contains special
code today to notice that the kernel is interfering (adjtimex()
reports that information), but it really would rather not, and I think
it would be even messier if the interference came from outside the
kernel.

I'm not sure ntpd even should be involved with this. It seems to me
cleaner to keep maintaining of the Linux clock and maintaining of the
hardware clock separate. On my own system, I simply have cron do a
hwclock --systohc once a week, independent of what keeps the system
clock accurate. Some people do it at shutdown time as well. (You
don't have to set the clock every 11 minutes if you're keeping track
of systematic drift like hwclock does).

Concerning migration: ntpd presently tells the kernel to go into 11
minute mode (I think technically, it tells the kernel that it is
keeping the system time accurate and based on that information, the
kernel takes the opportunity to keep the hardware clock accurate as
well, but I think it's practically equivalent). So that suggests a
migration path: Step 1: ntpd stops using that flag; Step 2: kernel
issues warning if someone uses the flag; Step 3: kernel ignores the
flag. For 1), ntpd issues a warning that nobody's minding the
hardware clock unless you pass an option telling it to do hwclock
--systohc or that you're handling the issue and ntpd needn't warn you
about it. I like the latter better.


BTW, I am the maintainer of hwclock. This is the first I've heard of
this discussion, but I have always been a supporter of the kernel
getting out of the hardware clock maintenance business. What's this
about multiple RTC's?

--
Bryan Henderson Phone 408-621-2000
San Jose, California
-
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/