From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHtis-0002sP-MX for qemu-devel@nongnu.org; Wed, 22 Jul 2015 09:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHtip-00074w-ED for qemu-devel@nongnu.org; Wed, 22 Jul 2015 09:06:10 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:36409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHtip-00074S-7F for qemu-devel@nongnu.org; Wed, 22 Jul 2015 09:06:07 -0400 Received: by wicgb10 with SMTP id gb10so97470193wic.1 for ; Wed, 22 Jul 2015 06:06:06 -0700 (PDT) Sender: Paolo Bonzini References: <20150722123811.GB13441@hawk.localdomain> From: Paolo Bonzini Message-ID: <55AF953B.2040108@redhat.com> Date: Wed, 22 Jul 2015 15:06:03 +0200 MIME-Version: 1.0 In-Reply-To: <20150722123811.GB13441@hawk.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Self-modifying test case for mttcg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones , Alexander Spyridakis Cc: mttcg@greensocs.com, Claudio Fontana , Mark Burton , Alvise Rigo , QEMU Developers , Jani Kokkonen , =?UTF-8?Q?Alex_Benn=c3=a9e?= , =?UTF-8?B?S09OUkFEIEZyw6lkw6lyaWM=?= 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. Paolo