From: Paolo Bonzini <pbonzini@redhat.com>
To: Richard Henderson <rth@twiddle.net>
Cc: Kevin Wolf <kwolf@redhat.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Andrew Haley <aph@redhat.com>, Liu Ping Fan <qemulist@gmail.com>,
qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
Torvald Riegel <triegel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/2] add a header file for atomic operations
Date: Thu, 20 Jun 2013 10:03:50 +0200 [thread overview]
Message-ID: <51C2B766.70308@redhat.com> (raw)
In-Reply-To: <51C2183D.7050605@twiddle.net>
Il 19/06/2013 22:44, Richard Henderson ha scritto:
>>> >> + /* Data must be read atomically. We don't really need barrier semantics
>>> >> + * but it's easier to use atomic_* than roll our own. */
>>> >> + log = atomic_xchg(from, 0);
>> >
>> > If you really don't need any ordering guarantees / barriers here, then
>> > using a relaxed load should be fine. But my gut feeling tells me you
>> > probably do need some barriers; either you are "re-using" another
>> > barrier (and then the comment should probably point out which), or it
>> > must be a case where it's either fine to read any value someone (else)
>> > wrote or there's no concurrent store after all.
>> >
> There is a store here, before and after. Read the value, store zero.
>
> I suppose what the comment is saying is that the atomic operation doesn't need
> to be ordered with respect to the rest of the surrounding code, as the object
> being synchronized is just that one integer.
Exactly. The items of the array can be read independently.
Paolo
next prev parent reply other threads:[~2013-06-20 8:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 20:59 [Qemu-devel] [PATCH v3 0/2] QEMUBH: make AioContext's bh re-entrant Liu Ping Fan
2013-06-19 20:59 ` [Qemu-devel] [PATCH v3 1/2] add a header file for atomic operations Liu Ping Fan
2013-06-19 16:37 ` Richard Henderson
2013-06-19 16:42 ` Paolo Bonzini
2013-06-19 20:39 ` Torvald Riegel
2013-06-19 20:44 ` Richard Henderson
2013-06-20 8:03 ` Paolo Bonzini [this message]
2013-06-19 20:59 ` [Qemu-devel] [PATCH v3 2/2] QEMUBH: make AioContext's bh re-entrant Liu Ping Fan
2013-06-20 7:39 ` Stefan Hajnoczi
2013-06-20 8:16 ` Paolo Bonzini
2013-06-20 9:12 ` liu ping fan
2013-06-20 9:19 ` Paolo Bonzini
2013-06-20 9:41 ` liu ping fan
2013-06-20 9:45 ` Paolo Bonzini
2013-06-21 4:35 ` liu ping fan
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=51C2B766.70308@redhat.com \
--to=pbonzini@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=aph@redhat.com \
--cc=kwolf@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=triegel@redhat.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).