From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHuJr-0004AB-M7 for qemu-devel@nongnu.org; Wed, 22 Jul 2015 09:44:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHuJm-0001oN-Ka for qemu-devel@nongnu.org; Wed, 22 Jul 2015 09:44:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHuJm-0001oF-Fd for qemu-devel@nongnu.org; Wed, 22 Jul 2015 09:44:18 -0400 Date: Wed, 22 Jul 2015 15:44:12 +0200 From: Andrew Jones Message-ID: <20150722134412.GC13441@hawk.localdomain> References: <20150722123811.GB13441@hawk.localdomain> <55AF953B.2040108@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55AF953B.2040108@redhat.com> Subject: Re: [Qemu-devel] Self-modifying test case for mttcg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: mttcg@greensocs.com, Mark Burton , Alexander Spyridakis , Claudio Fontana , QEMU Developers , Alvise Rigo , Jani Kokkonen , Alex =?iso-8859-1?Q?Benn=E9e?= , KONRAD =?iso-8859-1?Q?Fr=E9d=E9ric?= On Wed, Jul 22, 2015 at 03:06:03PM +0200, Paolo Bonzini wrote: > > > On 22/07/2015 14:38, Andrew Jones wrote: > > I took a quick look at this and see issues with the test code. First, > > you're spinning on a stack variable with this, > > > > /* Wait for our turn */ > > while(next_cpu != cpu); > > > > next_cpu needs to be global, and incremented atomically. I haven't gotten > > around to adding atomic_add/inc yet, but it would easy, and I'm happy to > > do it, even yet this week. > > You can just use __sync_fetch_and_add(&next_cpu, 1) too, so we don't end > up with too much arch-specific code. Ah yes, I should take more advantage of gcc-builtins in general. drew