Thanks Phillip.

My current source is "kvm-clock".

WHen I start my guest, it is in sync with the host clock.

Then, I chance the time on my host - using "date --set ...". I don't see the
guest update its time.
I was expecting that the guest will detect host time change and change it?

So, when the host is exporting its system time and TSC values, does it go
into the "emulated RTC" of the guest and the guest checks it only once? Or
does the guest resync its clock with the host's value periodically?

I can try to do: "hwclock --hctosys --utc" --- this is just to check. (I
have kvm-clock as my clock source though).

Thanks
-a

On Tue, Sep 13, 2011 at 2:49 AM, Philipp Hahn <h...@univention.de> wrote:

> Hello Al,
>
> I just debugged a kvmclock bug, so I claim to have some knowledge in this
> area
> now, but please take my answer with a grain of doubt.
>
> On Monday 12 September 2011 15:21:25 al pat wrote:
> > Still seeking your guidance on this. Appreciate any pointers you may
> have.
>
> You have to distiguish between the real-time-clock (RTC), which in hardware
> is
> a battery powered clock running even when your PC is powered off. Since
> it's
> slow to access, most Linux distributions read out its value once during
> boot
> using "hwclock --hctosys --utc" and than don't care about that clock any
> more
> until shutdown, when they write back the system time to the RTC
> using "... --systohc ...".
> During runtime, other methods are used for time keeping: Either by counting
> regular interrupts, using the ACPI-PM clock, or the High Performance Event
> Timer (HPET), or the Time Stamp Counter (TSC) register, or ...;
> see /sys/devices/system/clocksource/clocksource0/available_clocksource for
> a
> list of available clock sources.
>
> For virtual machines there is an additional clock source named "kvmclock",
> which uses the host clock and the TSC: The host exports its current system
> time (plus some configurable offset) and a snapshot value of TSC register
> when doing so. Than the guest can interpolate the current time by using the
> exported_system_time + scale * (current_TSC_value-snapshot_TSC_value). This
> kvmclock doesn't have anything to do with the RTC clock as far as I know.
>
> Now to your problem: You should check the value
> of /sys/devices/system/clocksource/clocksource0/current_clocksource in your
> guest. If it is somethong other than kvmclock, you should if
> using "hwclock --hctosys --utc" re-synchronizes your guest clock to the
> host.
>
> Sincerely
> Philipp
> --
> Philipp Hahn           Open Source Software Engineer
> h...@univention.de
> Univention GmbH        Linux for Your Business        fon: +49 421 22 232-
> 0
> Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22
> 232-99
>
> http://www.univention.de/
>
> ----------------------------------------------------------------------------
> Treffen Sie Univention auf der IT&Business vom 20. bis 22. September 2011
> auf dem Gemeinschaftsstand der Open Source Business Alliance in Stuttgart
> in
> Halle 3 Stand 3D27-7.
>

Reply via email to