From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL for-4.1 3/7] include/qemu/atomic.h: Add signal_barrier
Date: Sun, 14 Jul 2019 11:12:45 +0000 [thread overview]
Message-ID: <20190714111249.13859-4-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190714111249.13859-1-richard.henderson@linaro.org>
We have some potential race conditions vs our user-exec signal
handler that will be solved with this barrier.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/atomic.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index a6ac188188..f9cd24c899 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -88,6 +88,13 @@
#define smp_read_barrier_depends() barrier()
#endif
+/*
+ * A signal barrier forces all pending local memory ops to be observed before
+ * a SIGSEGV is delivered to the *same* thread. In practice this is exactly
+ * the same as barrier(), but since we have the correct builtin, use it.
+ */
+#define signal_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
+
/* Sanity check that the size of an atomic operation isn't "overly large".
* Despite the fact that e.g. i686 has 64-bit atomic operations, we do not
* want to use them because we ought not need them, and this lets us do a
@@ -308,6 +315,10 @@
#define smp_read_barrier_depends() barrier()
#endif
+#ifndef signal_barrier
+#define signal_barrier() barrier()
+#endif
+
/* These will only be atomic if the processor does the fetch or store
* in a single issue memory operation
*/
--
2.17.1
next prev parent reply other threads:[~2019-07-14 11:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-14 11:12 [Qemu-devel] [PULL for-4.1 0/7] tcg patch queue Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 1/7] tcg: Fix constant folding of INDEX_op_extract2_i32 Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 2/7] tcg/aarch64: Fix output of extract2 opcodes Richard Henderson
2019-07-14 11:12 ` Richard Henderson [this message]
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 4/7] tcg: Introduce set/clear_helper_retaddr Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 5/7] tcg: Remove cpu_ld*_code_ra Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 6/7] tcg: Remove duplicate #if !defined(CODE_ACCESS) Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 7/7] tcg: Release mmap_lock on translation fault Richard Henderson
2019-07-15 9:40 ` [Qemu-devel] [PULL for-4.1 0/7] tcg patch queue Peter Maydell
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=20190714111249.13859-4-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--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 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).