Patchwork iothread: fix vcpu stop with smp tcg

login
register
mail settings
Submitter Marcelo Tosatti
Date Feb. 9, 2010, 2:49 p.m.
Message ID <20100209144904.GA31343@amt.cnet>
Download mbox | patch
Permalink /patch/44909/
State New
Headers show

Comments

Marcelo Tosatti - Feb. 9, 2010, 2:49 p.m.
Round robin vcpus in tcg_cpu_next even if the vm stopped. This
allows all cpus to enter stopped state.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Anthony Liguori - Feb. 10, 2010, 7:31 p.m.
On 02/09/2010 08:49 AM, Marcelo Tosatti wrote:
> Round robin vcpus in tcg_cpu_next even if the vm stopped. This
> allows all cpus to enter stopped state.
>
> Signed-off-by: Marcelo Tosatti<mtosatti@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> diff --git a/vl.c b/vl.c
> index 880bcd5..f61e362 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3855,14 +3855,15 @@ static void tcg_cpu_exec(void)
>       for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) {
>           CPUState *env = cur_cpu = next_cpu;
>
> -        if (!vm_running)
> -            break;
>           if (timer_alarm_pending) {
>               timer_alarm_pending = 0;
>               break;
>           }
>           if (cpu_can_run(env))
>               ret = qemu_cpu_exec(env);
> +        else if (env->stop)
> +            break;
> +
>           if (ret == EXCP_DEBUG) {
>               gdb_set_stop_cpu(env);
>               debug_requested = 1;
>
>
>
>

Patch

diff --git a/vl.c b/vl.c
index 880bcd5..f61e362 100644
--- a/vl.c
+++ b/vl.c
@@ -3855,14 +3855,15 @@  static void tcg_cpu_exec(void)
     for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) {
         CPUState *env = cur_cpu = next_cpu;
 
-        if (!vm_running)
-            break;
         if (timer_alarm_pending) {
             timer_alarm_pending = 0;
             break;
         }
         if (cpu_can_run(env))
             ret = qemu_cpu_exec(env);
+        else if (env->stop)
+            break;
+
         if (ret == EXCP_DEBUG) {
             gdb_set_stop_cpu(env);
             debug_requested = 1;