On 2011-08-22 18:18, Avi Kivity wrote:
On 08/22/2011 06:46 PM, Jan Kiszka wrote:
We can express the VCPU thread wakeup with the stop mechanism, saving
both qemu_system_ready and the qemu_system_cond. For KVM threads, we can
just enter the main loop as long as the thread is stopped. The central
TCG thread is better held back before the loop as there can be side
effects of the services called even when all CPUs are stopped.
Creating VCPUs in stopped state will also be required for proper CPU
hotplugging support.
- /* and wait for machine initialization */
- while (!qemu_system_ready) {
- qemu_cond_wait(&qemu_system_cond,&qemu_global_mutex);
+ /* wait for initial kick-off after machine start */
+ while (!first_cpu->stopped) {
+ qemu_cond_wait(tcg_halt_cond,&qemu_global_mutex);
}
Seems inverted - do we want to wait until first_cpu is stopped, or while
first_cpu is stopped?
Oops, fixed below.
Do we want to process run_on_cpu() events after the machine is created
but before a cpu is started (if starting with -S)?
-S affects vm_running, not stopped states of individual VCPUs. So they
will get kicked off on main_loop entry, but then stop again due to
vm_running == 0.
Jan
-------8<--------
We can express the VCPU thread wakeup with the stop mechanism, saving
both qemu_system_ready and the qemu_system_cond. For KVM threads, we can
just enter the main loop as long as the thread is stopped. The central
TCG thread is better held back before the loop as there can be side
effects of the services called even when all CPUs are stopped.
Creating VCPUs in stopped state will also be required for proper CPU
hotplugging support.
Signed-off-by: Jan Kiszka<address@hidden>