On Tue, 28 Jul 2020 at 13:34, Wu, Wentong <wentong...@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

Reply via email to