From: Paolo Bonzini <pbonzini@redhat.com>
To: Matthew Rosato <mjrosato@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: agraf@suse.de, borntraeger@de.ibm.com,
Bharata B Rao <bharata@linux.vnet.ibm.com>,
cornelia.huck@de.ibm.com, afaerber@suse.de, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v2 2/9] cpus: Add a sync version of cpu_remove()
Date: Thu, 19 Nov 2015 16:25:02 +0100 [thread overview]
Message-ID: <564DE9CE.6080303@redhat.com> (raw)
In-Reply-To: <1447945814-15765-3-git-send-email-mjrosato@linux.vnet.ibm.com>
On 19/11/2015 16:10, Matthew Rosato wrote:
> From: Bharata B Rao <bharata@linux.vnet.ibm.com>
>
> This sync API will be used by the CPU hotplug code to wait for the CPU to
> completely get removed before flagging the failure to the device_add
> command.
>
> Sync version of this call is needed to correctly recover from CPU
> realization failures when ->plug() handler fails.
>
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
> [Call cpu_remove() directly from cpu_remove_sync()]
Are you using it in these patches?
Paolo
> ---
> cpus.c | 12 ++++++++++++
> include/qom/cpu.h | 8 ++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/cpus.c b/cpus.c
> index af2b274..c2444ba 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1070,6 +1070,8 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
> qemu_kvm_wait_io_event(cpu);
> if (cpu->exit && !cpu_can_run(cpu)) {
> qemu_kvm_destroy_vcpu(cpu);
> + cpu->created = false;
> + qemu_cond_signal(&qemu_cpu_cond);
> qemu_mutex_unlock(&qemu_global_mutex);
> return NULL;
> }
> @@ -1174,6 +1176,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
> }
> if (remove_cpu) {
> qemu_tcg_destroy_vcpu(remove_cpu);
> + cpu->created = false;
> + qemu_cond_signal(&qemu_cpu_cond);
> remove_cpu = NULL;
> }
> }
> @@ -1339,6 +1343,14 @@ void cpu_remove(CPUState *cpu)
> qemu_cpu_kick(cpu);
> }
>
> +void cpu_remove_sync(CPUState *cpu)
> +{
> + cpu_remove(cpu);
> + while (cpu->created) {
> + qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
> + }
> +}
> +
> /* For temporary buffers for forming a name */
> #define VCPU_THREAD_NAME_SIZE 16
>
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 6a1d887..dc2b566 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -705,6 +705,14 @@ void cpu_resume(CPUState *cpu);
> */
> void cpu_remove(CPUState *cpu);
>
> + /**
> + * cpu_remove_sync:
> + * @cpu: The CPU to remove.
> + *
> + * Requests the CPU to be removed and waits till it is removed.
> + */
> +void cpu_remove_sync(CPUState *cpu);
> +
> /**
> * qemu_init_vcpu:
> * @cpu: The vCPU to initialize.
>
next prev parent reply other threads:[~2015-11-19 15:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 15:10 [Qemu-devel] [PATCH v2 0/9] s390: Allow hotplug of s390 CPUs Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 1/9] cpus: Reclaim vCPU objects Matthew Rosato
2015-11-20 2:33 ` Bharata B Rao
2015-11-20 13:37 ` Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 2/9] cpus: Add a sync version of cpu_remove() Matthew Rosato
2015-11-19 15:25 ` Paolo Bonzini [this message]
2015-11-19 15:36 ` Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 3/9] s390x/cpu: Cleanup init in preparation for hotplug Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 4/9] s390x/cpu: Set initial CPU state in common routine Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 5/9] s390x/cpu: Move some CPU initialization into realize Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 6/9] s390x/cpu: Add functions to (un)register CPU state Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 7/9] s390x/cpu: Extra cleanup during CPU finalize Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 8/9] s390/virtio-ccw: Add hotplug handler and prepare for unplug Matthew Rosato
2015-11-19 15:10 ` [Qemu-devel] [PATCH v2 9/9] s390x/cpu: Allow hot plug/unplug of CPUs Matthew Rosato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=564DE9CE.6080303@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=bharata@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=mjrosato@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).