-
- Downloads
Document clock::time() and fix its implementation on kvmclock
Our clock::time() function returns the current wall-clock time (number of nanoseconds since the Unix epoch). We never clearly documented this, so this patch adds this documentation. Moreover, in kvmclock, we assumed that the host never adjusts its wall-clock time, which is not a good assumption because it prevents us from benefiting from NTP running on the host. As Avi Kivity explains: "For the wall clock, you need to sample the wall clock base every time, since it can be changed by the host." So this patch changes kvmclock::time() to sample the wall-clock-at-boot reported by the paravirtual clock, on every time() call, and not just once. The downsite of this patch is that clock::get::time(), and therefore nanotime(), become a bit slower on kvmclock, as they need to sample the wall_clock_boot() every time, require a couple of barriers and arithmetic operations. But note that we shouldn't even be using the non-monotonic clock::get::time() for our timers - we should be using the monotonic clock::get::uptime() - and when we switch to using that we'll get back the bit of performance lost in this patch. Signed-off-by:Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Loading
Please register or sign in to comment