Skip to content

Commit

Permalink
linux-user: enable parallel code generation on clone
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stsquad authored and rth7680 committed Oct 26, 2016
1 parent fdbc2b5 commit b67cb68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions linux-user/syscall.c
Expand Up @@ -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. */

Expand Down

0 comments on commit b67cb68

Please sign in to comment.