From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwYbp-0005cS-O9 for qemu-devel@nongnu.org; Tue, 18 Oct 2016 13:55:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwYbm-0002D4-F3 for qemu-devel@nongnu.org; Tue, 18 Oct 2016 13:55:29 -0400 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:34152) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwYbm-0002Cy-9x for qemu-devel@nongnu.org; Tue, 18 Oct 2016 13:55:26 -0400 Received: by mail-it0-x243.google.com with SMTP id e203so285564itc.1 for ; Tue, 18 Oct 2016 10:55:26 -0700 (PDT) Sender: Richard Henderson References: <20161015155348.26834-1-r@hev.cc> From: Richard Henderson Message-ID: <20f1348e-a027-f53a-d558-b471d0b19051@twiddle.net> Date: Tue, 18 Oct 2016 10:55:21 -0700 MIME-Version: 1.0 In-Reply-To: <20161015155348.26834-1-r@hev.cc> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] linux-user: Fix do_store_exclusive for shared memory of interprocess. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Heiher , qemu-devel@nongnu.org Cc: yongbok.kim@imgtec.com, Heiher , aurelien@aurel32.net On 10/15/2016 08:53 AM, Heiher wrote: > + if ((__hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0))) { \ > + if ((old) != atomic_cmpxchg(__hptr, (old), (new))) \ > + __ret = -TARGET_EAGAIN; \ > + unlock_user(__hptr, __gaddr, sizeof(target_type)); \ This doesn't perform an atomic operation, because lock_user and unlock_user copy data from and to the guest. The atomic operation you're doing is on memory private to the host. You also have to handle host byte order != target byte order. That said, we are some way toward addressing this. The patch set that Emilio pointed you at is a good start. r~