qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Anton Johansson <anjo@rev.ng>, qemu-devel@nongnu.org
Cc: ale@rev.ng, richard.henderson@linaro.org, pbonzini@redhat.com,
	eduardo@habkost.net, peter.maydell@linaro.org
Subject: Re: [PATCH 2/3] Replace `TARGET_TB_PCREL` with `CF_PCREL`
Date: Tue, 7 Feb 2023 12:26:05 +0100	[thread overview]
Message-ID: <82cdff33-4a41-cfae-2235-f6d4345f4f1c@linaro.org> (raw)
In-Reply-To: <20230207104352.11055-3-anjo@rev.ng>

On 7/2/23 11:43, Anton Johansson via wrote:
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   accel/tcg/cpu-exec.c        |  8 +++----
>   accel/tcg/internal.h        | 10 ++++----
>   accel/tcg/perf.c            |  2 +-
>   accel/tcg/tb-jmp-cache.h    | 48 ++++++++++++++++++-------------------
>   accel/tcg/tb-maint.c        |  8 +++----
>   accel/tcg/translate-all.c   | 14 +++++------
>   include/exec/cpu-defs.h     |  3 ---
>   include/exec/exec-all.h     | 27 +++++++++------------
>   target/arm/cpu.c            |  8 +++----
>   target/arm/translate-a64.c  |  8 +++----
>   target/arm/translate.c      |  6 ++---
>   target/arm/translate.h      |  2 +-
>   target/i386/helper.c        |  2 +-
>   target/i386/tcg/tcg-cpu.c   |  6 ++---
>   target/i386/tcg/translate.c | 26 ++++++++++----------
>   15 files changed, 84 insertions(+), 94 deletions(-)
> 
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 9c857eeb07..0a84934ed4 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -186,7 +186,7 @@ static bool tb_lookup_cmp(const void *p, const void *d)
>       const TranslationBlock *tb = p;
>       const struct tb_desc *desc = d;
>   
> -    if ((TARGET_TB_PCREL || tb_pc(tb) == desc->pc) &&
> +    if ((tb_cflags(tb) & CF_PCREL || tb_pc(tb) == desc->pc) &&
>           tb_page_addr0(tb) == desc->page_addr0 &&
>           tb->cs_base == desc->cs_base &&
>           tb->flags == desc->flags &&
> @@ -238,7 +238,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
>           return NULL;
>       }
>       desc.page_addr0 = phys_pc;
> -    h = tb_hash_func(phys_pc, (TARGET_TB_PCREL ? 0 : pc),
> +    h = tb_hash_func(phys_pc, (cflags & CF_PCREL ? 0 : pc),
>                        flags, cflags, *cpu->trace_dstate);
>       return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
>   }
> @@ -257,7 +257,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
>   
>       hash = tb_jmp_cache_hash_func(pc);
>       jc = cpu->tb_jmp_cache;
> -    tb = tb_jmp_cache_get_tb(jc, hash);
> +    tb = tb_jmp_cache_get_tb(jc, cflags, hash);
>   
>       if (likely(tb &&
>                  tb_jmp_cache_get_pc(jc, hash, tb) == pc &&
> @@ -460,7 +460,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
>           if (cc->tcg_ops->synchronize_from_tb) {
>               cc->tcg_ops->synchronize_from_tb(cpu, last_tb);
>           } else {

Possibly:

#ifdef CONFIG_DEBUG_TCG

> -            assert(!TARGET_TB_PCREL);
> +            assert(!(tb_cflags(last_tb) & CF_PCREL));
>               assert(cc->set_pc);

#endif

Or maybe clearer, use tcg_debug_assert()?

>               cc->set_pc(cpu, tb_pc(last_tb));
>           }

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2023-02-07 11:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 10:43 [PATCH 0/3] Replace TARGET_TB_PCREL with CF_PCREL Anton Johansson via
2023-02-07 10:43 ` [PATCH 1/3] include/exec: Introduce `CF_PCREL` Anton Johansson via
2023-02-08 20:47   ` Richard Henderson
2023-02-07 10:43 ` [PATCH 2/3] Replace `TARGET_TB_PCREL` with `CF_PCREL` Anton Johansson via
2023-02-07 11:26   ` Philippe Mathieu-Daudé [this message]
2023-02-08 12:48     ` Anton Johansson via
2023-02-08 21:14   ` Richard Henderson
2023-02-07 10:43 ` [PATCH 3/3] target: Set `CF_PCREL` for arm and i386 frontends Anton Johansson via
2023-02-07 11:27   ` Philippe Mathieu-Daudé
2023-02-08 12:51     ` Anton Johansson via
2023-02-08 21:15   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82cdff33-4a41-cfae-2235-f6d4345f4f1c@linaro.org \
    --to=philmd@linaro.org \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).