From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Liu Ping Fan" <pingfank@linux.vnet.ibm.com>,
"Andreas Färber" <afaerber@suse.de>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] qom: Use atomics for object refcounting
Date: Tue, 02 Jul 2013 13:49:27 +0200 [thread overview]
Message-ID: <51D2BE47.7070603@redhat.com> (raw)
In-Reply-To: <51D2BD1D.6010308@siemens.com>
Il 02/07/2013 13:44, Jan Kiszka ha scritto:
> On 2013-07-02 13:28, Paolo Bonzini wrote:
>> Il 02/07/2013 13:15, Andreas Färber ha scritto:
>>>>> @@ -683,16 +683,15 @@ GSList *object_class_get_list(const char *implements_type,
>>>>>
>>>>> void object_ref(Object *obj)
>>>>> {
>>>>> - obj->ref++;
>>>>> + __sync_fetch_and_add(&obj->ref, 1);
>>> How widespread are these in GCC/clang? Is there any fallback? I remember
>>> seeing some __sync_* warnings on Mac OS X around 4.2...
>>
>> We are using them already in several places (vhost was the first one to
>> introduce them, I think, but now they are also in migration ad in some
>> tests too). There is no fallback (asm could be a fallback, but we chose
>> to require GCC 4.2 or newer).
>>
>> I'll change this to atomic_inc/dec when applying. Otherwise
>
> But then atomic_dec_and_test or so. Letting the inc/dec return some
> value leaves room for interpretations (value of before or after the
> modification?).
In qemu, I made all atomic_* functions return the old value. This is
consistent with atomic_cmpxchg and atomic_xchg (where returning the new
value makes no sense).
Paolo
next prev parent reply other threads:[~2013-07-02 11:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 9:36 [Qemu-devel] [PATCH] qom: Use atomics for object refcounting Jan Kiszka
2013-07-02 11:15 ` Andreas Färber
2013-07-02 11:28 ` Paolo Bonzini
2013-07-02 11:44 ` Jan Kiszka
2013-07-02 11:49 ` Paolo Bonzini [this message]
2013-07-02 11:52 ` Jan Kiszka
2013-07-02 12:00 ` Paolo Bonzini
2013-07-02 14:47 ` Anthony Liguori
2013-07-02 15:33 ` Paolo Bonzini
2013-07-02 16:36 ` Anthony Liguori
2013-07-03 1:23 ` liu ping fan
2013-07-03 16:36 ` Andreas Färber
2013-07-04 4:46 ` liu ping fan
2013-07-04 5:43 ` Andreas Färber
2013-07-04 7:21 ` liu ping fan
2013-07-04 7:59 ` Paolo Bonzini
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=51D2BE47.7070603@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=jan.kiszka@siemens.com \
--cc=pingfank@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.