[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/7] cpu-exec: tighten barrier on TCG_EXIT_REQUESTED
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 2/7] cpu-exec: tighten barrier on TCG_EXIT_REQUESTED |
Date: |
Sun, 29 Jan 2017 22:09:05 +0100 |
This seems to have worked just fine so far on weakly-ordered
architectures, but I don't see anything that prevents the
reordering from:
store 1 to exit_request
store 1 to tcg_exit_req
load tcg_exit_req
store 0 to tcg_exit_req
load exit_request
store 0 to exit_request
store 1 to exit_request
store 1 to tcg_exit_req
to this:
store 1 to exit_request
store 1 to tcg_exit_req
load tcg_exit_req
load exit_request
store 1 to exit_request
store 1 to tcg_exit_req
store 0 to tcg_exit_req
store 0 to exit_request
therefore losing a request. It's possible that other memory barriers
(e.g. in rcu_read_unlock) are hiding it, but better safe than
sorry.
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpu-exec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index 2dc10c1..4065e0e 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -552,11 +552,11 @@ static inline void cpu_loop_exec_tb(CPUState *cpu,
TranslationBlock *tb,
* have set something else (eg exit_request or
* interrupt_request) which we will handle
* next time around the loop. But we need to
- * ensure the tcg_exit_req read in generated code
+ * ensure the zeroing of tcg_exit_req (see cpu_tb_exec)
* comes before the next read of cpu->exit_request
* or cpu->interrupt_request.
*/
- smp_rmb();
+ smp_mb();
*last_tb = NULL;
break;
case TB_EXIT_ICOUNT_EXPIRED:
--
2.9.3
- [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases, Paolo Bonzini, 2017/01/29
- [Qemu-devel] [PATCH 2/7] cpu-exec: tighten barrier on TCG_EXIT_REQUESTED,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 1/7] cpu-exec: fix jmp_first out-of-bounds access with icount, Paolo Bonzini, 2017/01/29
- [Qemu-devel] [PATCH 5/7] cpu-exec: remove outermost infinite loop, Paolo Bonzini, 2017/01/29
- [Qemu-devel] [PATCH 4/7] cpu-exec: avoid repeated sigsetjmp on interrupts, Paolo Bonzini, 2017/01/29
- [Qemu-devel] [PATCH 3/7] cpu-exec: avoid cpu_loop_exit in cpu_handle_interrupt, Paolo Bonzini, 2017/01/29
- [Qemu-devel] [PATCH 6/7] cpu-exec: unify icount_decr and tcg_exit_req, Paolo Bonzini, 2017/01/29
- [Qemu-devel] [PATCH 7/7] cpu-exec: centralize exiting to the main loop, Paolo Bonzini, 2017/01/29
- Re: [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases, no-reply, 2017/01/29
- Re: [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases, Pavel Dovgalyuk, 2017/01/31