From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpLOW-00038o-Jd for qemu-devel@nongnu.org; Wed, 19 Jun 2013 12:38:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpLOT-0006jH-I5 for qemu-devel@nongnu.org; Wed, 19 Jun 2013 12:38:04 -0400 Received: from mail-vb0-x233.google.com ([2607:f8b0:400c:c02::233]:38177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpLOT-0006jD-EI for qemu-devel@nongnu.org; Wed, 19 Jun 2013 12:38:01 -0400 Received: by mail-vb0-f51.google.com with SMTP id x17so3908081vbf.10 for ; Wed, 19 Jun 2013 09:38:01 -0700 (PDT) Sender: Richard Henderson Message-ID: <51C1DE62.9090308@twiddle.net> Date: Wed, 19 Jun 2013 09:37:54 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1371675569-6516-1-git-send-email-pingfank@linux.vnet.ibm.com> <1371675569-6516-2-git-send-email-pingfank@linux.vnet.ibm.com> In-Reply-To: <1371675569-6516-2-git-send-email-pingfank@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 1/2] add a header file for atomic operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Kevin Wolf , "Paul E. McKenney" , Anthony Liguori , Andrew Haley , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , Torvald Riegel On 06/19/2013 01:59 PM, Liu Ping Fan wrote: > +#ifndef atomic_read > +#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr)) > #endif > > +#ifndef atomic_set > +#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) = (i)) > +#endif I still think these should be enhanced to reject operations larger than word-size, so that we don't accidentally introduce bugs for our 32-bit hosts. But that can be done as a follow-up. Otherwise, everything looks consistent now. Reviewed-by: Richard Henderson r~