diff mbox

[v2,08/27] HACK: Always enable parallel_cpus

Message ID 1467392693-22715-9-git-send-email-rth@twiddle.net (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Henderson July 1, 2016, 5:04 p.m. UTC
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(-)

Comments

Alex Bennée Sept. 8, 2016, 8:39 a.m. UTC | #1
Richard Henderson <rth@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 99ae7f9..a10fa06 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;

I appreciate this is currently a hack but for CONFIG_USER it should
always be true anyway.

>
>  /* translation block context */
>  #ifdef CONFIG_USER_ONLY


--
Alex Bennée
Richard Henderson Sept. 8, 2016, 4:22 p.m. UTC | #2
On 09/08/2016 01:39 AM, Alex Bennée wrote:
> 
> Richard Henderson <rth@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 99ae7f9..a10fa06 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;
> 
> I appreciate this is currently a hack but for CONFIG_USER it should
> always be true anyway.

One could delay setting parallel_cpus until one of a number of syscalls occur:

(1) clone, with CLONE_VM
(2) mmap, with MAP_SHARED
(3) shmat

which would allow single-threaded programs to run without the atomic overhead.

r~
diff mbox

Patch

diff --git a/translate-all.c b/translate-all.c
index 99ae7f9..a10fa06 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