From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch] kvmclock fix Date: Wed, 4 Feb 2009 14:17:32 -0200 Message-ID: <20090204161732.GA7821@amt.cnet> References: <498878A7.4030709@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: KVM list To: Gerd Hoffmann Return-path: Received: from mx2.redhat.com ([66.187.237.31]:38825 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264AbZBDQRs (ORCPT ); Wed, 4 Feb 2009 11:17:48 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n14GHm2B018176 for ; Wed, 4 Feb 2009 11:17:48 -0500 Content-Disposition: inline In-Reply-To: <498878A7.4030709@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Feb 03, 2009 at 06:02:31PM +0100, Gerd Hoffmann wrote: > Hi, > > Here is a patch which fixes the kvmclock on multicore systems without > constant_tsc. > > I'm not that happy with the current form as the notifier duplicates code > from tsc.c. I don't see an easy way around that though. > > Suggestions? Other review comments? > > thanks, > Gerd > + guest_mode = 0; > + 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->guest_mode) > + guest_mode++; This can race if the target vcpu has tested for vcpu->requests but not set guest_mode yet, which is acceptable for the IRQs but for this case it is not? Better always send the IPI if the bit was unset and cpu_self != target_cpu.