From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya1BG-000778-I6 for qemu-devel@nongnu.org; Mon, 23 Mar 2015 08:10:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ya1BA-0002Yp-Ug for qemu-devel@nongnu.org; Mon, 23 Mar 2015 08:10:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya1BA-0002YD-QL for qemu-devel@nongnu.org; Mon, 23 Mar 2015 08:10:00 -0400 Message-ID: <55100294.8040204@redhat.com> Date: Mon, 23 Mar 2015 13:09:56 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1426952091-18019-1-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] rcutorture: fix compilation on 32-bit ppc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , =?UTF-8?B?QW5kcmVhcyBGw6RyYmU=?= =?UTF-8?B?cg==?= On 21/03/2015 16:44, Peter Maydell wrote: > On 21 March 2015 at 15:34, Paolo Bonzini wrote: >> 32-bit PPC cannot do atomic operations on long long. Inside the loops, >> we are already using local counters that are summed at the end of >> the run---with one exception in rcu_read_stress_test: fix it to use >> the same technique. Then, use a mutex to protect the global counts. >> Performance does not matter there because every thread will only enter >> the critical section once. >> >> Remaining uses of atomic instructions are for ints or pointers. > > I don't suppose there's a way to make the atomic functions > enforce that 'not for anything that larger than pointer type', > is there? It would be nice if this kind of bug caused compile > failures on all 32-bit systems rather than only ppc-32... Yes, it should be possible (e.g. with __builtin_choose_expr or with a statement expression that includes QEMU_BUILD_BUG_ON). Paolo