From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utyle-0002hj-5V for qemu-devel@nongnu.org; Tue, 02 Jul 2013 07:29:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Utylc-0001Ey-6k for qemu-devel@nongnu.org; Tue, 02 Jul 2013 07:29:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utylb-0001Eo-VY for qemu-devel@nongnu.org; Tue, 02 Jul 2013 07:29:04 -0400 Message-ID: <51D2B978.8070903@redhat.com> Date: Tue, 02 Jul 2013 13:28:56 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <51D29F27.9040706@siemens.com> <51D2B661.3030604@suse.de> In-Reply-To: <51D2B661.3030604@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qom: Use atomics for object refcounting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Andreas_F=E4rber?= Cc: Jan Kiszka , Liu Ping Fan , qemu-devel Il 02/07/2013 13:15, Andreas F=E4rber ha scritto: >> > @@ -683,16 +683,15 @@ GSList *object_class_get_list(const char *impl= ements_type, >> > =20 >> > void object_ref(Object *obj) >> > { >> > - obj->ref++; >> > + __sync_fetch_and_add(&obj->ref, 1); > How widespread are these in GCC/clang? Is there any fallback? I remembe= r > seeing some __sync_* warnings on Mac OS X around 4.2... We are using them already in several places (vhost was the first one to introduce them, I think, but now they are also in migration ad in some tests too). There is no fallback (asm could be a fallback, but we chose to require GCC 4.2 or newer). I'll change this to atomic_inc/dec when applying. Otherwise Reviewed-by: Paolo Bonzini Paolo