X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=cpu-exec.c;h=31c089dac0a7db66ac4d6270c293d1294bbc598a;hb=035873283b3f7514ad77d409870ccfd5f9680d9e;hp=235ddeed78f7e23f533967d99cd546c722bff26d;hpb=c30d1aea1478cd55e8cfdf866afa39cd00bb4ea1;p=qemu.git diff --git a/cpu-exec.c b/cpu-exec.c index 235ddeed7..31c089dac 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -215,6 +215,14 @@ int cpu_exec(CPUArchState *env) cpu_single_env = env; + /* As long as cpu_single_env is null, up to the assignment just above, + * requests by other threads to exit the execution loop are expected to + * be issued using the exit_request global. We must make sure that our + * evaluation of the global value is performed past the cpu_single_env + * value transition point, which requires a memory barrier as well as + * an instruction scheduling constraint on modern architectures. */ + smp_mb(); + if (unlikely(exit_request)) { cpu->exit_request = 1; }