From: Richard Henderson <richard.henderson@linaro.org>
To: BALATON Zoltan <balaton@eik.bme.hu>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org
Subject: Re: [PULL 02/10] target/sparc: Use tcg_gen_lookup_and_goto_ptr in gen_goto_tb
Date: Wed, 28 Jun 2023 15:55:01 +0200 [thread overview]
Message-ID: <1cc1cbce-50be-b714-68d3-205bf9d54c78@linaro.org> (raw)
In-Reply-To: <813defa4-a833-2486-a89e-3a0f4e0b8d10@eik.bme.hu>
On 6/28/23 15:00, BALATON Zoltan wrote:
> On Wed, 28 Jun 2023, Mark Cave-Ayland wrote:
>> From: Richard Henderson <richard.henderson@linaro.org>
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> Message-Id: <20230628071202.230991-2-richard.henderson@linaro.org>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>> target/sparc/translate.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
>> index bad2ec90a0..28d4cdb8b4 100644
>> --- a/target/sparc/translate.c
>> +++ b/target/sparc/translate.c
>> @@ -318,10 +318,10 @@ static void gen_goto_tb(DisasContext *s, int tb_num,
>> tcg_gen_movi_tl(cpu_npc, npc);
>> tcg_gen_exit_tb(s->base.tb, tb_num);
>> } else {
>> - /* jump to another page: currently not optimized */
>> + /* jump to another page: we can use an indirect jump */
>> tcg_gen_movi_tl(cpu_pc, pc);
>> tcg_gen_movi_tl(cpu_npc, npc);
>> - tcg_gen_exit_tb(NULL, 0);
>> + tcg_gen_lookup_and_goto_ptr();
>
> Out of curiosity, did you test this is actually faster? The reason I ask is because I've
> tried to optimise similar case in target/ppc by using lookup_and_goto_ptr but found it was
> slower than without that. I think this may depend on the usage but I wonder if that could
> be a generic issue with lookup_and_goto_ptr or only specific for the case I've tried.
It is faster.
It should be *always* faster, because returning to the main cpu loop will always do more
work than merely checking to see if we already have built the required TB.
If you see slowdowns, then *probably* you are using lookup_and_goto_ptr incorrectly in
some instance, such that an interrupt has gotten overly delayed. (One must always return
to the main loop after anything that might re-enable interrupts. Otherwise the interrupt
handler may be delayed indefinitely. This was in fact the problem with v1 of this patch set.)
r~
next prev parent reply other threads:[~2023-06-28 13:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 11:44 [PULL 00/10] qemu-sparc queue 20230628 Mark Cave-Ayland
2023-06-28 11:44 ` [PULL 01/10] Revert "hw/sparc64/niagara: Use blk_name() instead of open-coding it" Mark Cave-Ayland
2023-06-28 11:44 ` [PULL 02/10] target/sparc: Use tcg_gen_lookup_and_goto_ptr in gen_goto_tb Mark Cave-Ayland
2023-06-28 13:00 ` BALATON Zoltan
2023-06-28 13:55 ` Richard Henderson [this message]
2023-06-28 11:44 ` [PULL 03/10] target/sparc: Fix npc comparison in sparc_tr_insn_start Mark Cave-Ayland
2023-06-28 11:44 ` [PULL 04/10] target/sparc: Drop inline markers from translate.c Mark Cave-Ayland
2023-06-28 11:44 ` [PULL 05/10] target/sparc: Introduce DYNAMIC_PC_LOOKUP Mark Cave-Ayland
2023-06-28 11:45 ` [PULL 06/10] target/sparc: Use DYNAMIC_PC_LOOKUP for conditional branches Mark Cave-Ayland
2023-06-28 11:45 ` [PULL 07/10] target/sparc: Use DYNAMIC_PC_LOOKUP for JMPL Mark Cave-Ayland
2023-06-28 11:45 ` [PULL 08/10] target/sparc: Use DYNAMIC_PC_LOOKUP for v9 RETURN Mark Cave-Ayland
2023-06-28 11:45 ` [PULL 09/10] target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI Mark Cave-Ayland
2023-06-28 11:45 ` [PULL 10/10] escc: emulate dip switch language layout settings on SUN keyboard Mark Cave-Ayland
2023-06-28 15:29 ` [PULL 00/10] qemu-sparc queue 20230628 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=1cc1cbce-50be-b714-68d3-205bf9d54c78@linaro.org \
--to=richard.henderson@linaro.org \
--cc=balaton@eik.bme.hu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.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).