Hi Gerd, On Wed, Feb 04, 2009 at 05:52:04PM +0100, Gerd Hoffmann wrote: > kvmclock currently falls apart on machines without constant tsc. > This patch fixes it. Changes: > > * keep tsc frequency in a per-cpu variable. > * handle kvmclock update using a new request flag, thus checking > whenever we need an update each time we enter guest context. > * use a cpufreq notifier to track frequency changes and force > kvmclock updates. > * send ipis to kick cpu out of guest context if needed to make > sure the guest doesn't see stale values. > > Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx> > --- > arch/x86/kvm/x86.c | 99 +++++++++++++++++++++++++++++++++++++++++++--- > include/linux/kvm_host.h | 1 + > 2 files changed, 94 insertions(+), 6 deletions(-) > > + spin_lock(&kvm_lock); > + list_for_each_entry(kvm, &vm_list, vm_list) { > + for (i = 0; i < KVM_MAX_VCPUS; ++i) { > + vcpu = kvm->vcpus[i]; > + if (!vcpu) > + continue; > + if (vcpu->cpu != freq->cpu) > + continue; > + if (!kvm_request_guest_time_update(vcpu)) > + continue; > + if (vcpu->cpu != smp_processor_id()) > + send_ipi++; > + } > + } > + spin_unlock(&kvm_lock); The loop is cold hearted, but Juan's cleanups can be worked for 2.6.30 merge window. Given how many people have hit the bug better have something non invasive until then. > + > + if (freq->old < freq->new && send_ipi) { Can you fix the whitespace breakage please? > + smp_call_function_single(freq->cpu, bounce_off, NULL, 1); > + } > + return 0; > +} -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html