qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] Replace qemu_system_cond with VCPU stop mech


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH v3] Replace qemu_system_cond with VCPU stop mechanism
Date: Mon, 22 Aug 2011 15:18:50 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

On 08/22/2011 11:35 AM, Jan Kiszka wrote:
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>

Applied.  Thanks.

Regards,

Anthony Liguori



reply via email to

[Prev in Thread] Current Thread [Next in Thread]