From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMfu-000056-6Q for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTMfm-0005Nt-Uw for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52400 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMfm-0005ML-Ib for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:46 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 31 Oct 2012 01:59:52 +0100 Message-Id: <1351645206-3041-22-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 21/35] cpu: Move queued_work_{first, last} 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 | 19 ++++++++++--------- include/qemu/cpu.h | 1 + 3 Dateien ge=C3=A4ndert, 11 Zeilen hinzugef=C3=BCgt(+), 10 Zeilen entfer= nt(-) diff --git a/cpu-defs.h b/cpu-defs.h index 76c76f6..b30a8e9 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -205,7 +205,6 @@ typedef struct CPUWatchpoint { /* user data */ = \ void *opaque; = \ = \ - struct qemu_work_item *queued_work_first, *queued_work_last; = \ const char *cpu_model_str; = \ struct KVMState *kvm_state; = \ struct kvm_run *kvm_run; = \ diff --git a/cpus.c b/cpus.c index b802d38..307c1f2 100644 --- a/cpus.c +++ b/cpus.c @@ -66,7 +66,7 @@ static bool cpu_thread_is_idle(CPUArchState *env) { CPUState *cpu =3D ENV_GET_CPU(env); =20 - if (cpu->stop || env->queued_work_first) { + if (cpu->stop || cpu->queued_work_first) { return false; } if (cpu->stopped || !runstate_is_running()) { @@ -652,12 +652,12 @@ void run_on_cpu(CPUArchState *env, void (*func)(voi= d *data), void *data) =20 wi.func =3D func; wi.data =3D data; - if (!env->queued_work_first) { - env->queued_work_first =3D &wi; + if (cpu->queued_work_first =3D=3D NULL) { + cpu->queued_work_first =3D &wi; } else { - env->queued_work_last->next =3D &wi; + cpu->queued_work_last->next =3D &wi; } - env->queued_work_last =3D &wi; + cpu->queued_work_last =3D &wi; wi.next =3D NULL; wi.done =3D false; =20 @@ -672,18 +672,19 @@ void run_on_cpu(CPUArchState *env, void (*func)(voi= d *data), void *data) =20 static void flush_queued_work(CPUArchState *env) { + CPUState *cpu =3D ENV_GET_CPU(env); struct qemu_work_item *wi; =20 - if (!env->queued_work_first) { + if (cpu->queued_work_first =3D=3D NULL) { return; } =20 - while ((wi =3D env->queued_work_first)) { - env->queued_work_first =3D wi->next; + while ((wi =3D cpu->queued_work_first)) { + cpu->queued_work_first =3D wi->next; wi->func(wi->data); wi->done =3D true; } - env->queued_work_last =3D NULL; + cpu->queued_work_last =3D NULL; qemu_cond_broadcast(&qemu_work_cond); } =20 diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h index bfeb224..eea6175 100644 --- a/include/qemu/cpu.h +++ b/include/qemu/cpu.h @@ -70,6 +70,7 @@ struct CPUState { HANDLE hThread; #endif struct QemuCond *halt_cond; + struct qemu_work_item *queued_work_first, *queued_work_last; bool thread_kicked; bool created; bool stop; --=20 1.7.10.4