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~