Re: [RFC] RTC subsystem

Simon Richter
2005-12-21T23:19:30Z

[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]

Hello,

Alessandro Zummo schrieb:

>>It would be good to have a way to change which clock is the "primary"
>>one from userspace later (userspace because this is clearly site policy).

> If I'm not wrong, the RTC is usually queried at bootup
> and written to on shutdown. If NTP mode is active,
> it is also written every 11 minutes.

A good ntpd will adjust the speed rather than write to the clock; the
ntpd shipped by most distributions can already handle multiple time sources.

I'm thinking of the case where a computer is not attached to a network
but needs accurate tim; in this case I'd give it a battery powered RTC
and a time signal receiver. As most time signals are low-bandwidth, they
may not carry full time information in each tick so it may take several
minutes to fully synchronize. In this case I'd like to use the battery
backed up clock first and switch later on when synchronized.

> I guess /proc/driver/rtc will be deprecated sooner or
> later. The /dev/rtc interface only supports one clock.
> It can either be extended to have /dev/rtcX or we
> can extend the sysfs one to allow clock updating.

/dev is the way to go IMO. As far as I've understood sysfs, it carries
meta information about devices and drivers only, the actual
communication then happens through device nodes still.

> NTP mode could then be adjusted to update one or more
> of the rtcs. Maybe each RTC could have an attribute
> (let's say /sys/class/rtc/rtcX/ntp) which tells the
> kernel whether to update it or not.

That's entirely a userspace thing. What the userspace needs to know from
the kernel is whether the clock is writable and whether its speed can be
adjusted.

> -EPERM ? -EACCESS? :)

-EIO or -ENOSYS would also be possible options.

Simon

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 374 bytes --]