From: "Alex Bennée" <alex.bennee@linaro.org>
To: Taylor Simpson <tsimpson@quicinc.com>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: Question about direct block chaining
Date: Tue, 19 Apr 2022 11:24:22 +0100 [thread overview]
Message-ID: <87k0blxszo.fsf@linaro.org> (raw)
In-Reply-To: <SN4PR0201MB88081EEA0FCEB2A1B3B49B87DEF29@SN4PR0201MB8808.namprd02.prod.outlook.com>
Taylor Simpson <tsimpson@quicinc.com> writes:
>> -----Original Message-----
>> From: Richard Henderson <richard.henderson@linaro.org>
>> Sent: Monday, April 18, 2022 10:38 AM
>> To: Taylor Simpson <tsimpson@quicinc.com>; qemu-devel@nongnu.org
>> Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> Subject: Re: Question about direct block chaining
>>
>> On 4/18/22 07:54, Taylor Simpson wrote:
>> > I implemented both approaches for inner loops and didn't see speedup
>> > in my benchmark. So, I have a couple of questions
>> > 1) What are the pros and cons of the two approaches
>> (lookup_and_goto_ptr and goto_tb + exit_tb)?
>>
>> goto_tb can only be used within a single page (plus other restrictions, see
>> translator_use_goto_tb). In addition, as documented, the change in cpu
>> state must be constant, beginning with a direct jump.
>>
>> lookup_and_goto_ptr can handle any change in cpu state, including indirect
>> jumps.
>>
>>
>> > 2) How can I verify that direct block chaining is working properly?
>> > With -d exec, I see lines like the following with goto_tb + exit_tb but
>> NOT lookup_and_goto_ptr
>> > Linking TBs 0x7fda44172e00 [0050ac38] index 1 -> 0x7fda44173b40
>> > [0050ac6c]
>>
>> Well, that's one way. I would have also suggested simply looking at -d op
>> output, for the various branchy cases you're considering, to see that all of the
>> exits are as expected.
>
> Thanks!!
>
> I created a synthetic benchmark with a loop with a very small body and a very high number of iterations. I can see differences in execution time.
>
> Here are my observations:
> - goto_tb + exit_tb gives the fastest execution time because it will
> patch the native jump address
As we would expect.
> - lookup_and_goto_ptr is an improvement over tcg_gen_exit_tb(NULL, 0)
Yes - mainly saving the cost of prologue and coming out of generated
code to the main loop. However once we get to tb_lookup and fail the
tb_jump_cache its going to take some time to get a block via QHT.
The tb_jump_cache is pretty simple in its implementation but I don't
know if we've ever decently characterised the hit rate and if it could
be improved. I think we already have slightly different hashing
functions for user-mode vs softmmu.
(aside I suspect the trace_vcpu_dstate check can now be removed which
should save a bit of time on the hash function).
--
Alex Bennée
prev parent reply other threads:[~2022-04-19 10:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 14:54 Question about direct block chaining Taylor Simpson
2022-04-18 15:37 ` Richard Henderson
2022-04-19 6:02 ` Taylor Simpson
2022-04-19 10:24 ` Alex Bennée [this message]
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=87k0blxszo.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=tsimpson@quicinc.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.