diff mbox

[v6,07/35] linux-user: enable parallel code generation on clone

Message ID 1476214861-31658-8-git-send-email-rth@twiddle.net
State Superseded
Headers show

Commit Message

Richard Henderson Oct. 11, 2016, 7:40 p.m. UTC
From: Alex Bennée <alex.bennee@linaro.org>


The variable parallel_cpus controls the generation of thread aware
atomic code.  We only need to set it once we clone our first thread.
At this point any existing translations need to be thrown away.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Signed-off-by: Richard Henderson <rth@twiddle.net>

---
 linux-user/syscall.c | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.7.4
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0815f30..9d528bd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6144,6 +6144,14 @@  static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
         sigfillset(&sigmask);
         sigprocmask(SIG_BLOCK, &sigmask, &info.sigmask);
 
+        /* If this is our first additional thread, we need to ensure we
+         * generate code for parallel execution and flush old translations.
+         */
+        if (!parallel_cpus) {
+            parallel_cpus = true;
+            tb_flush(cpu);
+        }
+
         ret = pthread_create(&info.thread, &attr, clone_func, &info);
         /* TODO: Free new CPU state if thread creation failed.  */