Richard Henderson <r...@twiddle.net> writes:

> This is really just a placeholder for an actual
> command-line switch for mttcg.
> ---
>  translate-all.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index 70f3959..c860cfc 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -119,7 +119,7 @@ static void *l1_map[V_L1_SIZE];
>
>  /* code generation context */
>  TCGContext tcg_ctx;
> -bool parallel_cpus;
> +bool parallel_cpus = 1;
>
>  /* translation block context */
>  #ifdef CONFIG_USER_ONLY

Can we replace with:

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 have cloned our first
thread. At this point any existing translations need to be thrown away.

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

2 files changed, 10 insertions(+), 1 deletion(-)
linux-user/syscall.c | 9 +++++++++
translate-all.c      | 2 +-

modified   linux-user/syscall.c
@@ -6144,6 +6144,15 @@ 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 the 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.  */

modified   translate-all.c
@@ -119,7 +119,7 @@ static void *l1_map[V_L1_SIZE];

 /* code generation context */
 TCGContext tcg_ctx;
-bool parallel_cpus = 1;
+bool parallel_cpus;

 /* translation block context */
 #ifdef CONFIG_USER_ONLY

Reply via email to