From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zachary Amsden Subject: Re: [KVM timekeeping 03/35] Move TSC offset writes to common code Date: Mon, 23 Aug 2010 14:51:10 -1000 Message-ID: <4C73177E.3050805@redhat.com> References: <1282291669-25709-1-git-send-email-zamsden@redhat.com> <1282291669-25709-4-git-send-email-zamsden@redhat.com> <20100820170643.GB2937@mothafucka.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Avi Kivity , Marcelo Tosatti , Thomas Gleixner , John Stultz , linux-kernel@vger.kernel.org To: Glauber Costa Return-path: In-Reply-To: <20100820170643.GB2937@mothafucka.localdomain> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 08/20/2010 07:06 AM, Glauber Costa wrote: > On Thu, Aug 19, 2010 at 10:07:17PM -1000, Zachary Amsden wrote: > >> Also, ensure that the storing of the offset and the reading of the TSC >> are never preempted by taking a spinlock. While the lock is overkill >> now, it is useful later in this patch series. >> >> + spinlock_t tsc_write_lock; >> > Forgive my utter ignorance, specially if it is to become > obvious in a latter patch: This is a vcpu-local operation, > uses rdtscl, so pcpu-local too, and we don't expect > multiple writers to it at the same time. > > Why do we need this lock? > > Synchronizing access to the variables which we use to match TSC writes across multiple VCPUs.