public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* recommended clock source
@ 2009-08-03  1:52 Kent Tong
  2009-08-03  7:01 ` Dor Laor
  0 siblings, 1 reply; 6+ messages in thread
From: Kent Tong @ 2009-08-03  1:52 UTC (permalink / raw)
  To: kvm

Hi,

It seems to be an unsettled issue, but, would any kind soul suggest the current
best practice for setting the clock in Ubuntu Linux and Windows guests?

Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recommended clock source
  2009-08-03  1:52 recommended clock source Kent Tong
@ 2009-08-03  7:01 ` Dor Laor
  2009-08-03  8:11   ` Antoine Martin
  0 siblings, 1 reply; 6+ messages in thread
From: Dor Laor @ 2009-08-03  7:01 UTC (permalink / raw)
  To: Kent Tong; +Cc: kvm

On 08/03/2009 04:52 AM, Kent Tong wrote:
> Hi,
>
> It seems to be an unsettled issue, but, would any kind soul suggest the current
> best practice for setting the clock in Ubuntu Linux and Windows guests?

For Linux the best source clock is the kvm pv clock (exist from 2.6.27 
and above).

For windows, standard acpi HAL uses the rtc clock by default. As long as 
you use the -rtc-td-hack it won't drift.

When the tsc is not stable on the host or the host cpu might get into 
deep sleep state (c2), you better use another source clock in the guest 
- for windows it should be the pmtimer (using the boot.ini).

>
> Thanks!
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recommended clock source
  2009-08-03  7:01 ` Dor Laor
@ 2009-08-03  8:11   ` Antoine Martin
  2009-08-03  8:29     ` Dor Laor
  0 siblings, 1 reply; 6+ messages in thread
From: Antoine Martin @ 2009-08-03  8:11 UTC (permalink / raw)
  To: dlaor; +Cc: Kent Tong, kvm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

Dor Laor wrote:
> On 08/03/2009 04:52 AM, Kent Tong wrote:
>> Hi,
>>
>> It seems to be an unsettled issue, but, would any kind soul suggest
>> the current
>> best practice for setting the clock in Ubuntu Linux and Windows guests?
> 
> For Linux the best source clock is the kvm pv clock (exist from 2.6.27
> and above).
# qemu-system-x86_64 -clock ?
Available alarm timers, in order of precedence:
dynticks
hpet
rtc
unix

I see no "pv clock"...
Which one should I use then?
Did I miss a ./configure or .config option?

Cheers
Antoine

> 
> For windows, standard acpi HAL uses the rtc clock by default. As long as
> you use the -rtc-td-hack it won't drift.
> 
> When the tsc is not stable on the host or the host cpu might get into
> deep sleep state (c2), you better use another source clock in the guest
> - for windows it should be the pmtimer (using the boot.ini).
> 
>>
>> Thanks!
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREKAAYFAkp2m8AACgkQGK2zHPGK1rtQmACeM7UQJZS8TqVjqixZANKBm2gJ
kzMAnAxNjQj73tgRyxhP99dpQ0CpWXLW
=HWG8
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recommended clock source
  2009-08-03  8:11   ` Antoine Martin
@ 2009-08-03  8:29     ` Dor Laor
  2009-08-03  9:09       ` Antoine Martin
  0 siblings, 1 reply; 6+ messages in thread
From: Dor Laor @ 2009-08-03  8:29 UTC (permalink / raw)
  To: Antoine Martin; +Cc: Kent Tong, kvm

On 08/03/2009 11:11 AM, Antoine Martin wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Hi,
>
> Dor Laor wrote:
>> On 08/03/2009 04:52 AM, Kent Tong wrote:
>>> Hi,
>>>
>>> It seems to be an unsettled issue, but, would any kind soul suggest
>>> the current
>>> best practice for setting the clock in Ubuntu Linux and Windows guests?
>> For Linux the best source clock is the kvm pv clock (exist from 2.6.27
>> and above).
> # qemu-system-x86_64 -clock ?
> Available alarm timers, in order of precedence:
> dynticks
> hpet
> rtc
> unix
>
> I see no "pv clock"...
> Which one should I use then?
> Did I miss a ./configure or .config option?

No, we were talking about different clocks.
I was explaining the guest source clock while you wanted some info for 
the host-qemu clock.

You can use the default - dynticks. hpet and rtc might be good if you 
need a fine grain granularity on older < 2.6.24 host kernels.

>
> Cheers
> Antoine
>
>> For windows, standard acpi HAL uses the rtc clock by default. As long as
>> you use the -rtc-td-hack it won't drift.
>>
>> When the tsc is not stable on the host or the host cpu might get into
>> deep sleep state (c2), you better use another source clock in the guest
>> - for windows it should be the pmtimer (using the boot.ini).
>>
>>> Thanks!
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEAREKAAYFAkp2m8AACgkQGK2zHPGK1rtQmACeM7UQJZS8TqVjqixZANKBm2gJ
> kzMAnAxNjQj73tgRyxhP99dpQ0CpWXLW
> =HWG8
> -----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recommended clock source
  2009-08-03  8:29     ` Dor Laor
@ 2009-08-03  9:09       ` Antoine Martin
  2009-08-03  9:33         ` Dor Laor
  0 siblings, 1 reply; 6+ messages in thread
From: Antoine Martin @ 2009-08-03  9:09 UTC (permalink / raw)
  To: dlaor; +Cc: Kent Tong, kvm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

