From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UothH-0001xX-1z for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:03:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UothC-0006Hx-Cw for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:03:34 -0400 Received: from mail-yh0-x234.google.com ([2607:f8b0:4002:c01::234]:56727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UothC-0006Ht-8c for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:03:30 -0400 Received: by mail-yh0-f52.google.com with SMTP id f10so1432344yha.39 for ; Tue, 18 Jun 2013 04:03:29 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51C03E7B.9050503@redhat.com> Date: Tue, 18 Jun 2013 13:03:23 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1371381681-14252-1-git-send-email-pingfanl@linux.vnet.ibm.com> <1371381681-14252-2-git-send-email-pingfanl@linux.vnet.ibm.com> <51BF5C0F.6020209@twiddle.net> <51C01C0E.5030501@redhat.com> In-Reply-To: <51C01C0E.5030501@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/2] add a header file for atomic operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Liu Ping Fan , Anthony Liguori , Richard Henderson Il 18/06/2013 10:36, Paolo Bonzini ha scritto: > Important Note: Note that it is important for both threads to access > the same volatile variable in order to properly set up the happens-before > relationship. It is not the case that everything visible to thread A > when it writes volatile field f becomes visible to thread B after it > reads volatile field g. The release and acquire have to "match" (i.e., > be performed on the same volatile field) to have the right semantics. > > Is this final "important note" the difference between ACQ_REL and SEQ_CST? Based on what I read now, I think I want ACQ_REL for atomic_mb_{read,set}. One can still get SEQ_CST with atomic_xchg (for sets) or atomic_add (adding 0, for reads). Paolo