qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH for-7.0] target/arm: Don't use DISAS_NORETURN in STXP !HAVE_CMPXCHG128 codegen
Date: Thu, 31 Mar 2022 11:11:04 -0600	[thread overview]
Message-ID: <abf7bd5b-33f3-eea2-5d37-d551ad9ca815@linaro.org> (raw)
In-Reply-To: <20220331150858.96348-1-peter.maydell@linaro.org>

On 3/31/22 09:08, Peter Maydell wrote:
> In gen_store_exclusive(), if the host does not have a cmpxchg128
> primitive then we generate bad code for STXP for storing two 64-bit
> values.  We generate a call to the exit_atomic helper, which never
> returns, and set is_jmp to DISAS_NORETURN.  However, this is
> forgetting that we have already emitted a brcond that jumps over this
> call for the case where we don't hold the exclusive.  The effect is
> that we don't generate any code to end the TB for the
> exclusive-not-held execution path, which falls into the "exit with
> TB_EXIT_REQUESTED" code that gen_tb_end() emits.  This then causes an
> assert at runtime when cpu_loop_exec_tb() sees an EXIT_REQUESTED TB
> return that wasn't for an interrupt or icount.
> 
> In particular, you can hit this case when using the clang sanitizers
> and trying to run the xlnx-versal-virt acceptance test in 'make
> check-acceptance'.  This bug was masked until commit 848126d11e93ff
> ("meson: move int128 checks from configure") because we used to set
> CONFIG_CMPXCHG128=1 and avoid the buggy codepath, but after that we
> do not.
> 
> Fix the bug by not setting is_jmp.  The code after the exit_atomic
> call up to the fail_label is dead, but TCG is smart enough to
> eliminate it.  We do need to set 'tmp' to some valid value, though
> (in the same way the exit_atomic-using code in tcg/tcg-op.c does).
> 
> Resolves:https://gitlab.com/qemu-project/qemu/-/issues/953
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   target/arm/translate-a64.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


      reply	other threads:[~2022-03-31 17:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 15:08 [PATCH for-7.0] target/arm: Don't use DISAS_NORETURN in STXP !HAVE_CMPXCHG128 codegen Peter Maydell
2022-03-31 17:11 ` Richard Henderson [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=abf7bd5b-33f3-eea2-5d37-d551ad9ca815@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).