From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMfh-0007yq-5u for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTMfc-0005JV-MX for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:41 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52385 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMfc-0005Iw-Bu for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:36 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 31 Oct 2012 01:59:46 +0100 Message-Id: <1351645206-3041-16-git-send-email-afaerber@suse.de> In-Reply-To: <1351645206-3041-1-git-send-email-afaerber@suse.de> References: <1351645206-3041-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 15/35] cpu: Move halt_cond to CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws Signed-off-by: Andreas F=C3=A4rber --- cpu-defs.h | 1 - cpus.c | 22 ++++++++++++---------- include/qemu/cpu.h | 1 + 3 Dateien ge=C3=A4ndert, 13 Zeilen hinzugef=C3=BCgt(+), 11 Zeilen entfer= nt(-) diff --git a/cpu-defs.h b/cpu-defs.h index 83bf108..76c76f6 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -205,7 +205,6 @@ typedef struct CPUWatchpoint { /* user data */ = \ void *opaque; = \ = \ - struct QemuCond *halt_cond; = \ struct qemu_work_item *queued_work_first, *queued_work_last; = \ const char *cpu_model_str; = \ struct KVMState *kvm_state; = \ diff --git a/cpus.c b/cpus.c index 45877ee..5a80bfa 100644 --- a/cpus.c +++ b/cpus.c @@ -722,8 +722,10 @@ static void qemu_tcg_wait_io_event(void) =20 static void qemu_kvm_wait_io_event(CPUArchState *env) { + CPUState *cpu =3D ENV_GET_CPU(env); + while (cpu_thread_is_idle(env)) { - qemu_cond_wait(env->halt_cond, &qemu_global_mutex); + qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } =20 qemu_kvm_eat_signals(env); @@ -873,7 +875,7 @@ void qemu_cpu_kick(void *_env) CPUArchState *env =3D _env; CPUState *cpu =3D ENV_GET_CPU(env); =20 - qemu_cond_broadcast(env->halt_cond); + qemu_cond_broadcast(cpu->halt_cond); if (!tcg_enabled() && !cpu->thread_kicked) { qemu_cpu_kick_thread(cpu); cpu->thread_kicked =3D true; @@ -997,9 +999,9 @@ static void qemu_tcg_init_vcpu(void *_env) /* share a single thread for all cpus with TCG */ if (!tcg_cpu_thread) { cpu->thread =3D g_malloc0(sizeof(QemuThread)); - env->halt_cond =3D g_malloc0(sizeof(QemuCond)); - qemu_cond_init(env->halt_cond); - tcg_halt_cond =3D env->halt_cond; + cpu->halt_cond =3D g_malloc0(sizeof(QemuCond)); + qemu_cond_init(cpu->halt_cond); + tcg_halt_cond =3D cpu->halt_cond; qemu_thread_create(cpu->thread, qemu_tcg_cpu_thread_fn, env, QEMU_THREAD_JOINABLE); #ifdef _WIN32 @@ -1011,7 +1013,7 @@ static void qemu_tcg_init_vcpu(void *_env) tcg_cpu_thread =3D cpu->thread; } else { cpu->thread =3D tcg_cpu_thread; - env->halt_cond =3D tcg_halt_cond; + cpu->halt_cond =3D tcg_halt_cond; } } =20 @@ -1020,8 +1022,8 @@ static void qemu_kvm_start_vcpu(CPUArchState *env) CPUState *cpu =3D ENV_GET_CPU(env); =20 cpu->thread =3D g_malloc0(sizeof(QemuThread)); - env->halt_cond =3D g_malloc0(sizeof(QemuCond)); - qemu_cond_init(env->halt_cond); + cpu->halt_cond =3D g_malloc0(sizeof(QemuCond)); + qemu_cond_init(cpu->halt_cond); qemu_thread_create(cpu->thread, qemu_kvm_cpu_thread_fn, env, QEMU_THREAD_JOINABLE); while (!cpu->created) { @@ -1034,8 +1036,8 @@ static void qemu_dummy_start_vcpu(CPUArchState *env= ) CPUState *cpu =3D ENV_GET_CPU(env); =20 cpu->thread =3D g_malloc0(sizeof(QemuThread)); - env->halt_cond =3D g_malloc0(sizeof(QemuCond)); - qemu_cond_init(env->halt_cond); + cpu->halt_cond =3D g_malloc0(sizeof(QemuCond)); + qemu_cond_init(cpu->halt_cond); qemu_thread_create(cpu->thread, qemu_dummy_cpu_thread_fn, env, QEMU_THREAD_JOINABLE); while (!cpu->created) { diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h index 4e62032..75e0f8d 100644 --- a/include/qemu/cpu.h +++ b/include/qemu/cpu.h @@ -69,6 +69,7 @@ struct CPUState { #ifdef _WIN32 HANDLE hThread; #endif + struct QemuCond *halt_cond; bool thread_kicked; bool created; bool stop; --=20 1.7.10.4