qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Cc: rth@twiddle.net, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Confusion regarding temporaries with branch conditional
Date: Wed, 30 Nov 2016 16:55:47 +0000	[thread overview]
Message-ID: <871sxsucto.fsf@linaro.org> (raw)
In-Reply-To: <87twapmozq.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me>


Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> writes:

> Hi,
>
> I was writing one instruction and hit following issue:
>
> [snip]/qemu/tcg/tcg.c:2039: tcg fatal error
> qemu-ppc64le: [snip]/qemu/translate-all.c:175: tb_lock: Assertion `!have_tb_lock' failed.
> Segmentation fault (core dumped)

This is confusing because something is trying to take the tb_lock while
you are in code generation. tb_lock is held for code generation to
ensure serialisation of generation.

>
> Debugging deeper found that its something to do with the variable type:
>
>     TCGv nb = tcg_temp_new();
>     tcg_gen_andi_tl(nb, cpu_gpr[rB(ctx->opcode)], 0xFF);
>     tcg_gen_brcondi_tl(TCG_COND_EQ, nb, 0, l1);
>     [ Do something here]
>     gen_set_label(l1);
>     tcg_temp_free(nb);
>
> If I change the variable as "local temporary", the code works fine:
>
>     TCGv nb = tcg_temp_local_new();
>     tcg_gen_andi_tl(nb, cpu_gpr[rB(ctx->opcode)], 0xFF);
>     tcg_gen_brcondi_tl(TCG_COND_EQ, nb, 0, l1);
>     [ Do something here]
>     gen_set_label(l1);
>     tcg_temp_free(nb);
>
> I see lot of code that is using temporaries for similar operations,
> example target-ppc/translate.c:gen_check_align(). How is that working,
> is this a bug there as well?

Well that is odd. Are you sure there is no side effect that is
attempting to modify run state during generation? I'm thinking of
changing memory maps or other such stuff. A back trace at the assert
would make things clearer.

>
> Regards,
> Nikunj


--
Alex Bennée

  parent reply	other threads:[~2016-11-30 16:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30  7:00 [Qemu-devel] Confusion regarding temporaries with branch conditional Nikunj A Dadhania
2016-11-30  7:24 ` Peter Maydell
2016-11-30  7:56   ` Nikunj A Dadhania
2016-11-30 17:08     ` Richard Henderson
2016-12-01  4:44       ` Nikunj A Dadhania
2016-11-30 16:55 ` Alex Bennée [this message]
2016-11-30 17:03   ` Richard Henderson
2016-11-30 18:12     ` Alex Bennée
2016-11-30 20:09       ` 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=871sxsucto.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).