qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Romero <gromero@linux.vnet.ibm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Cédric Le Goater" <clg@kaod.org>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	qemu-ppc <qemu-ppc@nongnu.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Gustavo Romero" <gromero@linux.ibm.com>
Subject: Re: [PATCH] target/ppc: Integrate icount to purr, vtb, and tbu40
Date: Tue, 11 Aug 2020 12:09:04 -0300	[thread overview]
Message-ID: <7c9ddd92-fb99-bd46-38f7-4c318be5e79e@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAFEAcA80NQXiHaNcsJqkH4aoeH-G=0dbpwanjjPjfS-Mqs-DHA@mail.gmail.com>

On 8/11/20 11:24 AM, Peter Maydell wrote:
> On Tue, 11 Aug 2020 at 14:33, Gustavo Romero <gromero@linux.vnet.ibm.com> wrote:
>> On 8/11/20 6:31 AM, Peter Maydell wrote:
>>> You don't want to call gen_io_end; you just need to ensure that
>>> you end the TB immediately after this insn. See
>>> docs/devel/tcg-icount.rst.
>>
>> I understand that to ensure that TB ends immediately after these
>> instructions (I understood you meant all the cases, not just the
>> spr_read_purr case, right?), the instructions should be a branch
>> or change CPU state in a way that cannot be deduced at translation
>> time, and I don't know how to ensure that in these cases, they
>> are neither, specially for the read access, which doesn't change
>> any CPU state specifically afaics.
> 
> No, you have that the wrong way around. *If* an instruction
> is a branch or a state-changing one, *then* it must end
> the TB. That doesn't mean that *only* those kinds of insn
> can end the TB -- other things also can end a TB. (It also
> doesn't mean that a branch etc will automatically end the
> TB -- it means that if you're writing the bit of target
> code that generates code for a branch/etc then you must
> specifically ensure that you end the TB.)

ah, ok. I got it now :) Thanks for the explanation.


>> If I remove the gen_io_end() from all these cases the VM gets
>> stuck at apparently random points of execution (I'm digging
>> into details right now trying to understand why).
> 
> Probably because you're not ending the TB after the insn.
> 
> PowerPC seems to be doing something slightly weird in this area --
> it classifies "stop translation" as a kind of exception
> (POWERPC_EXCP_STOP) rather than just using the common-code
> is_jmp machinery and setting it to DISAS_EXIT. So you'll
> need a ppc expert to say what the right thing is, but my
> guess is you want to call gen_stop_exception() -- compare
> gen_darn().

Right, if I change the code to call gen_stop_exception() like
in gen_darn() everything goes fine.

So, I'll send a v2 based on your review then PPC64 folks can
probably take a look at it. Could I add:

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

to v2?


Cheers,
Gustavo


  reply	other threads:[~2020-08-11 15:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  1:27 [PATCH] target/ppc: Integrate icount to purr, vtb, and tbu40 Gustavo Romero
2020-08-11  9:31 ` Peter Maydell
2020-08-11 13:33   ` Gustavo Romero
2020-08-11 14:24     ` Peter Maydell
2020-08-11 15:09       ` Gustavo Romero [this message]
2020-08-11 15:12         ` Peter Maydell

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=7c9ddd92-fb99-bd46-38f7-4c318be5e79e@linux.vnet.ibm.com \
    --to=gromero@linux.vnet.ibm.com \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=gromero@linux.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).