diff mbox

[RFC,V6,18/18] translate-all: (wip) use tb_flush_safe when we can't alloc more tb.

Message ID 1435330053-18733-19-git-send-email-fred.konrad@greensocs.com
State New
Headers show

Commit Message

fred.konrad@greensocs.com June 26, 2015, 2:47 p.m. UTC
From: KONRAD Frederic <fred.konrad@greensocs.com>

This changes just the tb_flush called from tb_alloc.

TODO:
 * changes the other tb_flush.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
---
 translate-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini June 26, 2015, 4:21 p.m. UTC | #1
On 26/06/2015 16:47, fred.konrad@greensocs.com wrote:
> @@ -1147,7 +1147,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
>      tb = tb_alloc(pc);
>      if (!tb) {
>          /* flush must be done */
> -        tb_flush(env);
> +        tb_flush_safe(env);

Should you just call cpu_loop_exit() here, instead of redoing the
tb_alloc etc.?

Paolo

>          /* cannot fail at this point */
>          tb = tb_alloc(pc);
fred.konrad@greensocs.com June 26, 2015, 4:38 p.m. UTC | #2
On 26/06/2015 18:21, Paolo Bonzini wrote:
>
> On 26/06/2015 16:47, fred.konrad@greensocs.com wrote:
>> @@ -1147,7 +1147,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
>>       tb = tb_alloc(pc);
>>       if (!tb) {
>>           /* flush must be done */
>> -        tb_flush(env);
>> +        tb_flush_safe(env);
> Should you just call cpu_loop_exit() here, instead of redoing the
> tb_alloc etc.?
>
> Paolo
Ah yes good point!

Thanks,
Fred

>>           /* cannot fail at this point */
>>           tb = tb_alloc(pc);
Alex Bennée July 7, 2015, 4:17 p.m. UTC | #3
fred.konrad@greensocs.com writes:

> From: KONRAD Frederic <fred.konrad@greensocs.com>
>
> This changes just the tb_flush called from tb_alloc.
>
> TODO:
>  * changes the other tb_flush.
>
> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
> ---
>  translate-all.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index 8bd8fe8..9adaffa 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1147,7 +1147,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
>      tb = tb_alloc(pc);
>      if (!tb) {
>          /* flush must be done */
> -        tb_flush(env);
> +        tb_flush_safe(env);

Hold on this is async right? What stops us rolling on and then getting
flushed when the other vCPUs come to a halt?

It deserves a comment at least.

>          /* cannot fail at this point */
>          tb = tb_alloc(pc);
>          /* Don't forget to invalidate previous TB info.  */
fred.konrad@greensocs.com July 7, 2015, 4:23 p.m. UTC | #4
On 07/07/2015 18:17, Alex Bennée wrote:
> fred.konrad@greensocs.com writes:
>
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>
>> This changes just the tb_flush called from tb_alloc.
>>
>> TODO:
>>   * changes the other tb_flush.
>>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>> ---
>>   translate-all.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/translate-all.c b/translate-all.c
>> index 8bd8fe8..9adaffa 100644
>> --- a/translate-all.c
>> +++ b/translate-all.c
>> @@ -1147,7 +1147,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
>>       tb = tb_alloc(pc);
>>       if (!tb) {
>>           /* flush must be done */
>> -        tb_flush(env);
>> +        tb_flush_safe(env);
> Hold on this is async right? What stops us rolling on and then getting
> flushed when the other vCPUs come to a halt?
>
> It deserves a comment at least.
>

not this need some synchronization when the CPUs are halted.
There is crap here spotted by Paolo though.

In the case of tb_flush.. We do an async_safe_work because all VCPUs thread
must be outside cpu_exec.

Are you suggesting to just exiting everybody and wait here that all 
VCPUs exit?
This is possible as well here but is not possible for the other case.. 
That's why I
prefered a "generic" mechanism.

Fred
>>           /* cannot fail at this point */
>>           tb = tb_alloc(pc);
>>           /* Don't forget to invalidate previous TB info.  */
diff mbox

Patch

diff --git a/translate-all.c b/translate-all.c
index 8bd8fe8..9adaffa 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1147,7 +1147,7 @@  TranslationBlock *tb_gen_code(CPUState *cpu,
     tb = tb_alloc(pc);
     if (!tb) {
         /* flush must be done */
-        tb_flush(env);
+        tb_flush_safe(env);
         /* cannot fail at this point */
         tb = tb_alloc(pc);
         /* Don't forget to invalidate previous TB info.  */