All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org,
	"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>
Subject: Re: [PATCH v2 2/2] accel/tcg: Call tcg_tb_insert() for one-insn TBs
Date: Fri, 17 Jan 2025 10:38:19 +0000	[thread overview]
Message-ID: <87a5bphgis.fsf@draig.linaro.org> (raw)
In-Reply-To: <20250116213214.5695-2-iii@linux.ibm.com> (Ilya Leoshkevich's message of "Thu, 16 Jan 2025 22:31:33 +0100")

Ilya Leoshkevich <iii@linux.ibm.com> writes:

> Currently one-insn TBs created from I/O memory are not added to
> region_trees. Therefore, when they generate exceptions, they are not
> handled by cpu_restore_state_from_tb().
>
> For x86 this is not a problem, because x86_restore_state_to_opc() only
> restores pc and cc, which already have the correct values if the first
> TB instruction causes an exception. However, on several other
> architectures, restore_state_to_opc() is not stricly limited to state
> restoration and affects some exception-related registers, where guests
> can notice incorrect values, for example:
>
> - arm's exception.syndrome;
> - hppa's unwind_breg;
> - riscv's excp_uw2;
> - s390x's int_pgm_ilen.
>
> Fix by always calling tcg_tb_insert(). This may increase the size of
> region_trees, but tcg_region_reset_all() clears it once code_gen_buffer
> fills up, so it will not grow uncontrollably.
>
> Do not call tb_link_page(), which would add such TBs to the QHT, to
> prevent tb_lookup() from finding them. These TBs are single-use, since
> subsequent reads from I/O memory may return different values; they are
> not removed from code_gen_buffer only in order to keep things simple.
>
> Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2025-01-17 10:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16 21:31 [PATCH v2 1/2] tcg: Document tb_lookup() and tcg_tb_lookup() Ilya Leoshkevich
2025-01-16 21:31 ` [PATCH v2 2/2] accel/tcg: Call tcg_tb_insert() for one-insn TBs Ilya Leoshkevich
2025-01-17 10:38   ` Alex Bennée [this message]
2025-01-17  4:44 ` [PATCH v2 1/2] tcg: Document tb_lookup() and tcg_tb_lookup() Richard Henderson
2025-01-17 10:38 ` Alex Bennée
2025-01-17 16:28 ` 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=87a5bphgis.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=iii@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@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 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.