From: Pavel Dovgalyuk <dovgaluk@ispras.ru>
To: Peter Maydell <peter.maydell@linaro.org>,
QEMU Developers <qemu-devel@nongnu.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: what are the requirements on target/ code for -icount to work correctly?
Date: Fri, 19 Jun 2020 08:46:55 +0300 [thread overview]
Message-ID: <c47e9e4e-49eb-88c5-fdc7-8ebec121c165@ispras.ru> (raw)
In-Reply-To: <CAFEAcA_HOxdK5rgKVnww6Bum3vGb=TrhDEp7oqDwsd=UbHmC_g@mail.gmail.com>
On 18.06.2020 20:38, Peter Maydell wrote:
> For -icount mode to work, there are requirements on the target/
> code (notably around marking up "I/O" instructions). Unfortunately
> we've never documented what these are, which makes it pretty rough
> for people writing new targets or reviewing changes to existing ones.
> Does anybody understand what they actually are?
>
> Some more specific questions on the general theme:
>
> Q1: the comment on gen_io_end() says:
> /*
> * cpu->can_do_io is cleared automatically at the beginning of
> * each translation block. The cost is minimal and only paid
> * for -icount, plus it would be very easy to forget doing it
> * in the translator. Therefore, backends only need to call
> * gen_io_start.
> */
> but in fact multiple backends *do* call gen_io_end(). When
> does a backend have to call this, and when not? Or are those
> all legacy useless calls we should delete? (If so, can we
> just get rid of this function entirely ?)
That was my refactoring patch for removing gen_io_end calls.
But in some cases I wasn't sure that translation is stopped after that.
In such cases gen_io_end wasn't removed.
I think, that we need some efforts from target maintainers to remove all
such calls.
> Q2: is it a requirement that after an insn which is a "known
> to be an I/O insn" one (like x86 in/out) and which is marked
> up with gen_io_start()/gen_io_end() that we also end the TB?
It is a requirement for instructions that access virtual clock/icount
value (directly or not).
There is also an assertion that can_do_io is enabled while generating an
interrupt. I believe, that it doesn't affect RR, but is useful for
deterministic icount mode.
> Or is it OK to generate more insns after that one? If the former,
> is there somewhere we can assert() that this is done ?
Sounds reasonable.
> Q3: why does gen_tb_start() call gen_io_end()? This is the
> *start* of the TB so by definition we haven't started doing
> any IO yet...
This is an artifact of gen_io_end refactoring.
Pavel Dovgalyuk
next prev parent reply other threads:[~2020-06-19 5:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 17:38 what are the requirements on target/ code for -icount to work correctly? Peter Maydell
2020-06-19 5:46 ` Pavel Dovgalyuk [this message]
2020-06-19 11:16 ` Paolo Bonzini
2020-06-19 12:18 ` Peter Maydell
2020-06-19 12:37 ` Paolo Bonzini
2020-06-19 12:39 ` Peter Maydell
2020-06-19 12:55 ` Paolo Bonzini
2020-06-19 13:12 ` Peter Maydell
2020-06-19 12:58 ` Alex Bennée
2020-06-19 17:04 ` Peter Maydell
2020-06-22 5:24 ` Max Filippov
2020-06-22 7:50 ` Pavel Dovgalyuk
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=c47e9e4e-49eb-88c5-fdc7-8ebec121c165@ispras.ru \
--to=dovgaluk@ispras.ru \
--cc=alex.bennee@linaro.org \
--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).