|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [PATCH] linux-user: Fix do_store_exclusive for shared memory of interprocess. |
Date: | Tue, 18 Oct 2016 10:55:21 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |