[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 41/41] cpus: create qemu_cpu_is_vcpu()
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 41/41] cpus: create qemu_cpu_is_vcpu() |
Date: |
Fri, 21 Sep 2012 14:54:39 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 |
Il 21/09/2012 10:47, Juan Quintela ha scritto:
> Old code used !io_thread to know if a thread was an vcpu or not. That
> fails when we introduce the iothread.
>
> Signed-off-by: Juan Quintela <address@hidden>
> ---
> cpus.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index e476a3c..1b7061a 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -902,6 +902,11 @@ int qemu_cpu_is_self(void *_env)
> return qemu_thread_is_self(cpu->thread);
> }
>
> +static bool qemu_cpu_is_vcpu(void)
> +{
> + return cpu_single_env && qemu_cpu_is_self(&cpu_single_env);
Should be "cpu_single_env && qemu_cpu_is_self(&cpu_single_env)".
Please named the function qemu_in_vcpu_thread.
Paolo
> +}
> +
> void qemu_mutex_lock_iothread(void)
> {
> if (!tcg_enabled()) {
> @@ -947,7 +952,7 @@ void pause_all_vcpus(void)
> penv = penv->next_cpu;
> }
>
> - if (!qemu_thread_is_self(&io_thread)) {
> + if (qemu_cpu_is_vcpu()) {
> cpu_stop_current();
> if (!kvm_enabled()) {
> while (penv) {
> @@ -1064,7 +1069,7 @@ void cpu_stop_current(void)
>
> void vm_stop(RunState state)
> {
> - if (!qemu_thread_is_self(&io_thread)) {
> + if (qemu_cpu_is_vcpu()) {
> qemu_system_vmstop_request(state);
> /*
> * FIXME: should not return to device code in case
>
- [Qemu-devel] [PATCH 33/41] savevm: make qemu_fill_buffer() be consistent, (continued)
- [Qemu-devel] [PATCH 33/41] savevm: make qemu_fill_buffer() be consistent, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 32/41] savevm: unexport qemu_ftell(), Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 31/41] savevm: unfold qemu_fclose_internal(), Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 28/41] virtio-net: use qemu_get_buffer() in a temp buffer, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 41/41] cpus: create qemu_cpu_is_vcpu(), Juan Quintela, 2012/09/21
- Re: [Qemu-devel] [PATCH 41/41] cpus: create qemu_cpu_is_vcpu(),
Paolo Bonzini <=
- [Qemu-devel] [PATCH 35/41] buffered_file: buffered_put_buffer() don't need to set last_error, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 37/41] block-migration: Switch meaning of return value, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 34/41] savevm: Only qemu_fflush() can generate errors, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 24/41] buffered_file: callers of buffered_flush() already check for errors, Juan Quintela, 2012/09/21