From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYDSd-0005sk-Tz for qemu-devel@nongnu.org; Tue, 13 Nov 2012 05:11:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TYDSa-0001Lt-RN for qemu-devel@nongnu.org; Tue, 13 Nov 2012 05:11:15 -0500 Received: from mx4-phx2.redhat.com ([209.132.183.25]:46906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYDSa-0001Ln-JU for qemu-devel@nongnu.org; Tue, 13 Nov 2012 05:11:12 -0500 Date: Tue, 13 Nov 2012 05:11:08 -0500 (EST) From: Paolo Bonzini Message-ID: <1914486608.9887816.1352801368641.JavaMail.root@redhat.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Peter Maydell , Stefan Hajnoczi , Marcelo Tosatti , qemu-devel@nongnu.org, Avi Kivity , Anthony Liguori , Jan Kiszka > > Il 05/11/2012 06:38, Liu Ping Fan ha scritto: > > > From: Liu Ping Fan > > > > > > If out of global lock, we will be challenged by SMP in low level, > > > so need atomic ops. > > > > > > This file is a wrapper of GCC atomic builtin. > > > > I still object to this. > > > > I know it enforces type-safety, but it is incomplete. It doesn't > > Although it is incomplete, but the rest cases are rarely used. Linux > faces such issue, and the "int" version is enough, so I think we can > borrow experience from there. One of the two places that use __sync_* require 64-bit accesses. My RCU prototype required pointer-sized access, which you cannot make type- safe without C++ templates. > > provide neither atomic accesses to pointers, nor useful operations such > > as exchange. It won't be used consistently, because in some places you > > just do not have an Atomic value (see both current uses of __sync_* > > builtins). > > > > If you can make it complete, and prove it by using it where > > __sync_* is > > For current code, __sync_* is used rarely, I think except the > barriers, only two places use it. We can substitute it easily. No, you cannot. See above, one doesn't use ints and the other is guest state so migration becomes complicated if you use Atomic. I'm happy to be proven wrong, however. Paolo