qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Pranith Kumar" <bobby.prani@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Emilio G. Cota" <cota@braap.org>,
	"Richard Henderson" <rth@twiddle.net>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire
Date: Tue, 1 Nov 2016 15:44:18 +0100	[thread overview]
Message-ID: <30876b26-957c-8861-0932-729d1f263a9a@redhat.com> (raw)
In-Reply-To: <20161101143303.19657-1-bobby.prani@gmail.com>



On 01/11/2016 15:33, Pranith Kumar wrote:
> We can use __atomic_load_n() saving a store and load from the _val.
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  include/qemu/atomic.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
> index 878fa07..6775603 100644
> --- a/include/qemu/atomic.h
> +++ b/include/qemu/atomic.h
> @@ -144,9 +144,7 @@
>  #define atomic_load_acquire(ptr)                        \
>      ({                                                  \
>      QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *));   \
> -    typeof_strip_qual(*ptr) _val;                       \
> -    __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE);        \
> -    _val;                                               \
> +    __atomic_load_n(ptr, __ATOMIC_ACQUIRE);             \
>      })
>  
>  #define atomic_store_release(ptr, i)  do {              \
> 

Can you do the same for atomic_rcu_read__nocheck (both implementations)?

Thanks,

Paolo

  reply	other threads:[~2016-11-01 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 14:33 [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire Pranith Kumar
2016-11-01 14:44 ` Paolo Bonzini [this message]
2016-11-01 14:45   ` Pranith Kumar

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=30876b26-957c-8861-0932-729d1f263a9a@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=bobby.prani@gmail.com \
    --cc=cota@braap.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).