From: Ciro Santilli <ciro.santilli@gmail.com>
To: Pavel Dovgalyuk <dovgaluk@ispras.ru>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
richard.henderson@linaro.org, cota@braap.org,
"Pavel Dovgalyuk" <Pavel.Dovgaluk@ispras.ru>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Kevin Wolf" <kwolf@redhat.com>,
war2jordan@live.com, "Igor R" <boost.lists@gmail.com>,
"Juan Quintela" <quintela@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Aleksandr Bezzubikov" <zuban32s@gmail.com>,
maria.klimushenkova@ispras.ru,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Thomas Dullien" <thomas.dullien@googlemail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [RFC PATCH v6 00/20] replay additions
Date: Mon, 19 Feb 2018 11:15:45 +0000 [thread overview]
Message-ID: <CAFXrp_cR16EOwZp-FauZuZcwuWwB53gxSO57ggy5qud-vyzimA@mail.gmail.com> (raw)
In-Reply-To: <001201d3a957$f85ed610$e91c8230$@ru>
On Mon, Feb 19, 2018 at 8:02 AM, Pavel Dovgalyuk <dovgaluk@ispras.ru> wrote:
>> From: Pavel Dovgalyuk [mailto:dovgaluk@ispras.ru]
>> > From: Peter Maydell [mailto:peter.maydell@linaro.org]
>> > On 13 February 2018 at 10:26, Pavel Dovgalyuk <dovgaluk@ispras.ru> wrote:
>> > > Then I added SCSI adapter with the option –device lsi,id=scsi0 and QEMU
>> > > failed with the following error:
>> > >
>> > > qemu: fatal: IO on conditional branch instruction
>> >
>> > > Seems, that your kernel is incomatible with QEMU, which ARM emulation is not
>> > > good enough.
>> >
>> > It seems fairly unlikely to me that the Linux driver for this
>> > SCSI adaptor is using weirdo self-modifying code of the kind
>> > that would trip up that cpu_abort(). I would suggest a bit
>> > more investigation into what's actually happening...
>>
>> Peter, I bisected this bug and figured out the following.
>>
>> icount in ARM was broken by the following commit: 9b990ee5a3cc6aa38f81266fb0c6ef37a36c45b9
>> tcg: Add CPUState cflags_next_tb
>> This commit breaks execution of Ciro's kernel with enabled icount.
>> I haven't yet figured out why this happens.
>
> The problem is in the following code.
> As far, as I can understand, original version recompiles the TB and
> continues the execution as it goes.
>
> But the modified version sets cflags for the next compilation.
> And these are the flags for the old TB which should replace the original one.
> TCG tries to use cflags for the new TB (which starts after the interrupted one)
> and fails, because these flags are inappropriate.
> That is why icount execution fails.
>
> New version also does not include recompilation of the old block, which is wrong too.
>
Awesome! Can you push it to a branch, and give the full qemu command
line so I can test it?
>
> @@ -1773,9 +1765,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> CPUArchState *env = cpu->env_ptr;
> #endif
> TranslationBlock *tb;
> - uint32_t n, cflags;
> - target_ulong pc, cs_base;
> - uint32_t flags;
> + uint32_t n;
>
> tb_lock();
> tb = tb_find_pc(retaddr);
> @@ -1813,12 +1803,9 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> cpu_abort(cpu, "TB too big during recompile");
> }
>
> - cflags = n | CF_LAST_IO;
> - cflags |= curr_cflags();
> - pc = tb->pc;
> - cs_base = tb->cs_base;
> - flags = tb->flags;
> - tb_phys_invalidate(tb, -1);
> + /* Adjust the execution state of the next TB. */
> + cpu->cflags_next_tb = curr_cflags() | CF_LAST_IO | n;
> +
> if (tb->cflags & CF_NOCACHE) {
> if (tb->orig_tb) {
> /* Invalidate original TB if this TB was generated in
> @@ -1827,9 +1814,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> }
> tb_free(tb);
> }
> - /* FIXME: In theory this could raise an exception. In practice
> - we have already translated the block once so it's probably ok. */
> - tb_gen_code(cpu, pc, cs_base, flags, cflags);
>
> /* TODO: If env->pc != tb->pc (i.e. the faulting instruction was not
> * the first in the TB) then we end up generating a whole new TB and
>
>
>
> Pavel Dovgalyuk
>
next prev parent reply other threads:[~2018-02-19 11:16 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-07 12:03 [Qemu-devel] [RFC PATCH v6 00/20] replay additions Pavel Dovgalyuk
2018-02-07 12:03 ` [Qemu-devel] [RFC PATCH v6 01/20] cpu-exec: fix exception_index handling Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 02/20] block: implement bdrv_snapshot_goto for blkreplay Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 03/20] blkreplay: create temporary overlay for underlaying devices Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 04/20] replay: disable default snapshot for record/replay Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 05/20] replay: fix processing async events Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 06/20] replay: fixed replay_enable_events Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 07/20] replay: fix save/load vm for non-empty queue Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 08/20] replay: added replay log format description Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 09/20] replay: save prior value of the host clock Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 10/20] replay/replay.c: bump REPLAY_VERSION again Pavel Dovgalyuk
2018-02-07 12:04 ` [Qemu-devel] [RFC PATCH v6 11/20] replay/replay-internal.c: track holding of replay_lock Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 12/20] replay: make locking visible outside replay code Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 13/20] replay: push replay_mutex_lock up the call tree Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 14/20] replay: don't destroy mutex at exit Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 15/20] replay: check return values of fwrite Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 16/20] replay: avoid recursive call of checkpoints Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 17/20] scripts/replay-dump.py: replay log dumper Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 18/20] replay: don't process async events when warping the clock Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 19/20] replay: save vmstate of the asynchronous events Pavel Dovgalyuk
2018-02-07 12:05 ` [Qemu-devel] [RFC PATCH v6 20/20] replay: don't drain/flush bdrv queue while RR is working Pavel Dovgalyuk
2018-02-07 12:15 ` [Qemu-devel] [RFC PATCH v6 00/20] replay additions Ciro Santilli
2018-02-07 12:38 ` Pavel Dovgalyuk
2018-02-08 7:35 ` Ciro Santilli
2018-02-10 0:09 ` Ciro Santilli
2018-02-12 5:47 ` Pavel Dovgalyuk
2018-02-13 5:58 ` Ciro Santilli
2018-02-13 6:50 ` Pavel Dovgalyuk
2018-02-13 9:07 ` Ciro Santilli
2018-02-13 9:58 ` Pavel Dovgalyuk
2018-02-13 10:26 ` Pavel Dovgalyuk
2018-02-13 10:49 ` Peter Maydell
2018-02-13 10:52 ` Pavel Dovgalyuk
2018-02-13 11:37 ` Ciro Santilli
2018-02-13 12:13 ` Pavel Dovgalyuk
2018-02-14 12:39 ` Pavel Dovgalyuk
2018-02-19 8:02 ` Pavel Dovgalyuk
2018-02-19 11:15 ` Ciro Santilli [this message]
2018-02-20 9:46 ` Pavel Dovgalyuk
2018-02-20 23:59 ` Ciro Santilli
2018-02-21 6:41 ` Pavel Dovgalyuk
2018-02-21 22:40 ` Ciro Santilli
2018-02-22 7:06 ` Pavel Dovgalyuk
2018-02-22 7:10 ` Pavel Dovgalyuk
2018-02-22 17:52 ` Ciro Santilli
2018-02-12 6:53 ` Pavel Dovgalyuk
2018-02-14 6:21 ` Ciro Santilli
2018-02-14 9:20 ` Pavel Dovgalyuk
2018-02-07 13:38 ` no-reply
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=CAFXrp_cR16EOwZp-FauZuZcwuWwB53gxSO57ggy5qud-vyzimA@mail.gmail.com \
--to=ciro.santilli@gmail.com \
--cc=Pavel.Dovgaluk@ispras.ru \
--cc=alex.bennee@linaro.org \
--cc=boost.lists@gmail.com \
--cc=cota@braap.org \
--cc=dovgaluk@ispras.ru \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=maria.klimushenkova@ispras.ru \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richard.henderson@linaro.org \
--cc=thomas.dullien@googlemail.com \
--cc=war2jordan@live.com \
--cc=zuban32s@gmail.com \
/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).