>>>>> It seems to be an unsettled issue, but, would any kind soul suggest
>>>>> the current
>>>>> best practice for setting the clock in Ubuntu Linux and Windows guests?
>>>> For Linux the best source clock is the kvm pv clock (exist from 2.6.27
>>>> and above).
> # qemu-system-x86_64 -clock ?
> Available alarm timers, in order of precedence:
> dynticks
> hpet
> rtc
> unix
> 
> I see no "pv clock"...
> Which one should I use then?
> Did I miss a ./configure or .config option?
> 
>> No, we were talking about different clocks.
>> I was explaining the guest source clock while you wanted some info for
>> the host-qemu clock.
Hah, gotcha. You're talking about the guest kernel as in:
 clocksource=[hpet|pit|tsc|acpi_pm|cyclone|scx200_hrt|kvm-clock]

# cat /sys/devices/system/clocksource/clocksource0/current_clocksource
kvm-clock

So all good, thanks.

>> You can use the default - dynticks. hpet and rtc might be good if you
>> need a fine grain granularity on older < 2.6.24 host kernels.
(I'm on dynticks)
I guess dynticks reduces context switches on the host, but I still get
hundreds per second on guests that are otherwise idle.
How would I go about finding what makes them tick?

Thanks
Antoine

> 
> 
> Cheers
> Antoine
> 
>>>> For windows, standard acpi HAL uses the rtc clock by default. As long as
>>>> you use the -rtc-td-hack it won't drift.
>>>>
>>>> When the tsc is not stable on the host or the host cpu might get into
>>>> deep sleep state (c2), you better use another source clock in the guest
>>>> - for windows it should be the pmtimer (using the boot.ini).
>>>>
>>>>> Thanks!
>>>>>
>>>>> -- 
>>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>>>> the body of a message to majordomo@vger.kernel.org
>>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>> -- 
>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREKAAYFAkp2qT0ACgkQGK2zHPGK1rsSRQCfdGzkV8Gu+pTkZcnpXivXKQlt
IrsAmwZAbfLzdyiWckoi80iwqc/k+0uA
=Qt5o
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recommended clock source
  2009-08-03  9:09       ` Antoine Martin
@ 2009-08-03  9:33         ` Dor Laor
  0 siblings, 0 replies; 6+ messages in thread
From: Dor Laor @ 2009-08-03  9:33 UTC (permalink / raw)
  To: Antoine Martin; +Cc: Kent Tong, kvm

On 08/03/2009 12:09 PM, Antoine Martin wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
>>>>>> It seems to be an unsettled issue, but, would any kind soul suggest
>>>>>> the current
>>>>>> best practice for setting the clock in Ubuntu Linux and Windows guests?
>>>>> For Linux the best source clock is the kvm pv clock (exist from 2.6.27
>>>>> and above).
>> # qemu-system-x86_64 -clock ?
>> Available alarm timers, in order of precedence:
>> dynticks
>> hpet
>> rtc
>> unix
>>
>> I see no "pv clock"...
>> Which one should I use then?
>> Did I miss a ./configure or .config option?
>>
>>> No, we were talking about different clocks.
>>> I was explaining the guest source clock while you wanted some info for
>>> the host-qemu clock.
> Hah, gotcha. You're talking about the guest kernel as in:
>   clocksource=[hpet|pit|tsc|acpi_pm|cyclone|scx200_hrt|kvm-clock]
>
> # cat /sys/devices/system/clocksource/clocksource0/current_clocksource
> kvm-clock
>
> So all good, thanks.
>
>>> You can use the default - dynticks. hpet and rtc might be good if you
>>> need a fine grain granularity on older<  2.6.24 host kernels.
> (I'm on dynticks)
> I guess dynticks reduces context switches on the host, but I still get
> hundreds per second on guests that are otherwise idle.
> How would I go about finding what makes them tick?

You can use the kvm_stat script to check the guest activity.

As for host timers, you can use sudo strace  -e trace=signal -c -p 
`pgrep qemu` to get the number of SIGALRM  calls.
You can reduce this number since there is a threshold in qemu for the 
dyntick.

My winXp guest does the following:
sudo strace  -c -p `pgrep qemu`
Process 14241 attached - interrupt to quit
^CProcess 14241 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
  82.46    0.089660          19      4801           select
  14.51    0.015775          33       480           futex
   1.70    0.001847           0      9511      4804 read
   0.72    0.000787           1       824           ioctl
   0.23    0.000246           0      2361           write
   0.19    0.000211           0      2463           timer_gettime
   0.13    0.000144           0      2361           rt_sigaction
   0.06    0.000066           0      2377           timer_settime
   0.00    0.000000           0         3           poll
   0.00    0.000000           0         3           writev
------ ----------- ----------- --------- --------- ----------------
100.00    0.108736                 25184      4804 total


>
> Thanks
> Antoine
>
>>
>> Cheers
>> Antoine
>>
>>>>> For windows, standard acpi HAL uses the rtc clock by default. As long as
>>>>> you use the -rtc-td-hack it won't drift.
>>>>>
>>>>> When the tsc is not stable on the host or the host cpu might get into
>>>>> deep sleep state (c2), you better use another source clock in the guest
>>>>> - for windows it should be the pmtimer (using the boot.ini).
>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> --
>>>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>>>>> the body of a message to majordomo@vger.kernel.org
>>>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>>>> the body of a message to majordomo@vger.kernel.org
>>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEAREKAAYFAkp2qT0ACgkQGK2zHPGK1rsSRQCfdGzkV8Gu+pTkZcnpXivXKQlt
> IrsAmwZAbfLzdyiWckoi80iwqc/k+0uA
> =Qt5o
> -----END PGP SIGNATURE-----
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-03  9:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-03  1:52 recommended clock source Kent Tong
2009-08-03  7:01 ` Dor Laor
2009-08-03  8:11   ` Antoine Martin
2009-08-03  8:29     ` Dor Laor
2009-08-03  9:09       ` Antoine Martin
2009-08-03  9:33         ` Dor Laor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox