From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5skY-0007Jg-2N for qemu-devel@nongnu.org; Thu, 26 May 2016 06:42:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5skR-0005Xf-86 for qemu-devel@nongnu.org; Thu, 26 May 2016 06:42:45 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:36413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5skR-0005XZ-04 for qemu-devel@nongnu.org; Thu, 26 May 2016 06:42:39 -0400 Received: by mail-lf0-x241.google.com with SMTP id d132so5666766lfb.3 for ; Thu, 26 May 2016 03:42:38 -0700 (PDT) References: From: Sergey Fedorov Message-ID: <5746D31C.3070500@gmail.com> Date: Thu, 26 May 2016 13:42:36 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] qemu-arm-static, multiprocess, atomic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Epler , qemu-devel@nongnu.org, Paolo Bonzini , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Richard Henderson , Riku Voipio , Blue Swirl On 25/05/16 15:34, Jeff Epler wrote: > Hi. Before I take the time to prepare a detailed bug report, I wanted to > ask whether I'm doing something that is expected to work, or expected not > to work. > > I am a developer of the LinuxCNC, Free and Open Source software for control > of milling machines, lathes, and so forth. > > Our software uses an IPC model where multiple processes share a > memory-mapped region which contains data as well as mutexes to manipulate > the data (using gcc intrinsics like > __sync_fetch_and_or). > > On real multiprocessor ARM systems, our testsuite passes, but when running > in a debian schroot using qemu-arm-static it regularly deadlocks, > apparently with two processes both trying to take the same mutex in a > shared memory region. > > From what I have been able to tell, the emulation of atomics in qemu is > based on a single-process, multi-thread model (based on start_exclusive() > in linux-user/main.c, > http://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/main.c;h=95ed11d85c1#l160) > so right now I think that our code is expected not to work on qemu-user. > If that's the case, for our purposes I will simply document that while our > software can be built in a qemu-user environment, it cannot be used and its > testsuite experiences spurious failures. > > Thanks for your time, > Jeff Hi Jeff, Looks like you are right that ARM exclusive access implementation in QEMU implies a single-process, multi-thread model and it's not supposed to work for your use-case. I'm afraid even our recent efforts in multi-threaded TCG won't change the situation. The problem is that it would require to translate somehow ARM's exclusive access monitor to x86 model. Kind regards, Sergey