Thanks Richard! I have fixed it following your advice: diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc index 528c30c9a2..acd2548e9b 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -808,9 +808,13 @@ static bool trans_pause(DisasContext *ctx, arg_pause *a)
/* * PAUSE is a no-op in QEMU, - * however we need to clear the reservation + * however we need to clear the reservation, + * end the TB and return to main loop */ tcg_gen_movi_tl(load_res, -1); + gen_set_pc_imm(ctx, ctx->pc_succ_insn); + tcg_gen_exit_tb(NULL, 0); + ctx->base.is_jmp = DISAS_NORETURN; return true; } I will wait a bit to see if there are any more comments. On Tue, May 10, 2022 at 8:43 AM Richard Henderson < richard.hender...@linaro.org> wrote: > On 5/9/22 23:42, Dao Lu wrote: > > +static bool trans_pause(DisasContext *ctx, arg_pause *a) > > +{ > > + REQUIRE_ZIHINTPAUSE(ctx); > > + > > + /* > > + * PAUSE is a no-op in QEMU, > > + * however we need to clear the reservation > > + */ > > + tcg_gen_movi_tl(load_res, -1); > > I recommend ending the TB and returning to the main loop. When running in > round-robin > mode, this will yield to the next cpu. > > > r~ >