From: Marcelo Tosatti Subject: Re: [PATCH] remove static declaration from wall clock version Date: Tue, 3 Mar 2009 08:21:32 -0300 Message-ID: <20090303112132.GB13997@amt.cnet> References: <1235677340-3139-1-git-send-email-glommer@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: Glauber Costa Return-path: Received: from mx2.redhat.com ([66.187.237.31]:45949 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754387AbZCCLWY (ORCPT ); Tue, 3 Mar 2009 06:22:24 -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 n23BMNpE031455 for ; Tue, 3 Mar 2009 06:22:23 -0500 Content-Disposition: inline In-Reply-To: <1235677340-3139-1-git-send-email-glommer@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Feb 26, 2009 at 02:42:20PM -0500, Glauber Costa wrote: > Matt T. Yourst noted that we're currently having a dumb > race for no reason in paravirtual wall clock. This is due > to the use of a static variable to hold the counting. > > This can race with multiple guests reading wallclock > at the same time, since the static variable value would > then be accessible to all callers. This wasn't noted > before because it is a rather rare scenario. > > Instead, just use a normal stack variable. This will > mean that each caller will have it's version written > separatedly. No need for a global counter. Applied, thanks.