qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Luis Pureza" <pureza@student.dei.uc.pt>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Weird behavior while using the instruction counter
Date: Thu, 24 Jul 2008 11:42:27 +0100	[thread overview]
Message-ID: <3e1533500807240342s15e6e508kd1d49152b0892e9f@mail.gmail.com> (raw)

Hi,

I'm using the instruction counter to execute N instructions at a time.
With very small values of N (say, N < 10), I observed the following
behavior:

1. A new TB is generated and execution starts there;
2. The instruction counter timer expires and cpu_exec_nocache() is called;
3. cpu_exec_nocache() generates a new TB for the same PC and starts to
execute it;
4. Some instruction inside the TB turns out to be an I/O instruction.
Thus, cpu_io_recompile() gets called
5; cpu_io_recompile() regenerates the TB and longjmps back to the
beginning of cpu_exec()
6. on cpu_exec(), tb_find_fast() returns the first TB, instead of the
one generated by cpu_io_recompile()
7. Endless loop!

Actually, for some reason beyond my comprehension, the loop is not
really infinite: after a few seconds it actually executes the block
and moves on. However, as you can imagine, this is too slow.

I think I fixed the problem by appending CF_LAST_IO to the cflags of
the TB generated by cpu_exec_nocache(). This way, cpu_io_recompile()
won't be called for this TB. Certainly not the best solution, though.

I was wondering if my thinking makes sense or am I just completely wrong :-)

Cheers,

Luis Pureza

             reply	other threads:[~2008-07-24 10:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 10:42 Luis Pureza [this message]
2008-07-24 12:44 ` [Qemu-devel] Weird behavior while using the instruction counter Paul Brook
2008-07-24 13:54   ` Luis Pureza
2008-07-24 14:02     ` Paul Brook
     [not found]       ` <3e1533500807240742u488272b7x12c4429cbfbb9297@mail.gmail.com>
2008-07-24 14:49         ` Fwd: " Luis Pureza
     [not found]         ` <200807241556.48810.paul@codesourcery.com>
2008-07-24 15:17           ` Luis Pureza
2008-07-24 16:02             ` Paul Brook
2008-07-24 17:58               ` Luis Pureza
2008-07-24 23:59                 ` Paul Brook

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=3e1533500807240342s15e6e508kd1d49152b0892e9f@mail.gmail.com \
    --to=pureza@student.dei.uc.pt \
    --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).