Guest kernel can't read TSC frequency from the hypervisor

Bug #444531 reported by Radovan Pútec
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
kvm (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Binary package hint: kvm

Description of problem:
Guest kernel can't read TSC frequency from the hypervisor on hardy and interpid causing unstable TSC clocksource even if host has constant_tsc processor flag. This causes clock drifting on high load and freezing of guests with more than one cpu.

How reproducible:
Easily

Steps to Reproduce:
1. Boot host kernel with clocksource=tsc
2. Boot guest kernel with clocksource=tsc
3. dmesg | egrep "(tsc|TSC)" on guest

Actual results:
Hardy:
kernel version 2.6.24-24.53
[8739129.899892] Time: tsc clocksource has been installed.
[8739131.245835] Clocksource tsc unstable (delta = 144317765 ns)

Interpid:
kernel version: 2.6.27-14.41
[ 0.000000] TSC: Unable to calibrate against PIT
[ 0.000000] TSC: using PMTIMER reference calibration

Expected results:
kernel should read frequency from the hypervisor that results in stable TSC clocksource.

Aditional info:
I have tried this on jaunty host, but i'm not really sure if that matters, since the hypervisor supports it. Tried with CentOS 5.3, 2.6.18-164.el5 kernel and worked as expected.
relevant dmesg part from CentOS:
kvm_get_tsc_khz: cpu 0, msr 0:1101001
TSC: Frequency read from the hypervisor
Time: tsc clocksource has been installed.

Revision history for this message
Radovan Pútec (radko) wrote :
Download full text (7.6 KiB)

i just found out another thing, when the time screw occures. time cycled in 5 second loop, that meams e.g. 18:13:04 to 18:13:09 and then jumped again to 18:13:04.
when I switched to acpi_pm clocksource on guest, screw dissapeared, and everything works fine. this is a possible workaround, but acpi_pm isn't accurate enoght when you need precise timing, e.g. zaptel dummy interface.

here's another interesting thing.
host:
cat /proc/cpuinfo

processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2347 HE
stepping : 3
cpu MHz : 1900.000
cache size : 512 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good pni monitor cx16 lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs
bogomips : 3797.22
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate

processor : 1
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2347 HE
stepping : 3
cpu MHz : 1900.000
cache size : 512 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good pni monitor cx16 lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs
bogomips : 3803.82
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate

processor : 2
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2347 HE
stepping : 3
cpu MHz : 1900.000
cache size : 512 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good pni monitor cx16 lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs
bogomips : 3803.72
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate

processor : 3
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2347 HE
stepping : 3
cpu MHz : 1900.000
cache size : 512 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc ...

Read more...

Revision history for this message
Radovan Pútec (radko) wrote :

i've just find out that stable tsc isn't possible without constant_tsc processor flag, so stable tsc in guest isn't possible as well, but still with constant_tsc should work.

Thierry Carrez (ttx)
Changed in kvm (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

I was wondering if you could see if karmic is affeceted by this bug as well?

Regards
chuck

Changed in kvm (Ubuntu):
status: New → Incomplete
Revision history for this message
Radovan Pútec (radko) wrote :

in karmic TSC is marked as unstable and isn't listed in /sys/devices/system/clocksource/clocksource0/available_clocksource

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for kvm (Ubuntu) because there has been no activity for 60 days.]

Changed in kvm (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.