[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcd07f0b733a90ac3f3c43a4614967bbb3ef14ad.camel@infradead.org>
Date: Wed, 13 Mar 2024 12:29:38 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>, Peter Hilber
<peter.hilber@...nsynergy.com>
Cc: linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev,
virtio-dev@...ts.oasis-open.org, linux-arm-kernel@...ts.infradead.org,
linux-rtc@...r.kernel.org, "virtio-comment@...ts.oasis-open.org"
<virtio-comment@...ts.oasis-open.org>, "Christopher S. Hall"
<christopher.s.hall@...el.com>, Jason Wang <jasowang@...hat.com>, John
Stultz <jstultz@...gle.com>, "Michael S. Tsirkin" <mst@...hat.com>,
netdev@...r.kernel.org, Richard Cochran <richardcochran@...il.com>, Stephen
Boyd <sboyd@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Xuan Zhuo
<xuanzhuo@...ux.alibaba.com>, Marc Zyngier <maz@...nel.org>, Mark Rutland
<mark.rutland@....com>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Alessandro Zummo <a.zummo@...ertech.it>, "Ridoux, Julien"
<ridouxj@...zon.com>
Subject: Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes
On Wed, 2024-03-13 at 12:18 +0100, Alexandre Belloni wrote:
>
> I still don't know anything about virtio but under Linux, an RTC is
> always UTC (or localtime when dual booting but let's not care) and never
> accounts for leap seconds. Having an RTC and RTC driver behaving
> differently would be super inconvenient. Why don't you leave this to
> userspace?
Well yes, we don't need to expose *anything* from the hypervisor and we
can leave it all to guest userspace. We can run NTP on every single one
of *hundreds* of guests, leaving them all to duplicate the work of
calibrating the *same* underlying oscillator.
I thought we were trying to avoid that, by having the hypervisor tell
them what the time was. If we're going to do that, we need it to be
sufficiently precise (and some clients want to *know* the precision),
and above all we need it to be *unambiguous*.
If the hypervisor says that the time is 3692217600.001, then the guest
doesn't actually know *which* 3692217600.001 it is, and thus it still
doesn't know the time to an accuracy better than 1 second.
And if we start allowing the hypervisor to smear clocks in some other
underspecified ways, then we end up with errors of up to 1 second in
the clock for long periods of time *around* the leap second.
We need to avoid that ambiguity.
> I guess I'm still questioning whether this is the correct interface to
> expose the host system time instead of an actual RTC.
If an RTC device is able to report '23:59:60' as the time of day, I
suppose that *could* resolve the ambiguity. But talking to a device is
slow; we want guests to be able to know the time — accurately — with a
simple counter/tsc read and some arithmetic. Which means *paired* reads
of 'RTC' and the counter, and a precise indication of the counter
frequency.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists