[systemd-devel] Support machines with multiple RTCs?

Kay Sievers kay.sievers at vrfy.org
Fri Jan 20 18:33:39 PST 2012


On Wed, Nov 23, 2011 at 04:04, Martin Langhoff
<martin.langhoff at gmail.com> wrote:
> On Nov 22, 2011 5:58 PM, "Kay Sievers" <kay.sievers at vrfy.org> wrote:
>>
>> On Tue, Nov 22, 2011 at 23:42, Martin Langhoff
>> <martin.langhoff at gmail.com> wrote:
>> > On Tue, Nov 22, 2011 at 3:21 PM, Kay Sievers <kay.sievers at vrfy.org>
>> > wrote:
>> >> Yeah, that's intentional. Udev on other platforms can't know which rtc
>> >> should be the preferred one.
>> >
>> > Well, now you can: if it says hctosys == 1, it means that the kernel
>> > config told it to pick that one, and that it's sync'd the system time
>> > to it.
>>
>> You have rtc1 set in the kernel config for your box?
>
> Correct. And rtc0 is only good for rtcwake -- won't hold "real" clock time,
> because it isn't battery-backed.
>
> "My box" is the XO-1.75 platform, of which we expect a few million will be
> produced starting soon.
>
> Future kernels may bring them up in different order, but that's a different
> pile of pain.
>
>> >> This link is mainly for backwards compat, because in earlier days it
>> >> was a real kernel device.
>> >
>> > Well, the symlink has a very practical use! If you have several RTCs,
>> > you can use udev to symlink rtc to it, and it gets htclock to DTRT.
>> >
>> > On our XO-1.75, the "real" rtc is rtc1.
>> >
>> > Next, we got to get src/utils.c to prefer "rtc" if it finds it ;-)
>>
>> I guess udev should claim /dev/rtc for the rtc device that has hctosys ==
>> 1 set?
>
> Yep. It's a trivial udev rule, perhaps belongs to Fedora's initscripts?

Nah, 'initscripts' needs a radical diet, not more random stuff in it. :)

Todo lists are there to remember things. Seems that worked well in this case. :)

Here is the systemd fix:
  http://cgit.freedesktop.org/systemd/systemd/commit/?id=51122dc9e36cdafe76a07d1ddf1a3a7e4726bb7b

and the udev fix:
  http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=6102188c93e55eba1b5dad54d27ea1ac2e8c7e73

Both use the 'system rtc' now.

Kay


More information about the systemd-devel mailing list