On 13/05/2015 11:41, Peter Maydell wrote: > > For -icount and SMP, yes. I even posted a patch to that end once. > > I don't see why -icount and SMP need to be mutually exclusive. > If we're round-robining between the SMP CPUs then they should > all stay deterministic, I would have thought?
No, because the round-robin switches happen non-deterministically when the I/O thread kicks the VCPU in qemu_mutex_lock_iothread. It gets worse with BQL-free TCG which lets you remove the kicks altogether (and the round-robin disappears in favor of true multithreading). Even you could keep the kicks, having both round-robin and multi-threading would be extra complication in the code and cause of bitrot. > > You can get -icount and multi-threaded TCG (which for UP is simply TCG > > with execution out of the BQL) together I think. For example you could > > handle cpu->icount_decr.u16.low == 0 like cpu->halted, hanging the CPU > > thread until QEMU_CLOCK_VIRTUAL timers have been processed. The I/O > > thread would have to kick the CPU after processing QEMU_CLOCK_VIRTUAL > > timers---not hard to do. > > Multithreaded TCG for a UP guest isn't very interesting though... BQL-free TCG is interesting though, for two reasons: 1) maintainability: get rid of all the aforementioned "kick VCPU" stuff in qemu_mutex_lock_iothread; 2) performance: allow handling of I/O events to run in parallel with the VCPU, rather than the lockstep technique we have now. This improves performance, so that for example you might get rid of the artificial ratelimiting in ptimer.c. In case it wasn't clear, BQL-freedom is the main reason why I'm interested in multithreaded TCG! :) Paolo