From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 1/5] Add a global synchronization point for pvclock Date: Mon, 19 Apr 2010 16:46:51 +0200 Message-ID: <1271688411.1488.248.camel@laptop> References: <1271356648-5108-1-git-send-email-glommer@redhat.com> <1271356648-5108-2-git-send-email-glommer@redhat.com> <4BC8CA52.4090703@goop.org> <1271673545.1674.743.camel@laptop> <4BCC3584.1050501@redhat.com> <1271675100.1674.818.camel@laptop> <4BCC3A3E.9070909@redhat.com> <20100419142158.GD14158@mothafucka.localdomain> <4BCC69D5.3050209@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Glauber Costa , Jeremy Fitzhardinge , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Marcelo Tosatti , Zachary Amsden To: Avi Kivity Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:37364 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281Ab0DSOqy (ORCPT ); Mon, 19 Apr 2010 10:46:54 -0400 Received: from f199130.upc-f.chello.nl ([80.56.199.130] helo=dyad.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux)) id 1O3sFS-0001Va-Az for kvm@vger.kernel.org; Mon, 19 Apr 2010 14:46:54 +0000 In-Reply-To: <4BCC69D5.3050209@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2010-04-19 at 17:33 +0300, Avi Kivity wrote: > On 04/19/2010 05:21 PM, Glauber Costa wrote: > > > >> Oh yes, just trying to avoid a patch with both atomic64_read() and > >> ACCESS_ONCE(). > >> > > you're mixing the private version of the patch you saw with this one. > > there isn't any atomic reads in here. I'll use a barrier then > > > > This patch writes last_value atomically, but reads it non-atomically. A > barrier is insufficient. What avi says! :-) On a 32bit machine a 64bit read are two 32bit reads, so last = last_value; becomes: last.high = last_value.high; last.low = last_vlue.low; (or the reverse of course) Now imagine a write getting interleaved with that ;-)