From: "Alex Bennée" <alex.bennee@linaro.org>
To: Aaron Lindsay <aaron@os.amperecomputing.com>
Cc: cota@braap.org, richard.henderson@linaro.org, qemu-devel@nongnu.org
Subject: Re: Detecting Faulting Instructions From Plugins
Date: Fri, 05 Feb 2021 16:41:50 +0000 [thread overview]
Message-ID: <87pn1eo3jq.fsf@linaro.org> (raw)
In-Reply-To: <YB1nf/M613d0B+Pm@strawberry.localdomain>
Aaron Lindsay <aaron@os.amperecomputing.com> writes:
> On Feb 05 15:03, Alex Bennée wrote:
>> Aaron Lindsay <aaron@os.amperecomputing.com> writes:
>> > Assuming you're right that TCG is detecting "a io_readx/io_writex when
>> > ->can_do_io is not true", could we detect this case when it occurs and
>> > omit the instruction callbacks for the re-translation of the single
>> > instruction (allow the initial callback to stand instead of trying to
>> > turn back time, in a way, to prevent it)? Maybe there would have be some
>> > bookkeeping in the plugin infrastructure side rather than entirely
>> > omitting the callbacks when re-translating, in case that translation got
>> > re-used in a case which didn't hit the same behavior and shouldn't be
>> > skipped?
>>
>> They are happening in two separate phases. The translation phase has no
>> idea what the runtime condition will be. Once we get to runtime it's too
>> late - and we trigger a new translation phase.
>
> I believe I understand why we can't catch the initial translation. To
> make sure I'm communicating well, my current understanding is that the
> timeline for this case goes something like:
>
> 1) translate large block of instructions, including ldr
> 2) attempt to execute ldr, calling instruction callback
> 3) notice that access is to IO, trigger re-translation of single
> ldr instruction
> 4) execute block with single ldr instruction to completion, calling both
> instruction and memory callbacks
>
> I was wondering if it would be possible to inform the re-translation in
> step 3 that it's for a re-translated IO access so that it could
> ultimately cause the second of the duplicate instruction callbacks to be
> omitted during execution in 4.
Currently we invalidate the previous TB and save the new TB in the
translation cache before restarting the execution loop so the new TB
gets picked up. However we could certainly have a different mechanism
which ensures the next block is not cached. I think if we extend CFLAGS
down to gen_intermediate_code and translator_loop we could ask it not to
instrument that block. It wouldn't be the most efficient solution but
then again this is icount so...
Richard,
What do you think?
>
> -Aaron
--
Alex Bennée
next prev parent reply other threads:[~2021-02-05 17:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-30 3:23 Detecting Faulting Instructions From Plugins Aaron Lindsay
2021-01-30 18:55 ` Aaron Lindsay
2021-02-01 12:07 ` Alex Bennée
2021-02-04 21:31 ` Aaron Lindsay
2021-02-05 11:19 ` Alex Bennée
2021-02-05 14:26 ` Aaron Lindsay via
2021-02-05 15:03 ` Alex Bennée
2021-02-05 15:33 ` Aaron Lindsay via
2021-02-05 15:42 ` Aaron Lindsay via
2021-02-05 16:41 ` Alex Bennée [this message]
2021-02-11 17:27 ` Alex Bennée
2021-02-11 18:35 ` Aaron Lindsay via
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=87pn1eo3jq.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=aaron@os.amperecomputing.com \
--cc=cota@braap.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).