* [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire
@ 2016-11-01 14:33 Pranith Kumar
2016-11-01 14:44 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Pranith Kumar @ 2016-11-01 14:33 UTC (permalink / raw)
To: Paolo Bonzini, Alex Bennée, Emilio G. Cota,
Richard Henderson, open list:All patches CC here
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 { \
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire
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
2016-11-01 14:45 ` Pranith Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2016-11-01 14:44 UTC (permalink / raw)
To: Pranith Kumar, Alex Bennée, Emilio G. Cota,
Richard Henderson, open list:All patches CC here
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire
2016-11-01 14:44 ` Paolo Bonzini
@ 2016-11-01 14:45 ` Pranith Kumar
0 siblings, 0 replies; 3+ messages in thread
From: Pranith Kumar @ 2016-11-01 14:45 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Alex Bennée, Emilio G. Cota, Richard Henderson,
open list:All patches CC here
On Tue, Nov 1, 2016 at 10:44 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Can you do the same for atomic_rcu_read__nocheck (both implementations)?
>
Sure, will send an updated patch.
--
Pranith
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-01 14:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-11-01 14:45 ` Pranith Kumar
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).