diff mbox

[RFC,v3,10/14] tcg/tci: Add support for fence

Message ID 20160618040343.19517-11-bobby.prani@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pranith Kumar June 18, 2016, 4:03 a.m. UTC
Cc: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tcg/tci/tcg-target.inc.c | 3 +++
 tci.c                    | 3 +++
 2 files changed, 6 insertions(+)

Comments

Sergey Fedorov June 22, 2016, 7:57 p.m. UTC | #1
On 18/06/16 07:03, Pranith Kumar wrote:
> Cc: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  tcg/tci/tcg-target.inc.c | 3 +++
>  tci.c                    | 3 +++
>  2 files changed, 6 insertions(+)
>
> diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c
> index fa74d52..8e950df 100644
> --- a/tcg/tci/tcg-target.inc.c
> +++ b/tcg/tci/tcg-target.inc.c
> @@ -255,6 +255,7 @@ static const TCGTargetOpDef tcg_target_op_defs[] = {
>      { INDEX_op_bswap32_i32, { R, R } },
>  #endif
>  
> +    { INDEX_op_mb, { } },
>      { -1 },
>  };
>  
> @@ -800,6 +801,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
>          }
>          tcg_out_i(s, *args++);
>          break;
> +    case INDEX_op_mb:
> +        break;
>      case INDEX_op_mov_i32:  /* Always emitted via tcg_out_mov.  */
>      case INDEX_op_mov_i64:
>      case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi.  */
> diff --git a/tci.c b/tci.c
> index b488c0d..4081e61 100644
> --- a/tci.c
> +++ b/tci.c
> @@ -1236,6 +1236,9 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
>                  tcg_abort();
>              }
>              break;
> +        case INDEX_op_mb:
> +            smp_mb();

I think we could distinguish smp_rmb(), smp_wmb() and smp_mb() here.

Kind regards,
Sergey

> +            break;
>          default:
>              TODO();
>              break;
Richard Henderson June 22, 2016, 8:25 p.m. UTC | #2
On 06/22/2016 12:57 PM, Sergey Fedorov wrote:
>> > @@ -1236,6 +1236,9 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
>> >                  tcg_abort();
>> >              }
>> >              break;
>> > +        case INDEX_op_mb:
>> > +            smp_mb();
> I think we could distinguish smp_rmb(), smp_wmb() and smp_mb() here.

I don't.  The extra unpredictable branch is not likely to be worthwhile.

If we want anything finer grained for tci, would should revisit the complete
rewrite that I did a year to two ago.


r~
Sergey Fedorov June 22, 2016, 8:28 p.m. UTC | #3
On 22/06/16 23:25, Richard Henderson wrote:
> On 06/22/2016 12:57 PM, Sergey Fedorov wrote:
>>>> @@ -1236,6 +1236,9 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
>>>>                  tcg_abort();
>>>>              }
>>>>              break;
>>>> +        case INDEX_op_mb:
>>>> +            smp_mb();
>> I think we could distinguish smp_rmb(), smp_wmb() and smp_mb() here.
> I don't.  The extra unpredictable branch is not likely to be worthwhile.
>
> If we want anything finer grained for tci, would should revisit the complete
> rewrite that I did a year to two ago.
>

Fair enough.

Thanks,
Sergey
diff mbox

Patch

diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c
index fa74d52..8e950df 100644
--- a/tcg/tci/tcg-target.inc.c
+++ b/tcg/tci/tcg-target.inc.c
@@ -255,6 +255,7 @@  static const TCGTargetOpDef tcg_target_op_defs[] = {
     { INDEX_op_bswap32_i32, { R, R } },
 #endif
 
+    { INDEX_op_mb, { } },
     { -1 },
 };
 
@@ -800,6 +801,8 @@  static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
         }
         tcg_out_i(s, *args++);
         break;
+    case INDEX_op_mb:
+        break;
     case INDEX_op_mov_i32:  /* Always emitted via tcg_out_mov.  */
     case INDEX_op_mov_i64:
     case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi.  */
diff --git a/tci.c b/tci.c
index b488c0d..4081e61 100644
--- a/tci.c
+++ b/tci.c
@@ -1236,6 +1236,9 @@  uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
                 tcg_abort();
             }
             break;
+        case INDEX_op_mb:
+            smp_mb();
+            break;
         default:
             TODO();
             break;