From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [CFT PATCH 11/12] do not use timedwait on qemu_cpu_cond
Date: Tue, 8 Feb 2011 18:18:28 +0100 [thread overview]
Message-ID: <1297185509-20996-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1297185509-20996-1-git-send-email-pbonzini@redhat.com>
Whenever env->created becomes true, qemu_cpu_cond is signaled by
{kvm,tcg}_cpu_thread_fn.
I change qemu_cond_signal to qemu_cond_broadcast because right now
there is only one listened but, if there were more, there would be
no reason to wake up only one.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
cpus.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cpus.c b/cpus.c
index 97ba166..67fd672 100644
--- a/cpus.c
+++ b/cpus.c
@@ -794,7 +794,7 @@ static void *kvm_cpu_thread_fn(void *arg)
/* signal CPU creation */
env->created = 1;
- qemu_cond_signal(&qemu_cpu_cond);
+ qemu_cond_broadcast(&qemu_cpu_cond);
/* and wait for machine initialization */
while (!qemu_system_ready)
@@ -820,7 +820,7 @@ static void *tcg_cpu_thread_fn(void *arg)
qemu_mutex_lock(&qemu_global_mutex);
for (env = first_cpu; env != NULL; env = env->next_cpu)
env->created = 1;
- qemu_cond_signal(&qemu_cpu_cond);
+ qemu_cond_broadcast(&qemu_cpu_cond);
/* and wait for machine initialization */
while (!qemu_system_ready)
@@ -935,7 +935,7 @@ static void tcg_init_vcpu(void *_env)
qemu_cond_init(env->halt_cond);
qemu_thread_create(env->thread, tcg_cpu_thread_fn, env);
while (env->created == 0)
- qemu_cond_timedwait(&qemu_cpu_cond, &qemu_global_mutex, 100);
+ qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
tcg_cpu_thread = env->thread;
tcg_halt_cond = env->halt_cond;
} else {
@@ -951,7 +951,7 @@ static void kvm_start_vcpu(CPUState *env)
qemu_cond_init(env->halt_cond);
qemu_thread_create(env->thread, kvm_cpu_thread_fn, env);
while (env->created == 0)
- qemu_cond_timedwait(&qemu_cpu_cond, &qemu_global_mutex, 100);
+ qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
void qemu_init_vcpu(void *_env)
--
1.7.3.5
next prev parent reply other threads:[~2011-02-08 17:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 17:18 [Qemu-devel] [CFT PATCH 00/12] Tricky parts of my iothread-for-win32 stuff Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 01/12] io-thread: make sure to initialize qemu_work_cond and qemu_cpu_cond Paolo Bonzini
2011-02-14 19:21 ` Anthony Liguori
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 02/12] cris, microblaze: use cpu_has_work Paolo Bonzini
2011-02-08 19:42 ` Edgar E. Iglesias
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 03/12] inline cpu_halted into sole caller Paolo Bonzini
2011-02-08 20:24 ` [Qemu-devel] " Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 04/12] change qemu_thread_equal API to always compare with current thread Paolo Bonzini
2011-02-08 20:25 ` [Qemu-devel] " Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 05/12] always qemu_cpu_kick after unhalting a cpu Paolo Bonzini
2011-02-08 20:25 ` [Qemu-devel] " Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 06/12] exit round-robin vcpu loop if cpu->stopped is true Paolo Bonzini
2011-02-08 20:24 ` [Qemu-devel] " Jan Kiszka
2011-02-09 7:24 ` Paolo Bonzini
2011-02-09 7:24 ` Paolo Bonzini
2011-02-09 8:40 ` Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 07/12] always signal pause_cond after stopping a VCPU Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 08/12] do not use timedwait on qemu_halt_cond Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 09/12] do not use timedwait on qemu_system_cond Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 10/12] do not use timedwait on qemu_pause_cond Paolo Bonzini
2011-02-08 17:18 ` Paolo Bonzini [this message]
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 12/12] iothread stops the vcpu thread via IPI Paolo Bonzini
2011-02-08 19:31 ` [Qemu-devel] [CFT PATCH 00/12] Tricky parts of my iothread-for-win32 stuff Aurelien Jarno
2011-02-08 20:38 ` [Qemu-devel] " Jan Kiszka
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=1297185509-20996-12-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--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).