qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Heiher <r@hev.cc>, qemu-devel@nongnu.org
Cc: yongbok.kim@imgtec.com, Heiher <wangr@lemote.com>, aurelien@aurel32.net
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	[thread overview]
Message-ID: <20f1348e-a027-f53a-d558-b471d0b19051@twiddle.net> (raw)
In-Reply-To: <20161015155348.26834-1-r@hev.cc>

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~

      parent reply	other threads:[~2016-10-18 17:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 15:53 [Qemu-devel] [PATCH] linux-user: Fix do_store_exclusive for shared memory of interprocess Heiher
2016-10-15 16:04 ` no-reply
2016-10-16 20:34 ` Emilio G. Cota
2016-10-18 17:55 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20f1348e-a027-f53a-d558-b471d0b19051@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=r@hev.cc \
    --cc=wangr@lemote.com \
    --cc=yongbok.kim@imgtec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).