Skip to contentSkip to conversation

cpus: Fix CPU unplug for MTTCG

PATCH Applied Bharata B Rao 2 participants 2 messages Apr 13, 2017 – Apr 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpus: Fix CPU unplug for MTTCG

Ensure that the unplugged CPU thread is destroyed and the waiting thread is notified about it. This is needed for CPU unplug to work correctly in MTTCG mode.

---
 cpus.c | 6 ++++++
 1 file changed, 6 insertions(+)
cpus.c +6 -0
index 740b8dc..79f780b 100644
@@ -1483,6 +1483,12 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
                 /* Ignore everything else? */
                 break;
             }
+        } else if (cpu->unplug) {
+            qemu_tcg_destroy_vcpu(cpu);
+            cpu->created = false;
+            qemu_cond_signal(&qemu_cpu_cond);
+            qemu_mutex_unlock_iothread();
+            return NULL;
         }
 
         atomic_mb_set(&cpu->exit_request, 0);
Signature · 1 line
2.7.4
Applied
#1 lore raw
Quoted 5 lines · Bharata B Rao

Ensure that the unplugged CPU thread is destroyed and the waiting thread is notified about it. This is needed for CPU unplug to work correctly in MTTCG mode.

Applied to ppc-for-2.10, thanks.

Quoted 21 lines
---
 cpus.c | 6 ++++++
 1 file changed, 6 insertions(+)
cpus.c +6 -0
index 740b8dc..79f780b 100644
@@ -1483,6 +1483,12 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
                 /* Ignore everything else? */
                 break;
             }
+        } else if (cpu->unplug) {
+            qemu_tcg_destroy_vcpu(cpu);
+            cpu->created = false;
+            qemu_cond_signal(&qemu_cpu_cond);
+            qemu_mutex_unlock_iothread();
+            return NULL;
         }
 
         atomic_mb_set(&cpu->exit_request, 0);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson