[Qemu-devel] [PATCH] cpus: Fix CPU unplug for MTTCG

Bharata B Rao posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1492069906-11300-1-git-send-email-bharata@linux.vnet.ibm.com
Test checkpatch passed
Test docker passed
Test s390x passed
cpus.c | 6 ++++++
1 file changed, 6 insertions(+)
[Qemu-devel] [PATCH] cpus: Fix CPU unplug for MTTCG
Posted by Bharata B Rao 7 years ago
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.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 cpus.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cpus.c b/cpus.c
index 740b8dc..79f780b 100644
--- a/cpus.c
+++ b/cpus.c
@@ -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);
-- 
2.7.4


Re: [Qemu-devel] [PATCH] cpus: Fix CPU unplug for MTTCG
Posted by David Gibson 7 years ago
On Thu, Apr 13, 2017 at 01:21:46PM +0530, Bharata B Rao wrote:
> 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.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

Applied to ppc-for-2.10, thanks.

> ---
>  cpus.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/cpus.c b/cpus.c
> index 740b8dc..79f780b 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -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);

-- 
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