From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: philmd@linaro.org
Subject: [PATCH 0/6] accel/tcg: Always require can_do_io (#1866)
Date: Thu, 14 Sep 2023 10:44:30 -0700 [thread overview]
Message-ID: <20230914174436.1597356-1-richard.henderson@linaro.org> (raw)
The problem exposed by the fix for #1826 (et al) is that the TB that
contains the i/o instruction that alters the address space continues
on to issue other i/o instructions.
Since #1826 deferred the update to the address space, these subsequent
i/o instructions do not reference the correct address space, and things
go awry from there.
Ideally we would treat changes to the address space as specially, but
that knowledge is buried quite far down in the device models. We don't
find out that such a change is coming until quite late such that we
cannot undo all of the other side effects and start over.
The only alternative would seem to be to treat all i/o pesimistically
and end the TB after any i/o, exactly as we do for icount.
I'm not pleased about this, because an eyeball of avocado times
suggests a slowdown. No doubt caused by most i/o having to go
through cpu_io_recompile.
I begin to wonder if #1826 should be solved differently, like *not*
caching MemoryRegionSections within the cpu tlb, and looking up the
physical address within the address space during the i/o itself.
But even that seems like it would work only for the more common case
where the address space reorg only changes devices. For the odd case
where an address space reorg changes RAM, we still have the result
of the phys addr lookup cached via the adjustment to host memory.
So this seems like the most reasonable solution.
Follow-up patches could optimize setting of can_do_io, and replace
previous TranslationBlocks so that we only go through cpu_io_recompile
once for a particular bit of guest code, rather than every single time.
r~
Richard Henderson (6):
accel/tcg: Avoid load of icount_decr if unused
accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop
accel/tcg: Track current value of can_do_io in the TB
accel/tcg: Improve setting of can_do_io at start of TB
accel/tcg: Always set CF_LAST_IO with CF_NOIRQ
accel/tcg: Always require can_do_io
include/exec/translator.h | 2 ++
accel/tcg/cpu-exec.c | 2 +-
accel/tcg/tb-maint.c | 6 ++--
accel/tcg/translator.c | 72 ++++++++++++++++++-------------------
target/mips/tcg/translate.c | 1 -
5 files changed, 41 insertions(+), 42 deletions(-)
--
2.34.1
next reply other threads:[~2023-09-14 17:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 17:44 Richard Henderson [this message]
2023-09-14 17:44 ` [PATCH 1/6] accel/tcg: Avoid load of icount_decr if unused Richard Henderson
2023-09-15 9:23 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 2/6] accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop Richard Henderson
2023-09-15 9:26 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 3/6] accel/tcg: Track current value of can_do_io in the TB Richard Henderson
2023-09-15 9:41 ` [PATCH 3/6: 1/2] accel/tcg: Refactor gen_io_start() as set_can_do_io() Philippe Mathieu-Daudé
2023-09-15 9:41 ` [PATCH 3/6: 2/2] accel/tcg: Track current value of can_do_io in the TB Philippe Mathieu-Daudé
2023-09-15 9:44 ` Philippe Mathieu-Daudé
2023-09-15 9:42 ` [PATCH 3/6: 1/2] accel/tcg: Refactor gen_io_start() as set_can_do_io() Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 4/6] accel/tcg: Improve setting of can_do_io at start of TB Richard Henderson
2023-09-15 9:47 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 5/6] accel/tcg: Always set CF_LAST_IO with CF_NOIRQ Richard Henderson
2023-09-19 9:26 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 6/6] accel/tcg: Always require can_do_io Richard Henderson
2023-09-19 9:37 ` Philippe Mathieu-Daudé
2023-10-24 9:50 ` Clément Chigot
2023-10-26 0:44 ` Richard Henderson
2023-10-26 8:10 ` Clément Chigot
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=20230914174436.1597356-1-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=philmd@linaro.org \
--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).