qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 10/10] tcg/loongarch64: Reorg goto_tb implementation


From: WANG Xuerui
Subject: Re: [PATCH v2 10/10] tcg/loongarch64: Reorg goto_tb implementation
Date: Mon, 23 Jan 2023 16:12:12 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0 Thunderbird/111.0a1

On 1/18/23 09:11, Richard Henderson wrote:
The old implementation replaces two insns, swapping between

         b       <dest>
         nop
and
         pcaddu18i tmp, <dest>
         jirl      zero, tmp, <dest> & 0xffff

There is a race condition in which a thread could be stopped at
the jirl, i.e. with the top of the address loaded, and when
restarted we have re-linked to a different TB, so that the top
half no longer matches the bottom half.

Note that while we never directly re-link to a different TB, we
can link, unlink, and link again all while the stopped thread
remains stopped.

The new implementation replaces only one insn, swapping between

         b       <dest>
and
         pcadd   tmp, <jmp_addr>

falling through to load the address from tmp, and branch.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  tcg/loongarch64/tcg-target.h     |  7 +---
  tcg/loongarch64/tcg-target.c.inc | 72 ++++++++++++++------------------
  2 files changed, 33 insertions(+), 46 deletions(-)

I've tested this on my 3A5000 box and things seem to work, thanks.

Reviewed-by: WANG Xuerui <git@xen0n.name>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]