* [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() primitive
@ 2016-11-01 20:39 Pranith Kumar
2016-11-01 20:42 ` no-reply
0 siblings, 1 reply; 2+ messages in thread
From: Pranith Kumar @ 2016-11-01 20:39 UTC (permalink / raw)
To: Paolo Bonzini, Emilio G. Cota, Alex Bennée,
Richard Henderson, open list:All patches CC here
Use __atomic_load_n() primitive saving a load and store to a local
variable.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
include/qemu/atomic.h | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 878fa07..be44094 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -120,20 +120,22 @@
* same, but this slows down atomic_rcu_read unnecessarily.
*/
#ifdef __SANITIZE_THREAD__
-#define atomic_rcu_read__nocheck(ptr, valptr) \
- __atomic_load(ptr, valptr, __ATOMIC_CONSUME);
+#define atomic_rcu_read__nocheck(ptr) \
+ __atomic_load_n(ptr, __ATOMIC_CONSUME);
#else
-#define atomic_rcu_read__nocheck(ptr, valptr) \
- __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
- smp_read_barrier_depends();
+#define atomic_rcu_read__nocheck(ptr) \
+ ({ \
+ typeof_strip_qual(*ptr) _val; \
+ __atomic_load(ptr, &_val, __ATOMIC_RELAXED); \
+ smp_read_barrier_depends(); \
+ _val; \
+ })
#endif
#define atomic_rcu_read(ptr) \
({ \
QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \
- typeof_strip_qual(*ptr) _val; \
- atomic_rcu_read__nocheck(ptr, &_val); \
- _val; \
+ atomic_rcu_read__nocheck(ptr); \
})
#define atomic_rcu_set(ptr, i) do { \
@@ -144,9 +146,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] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() primitive
2016-11-01 20:39 [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() primitive Pranith Kumar
@ 2016-11-01 20:42 ` no-reply
0 siblings, 0 replies; 2+ messages in thread
From: no-reply @ 2016-11-01 20:42 UTC (permalink / raw)
To: bobby.prani; +Cc: famz, pbonzini, cota, alex.bennee, rth, qemu-devel
Hi,
Your series seems to have some coding style problems. See output below for
more information:
Type: series
Subject: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() primitive
Message-id: 20161101203953.18065-1-bobby.prani@gmail.com
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git show --no-patch --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/1478022256-7089-1-git-send-email-wei.liu2@citrix.com -> patchew/1478022256-7089-1-git-send-email-wei.liu2@citrix.com
- [tag update] patchew/20161101171927.25684-1-sw@weilnetz.de -> patchew/20161101171927.25684-1-sw@weilnetz.de
* [new tag] patchew/20161101203953.18065-1-bobby.prani@gmail.com -> patchew/20161101203953.18065-1-bobby.prani@gmail.com
Switched to a new branch 'test'
587647b atomic.h: Use __atomic_load_n() primitive
=== OUTPUT BEGIN ===
fatal: unrecognized argument: --no-patch
Checking PATCH 1/1: ...
ERROR: memory barrier without comment
#32: FILE: include/qemu/atomic.h:130:
+ smp_read_barrier_depends(); \
total: 1 errors, 0 warnings, 40 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-01 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01 20:39 [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() primitive Pranith Kumar
2016-11-01 20:42 ` no-reply
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).