When qemu runs on an i386 cpu with speedstep enabled the clock of the
guest os is not in sync with the clock on the host os because the
vm_timer used for irq 0 generates interrupts at wrong rate when
the host cpu frequency changes.
The problem is that the vm_timer uses the rdtsc instruction and the value
of ticks_per_sec, computed at start time, for calculating the expire time
of vm_timers. While ticks_per_sec is constant the values returned by
rdtsc are dependent on the current cpu clock, which is not constant if
speedstep is used.
The problem can be cleary observed by running "xclock -update 1" in the
guest os and observing how the clock speed varies with the cpu freqency.
The following patch fixes the problem by adding a new option -no-tsc for
the i386 architecture which can be used to disable rdtsc when running on
a cpu with speedstep enabled.
The patch works for me but I don't know if this is the best way of fixing
this bug. If anyone has a better suggestion it is welcome.