From: Peter Maydell <peter.maydell@linaro.org>
To: "Wu, Wentong" <wentong.wu@intel.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: qemu icount to run guest SMP code
Date: Tue, 28 Jul 2020 14:36:15 +0100 [thread overview]
Message-ID: <CAFEAcA_c68Ern29dzoWLG4nC1SDOrKK-LVwSexxPNeKGF0b+fA@mail.gmail.com> (raw)
In-Reply-To: <MN2PR11MB4318AB4E0101B3D312277D978D730@MN2PR11MB4318.namprd11.prod.outlook.com>
On Tue, 28 Jul 2020 at 13:34, Wu, Wentong <wentong.wu@intel.com> wrote:
> We are trying to run guest SMP code with qemu icount mode, but based on my current understanding I don’t think we can do that, because with icount enabled, the multi cpus will be simulated in round-robin way(tcg kick vcpu timer, or current cpu exit in order to handle interrupt or the ending of the current execution translationblock) with the single vCPU thread, so qemu is not running guest code in parallel as real hardware does, if guest code has the assumption cores run in parallel it will cause unexpected behavior.
In general you can't expect QEMU's simulation to be accurate
to the level that it will correctly run guest code that's looking
carefully at the level of parallelism between multiple cores
(whether using -icount or not.) Timing of the emulated CPUs
will always vary from that of real hardware to some extent.
SMP mode with icount (ie without MTTCG) will run all vCPUs
on one thread, but since we always round-robin between them
well-behaved guest code will make forward progress and will
not notice any major differences between this and real
parallel execution. (Sometimes it might spin a little more if
it has a busy-loop waiting for another core, but only until
the round-robin kicks in and runs the other core.)
thanks
-- PMM
next prev parent reply other threads:[~2020-07-28 13:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 12:33 qemu icount to run guest SMP code Wu, Wentong
2020-07-28 13:36 ` Peter Maydell [this message]
2020-07-29 2:43 ` Wu, Wentong
-- strict thread matches above, loose matches on Subject: below --
2020-07-27 7:25 Wu, Wentong
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=CAFEAcA_c68Ern29dzoWLG4nC1SDOrKK-LVwSexxPNeKGF0b+fA@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wentong.wu@intel.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).