From patchwork Mon Dec 21 08:09:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 41534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4FE72B6F15 for ; Mon, 21 Dec 2009 20:04:58 +1100 (EST) Received: from localhost ([127.0.0.1]:40178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMeCE-0003ZK-Pq for incoming@patchwork.ozlabs.org; Mon, 21 Dec 2009 04:04:54 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMdL3-0002pV-8W for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMdKt-0002kL-Oo for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:52 -0500 Received: from [199.232.76.173] (port=52824 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMdKt-0002ju-ET for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9496) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMdKs-0003pA-Ue for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:47 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBL89k8C030915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Dec 2009 03:09:46 -0500 Received: from localhost.localdomain (vpn2-10-119.ams2.redhat.com [10.36.10.119]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBL89V3Z011460 for ; Mon, 21 Dec 2009 03:09:45 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 21 Dec 2009 09:09:26 +0100 Message-Id: <1261382970-23251-16-git-send-email-pbonzini@redhat.com> In-Reply-To: <1261382970-23251-1-git-send-email-pbonzini@redhat.com> References: <1261382970-23251-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 15/19] do not provide qemu_event_increment if iothread not used X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org host_alarm_handler is using qemu_event_increment instead of qemu_notify_event. After fixing this, the whole event business can be omitted if not using the iothread. Signed-off-by: Paolo Bonzini --- vl.c | 130 ++++++++++++++++++++++++++++++++---------------------------------- 1 files changed, 63 insertions(+), 67 deletions(-) diff --git a/vl.c b/vl.c index f7472db..11b1b70 100644 --- a/vl.c +++ b/vl.c @@ -1019,8 +1019,6 @@ static const VMStateDescription vmstate_timers = { } }; -static void qemu_event_increment(void); - static void qemu_timer_bh(void *opaque) { struct qemu_alarm_timer *t = opaque; @@ -1095,7 +1093,7 @@ static void host_alarm_handler(int host_signum) qemu_get_clock(rt_clock)) || qemu_timer_expired(active_timers[QEMU_CLOCK_HOST], qemu_get_clock(host_clock))) { - qemu_event_increment(); + qemu_notify_event(); t->expired = alarm_has_dynticks(t); #ifndef CONFIG_IOTHREAD @@ -3265,13 +3263,21 @@ void qemu_system_powerdown_request(void) qemu_notify_event(); } +static int cpu_can_run(CPUState *env) +{ + if (env->stop) + return 0; + if (env->stopped) + return 0; + return 1; +} + #ifdef CONFIG_IOTHREAD static void qemu_system_vmstop_request(int reason) { vmstop_requested = reason; qemu_notify_event(); } -#endif #ifndef _WIN32 static int io_thread_fd = -1; @@ -3354,69 +3360,6 @@ static void qemu_event_increment(void) } #endif -static int cpu_can_run(CPUState *env) -{ - if (env->stop) - return 0; - if (env->stopped) - return 0; - return 1; -} - -#ifndef CONFIG_IOTHREAD -static int qemu_init_main_loop(void) -{ - return qemu_event_init(); -} - -void qemu_init_vcpu(void *_env) -{ - CPUState *env = _env; - - if (kvm_enabled()) - kvm_init_vcpu(env); - env->nr_cores = smp_cores; - env->nr_threads = smp_threads; - return; -} - -int qemu_cpu_self(void *env) -{ - return 1; -} - -static void resume_all_vcpus(void) -{ -} - -static void pause_all_vcpus(void) -{ -} - -void qemu_cpu_kick(void *env) -{ - return; -} - -void qemu_notify_event(void) -{ - CPUState *env = cpu_single_env; - - if (env) { - cpu_exit(env); - } -} - -void qemu_mutex_lock_iothread(void) {} -void qemu_mutex_unlock_iothread(void) {} - -void vm_stop(int reason) -{ - do_vm_stop(reason); -} - -#else /* CONFIG_IOTHREAD */ - #include "qemu-thread.h" QemuMutex qemu_global_mutex; @@ -3734,6 +3677,59 @@ void vm_stop(int reason) do_vm_stop(reason); } +#else /* CONFIG_IOTHREAD */ + +static int qemu_init_main_loop(void) +{ + return 0; +} + +void qemu_init_vcpu(void *_env) +{ + CPUState *env = _env; + + if (kvm_enabled()) + kvm_init_vcpu(env); + env->nr_cores = smp_cores; + env->nr_threads = smp_threads; + return; +} + +int qemu_cpu_self(void *env) +{ + return 1; +} + +static void resume_all_vcpus(void) +{ +} + +static void pause_all_vcpus(void) +{ +} + +void qemu_cpu_kick(void *env) +{ + return; +} + +void qemu_notify_event(void) +{ + CPUState *env = cpu_single_env; + + if (env) { + cpu_exit(env); + } +} + +void qemu_mutex_lock_iothread(void) {} +void qemu_mutex_unlock_iothread(void) {} + +void vm_stop(int reason) +{ + do_vm_stop(reason); +} + #endif