aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2016-10-05 11:13:04 -0700
committerRichard Henderson <rth@twiddle.net>2016-10-26 08:29:00 -0700
commitb67cb68ba59fd36076e5961139cb3c953c69bed0 (patch)
tree503ffaa7f6d893be72ee7cdd74c08374f9a542f7 /linux-user/syscall.c
parentfdbc2b5722f6092e47181a947c90fd4bdcc1c121 (diff)
linux-user: enable parallel code generation on clone
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. Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index db697c0bf3..7b77503f94 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6164,6 +6164,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. */