From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: linzc@zju.edu.cn
Subject: [Qemu-devel] [PATCH 4/6] cpus: tcg: unregister thread with RCU, fix exiting of loop on unplug
Date: Thu, 1 Feb 2018 09:44:28 -0500 [thread overview]
Message-ID: <20180201144430.14441-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20180201144430.14441-1-pbonzini@redhat.com>
Keep running until cpu_can_run(cpu) becomes false, for consistency
with other acceslerators.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
cpus.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cpus.c b/cpus.c
index 34c86192d1..9f48ccad9e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1468,6 +1468,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
deal_with_unplugged_cpus();
}
+ rcu_unregister_thread();
return NULL;
}
@@ -1644,18 +1645,17 @@ 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);
qemu_wait_io_event(cpu);
- }
+ } while (!cpu->unplug || cpu_can_run(cpu));
+ qemu_tcg_destroy_vcpu(cpu);
+ cpu->created = false;
+ qemu_cond_signal(&qemu_cpu_cond);
+ qemu_mutex_unlock_iothread();
+ rcu_unregister_thread();
return NULL;
}
--
2.14.3
next prev parent reply other threads:[~2018-02-01 14:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 14:44 [Qemu-devel] [PATCH 0/6] cpus: fix various issues with vCPU unplug Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 1/6] cpus: hax: register/unregister thread with RCU, exit loop on unplug Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 2/6] cpus: kvm: unregister thread with RCU Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 3/6] cpus: dummy: unregister thread with RCU, exit loop on unplug Paolo Bonzini
2018-02-01 14:44 ` Paolo Bonzini [this message]
2018-02-01 15:05 ` [Qemu-devel] [PATCH 4/6] cpus: tcg: unregister thread with RCU, fix exiting of " Eric Blake
2018-02-01 14:44 ` [Qemu-devel] [PATCH 5/6] cpus: hvf: unregister thread with RCU Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 6/6] cpus: join thread when removing a vCPU Paolo Bonzini
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=20180201144430.14441-5-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=linzc@zju.edu.cn \
--cc=qemu-devel@nongnu.org \
/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).