Received: from eggs.gnu.org ([2001:4830:134:3::10]:58621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5yGr-0006fU-9A for qemu-devel@nongnu.org; Thu, 26 May 2016 12:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5yGm-0003oU-Ba for qemu-devel@nongnu.org; Thu, 26 May 2016 12:36:28 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5yGm-0003oI-0x for qemu-devel@nongnu.org; Thu, 26 May 2016 12:36:24 -0400 Received: by mail-wm0-x241.google.com with SMTP id n129so6555334wmn.1 for ; Thu, 26 May 2016 09:36:23 -0700 (PDT) From: Alvise Rigo Date: Thu, 26 May 2016 18:35:49 +0200 Message-Id: <20160526163549.3276-11-a.rigo@virtualopensystems.com> In-Reply-To: <20160526163549.3276-1-a.rigo@virtualopensystems.com> References: <20160526163549.3276-1-a.rigo@virtualopensystems.com> Subject: [Qemu-devel] [RFC 10/10] cpus: Do not sleep if some work item is pending List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mttcg@listserver.greensocs.com, alex.bennee@linaro.org Cc: qemu-devel@nongnu.org, jani.kokkonen@huawei.com, claudio.fontana@huawei.com, tech@virtualopensystems.com, fred.konrad@greensocs.com, pbonzini@redhat.com, rth@twiddle.net, serge.fdrv@gmail.com, cota@braap.org, peter.maydell@linaro.org, Alvise Rigo If a VCPU returns EXCP_HALTED from the guest code execution and in the mean time receives a work item, it will go to sleep without processing the job. Before sleeping, check if any work has been added. Signed-off-by: Alvise Rigo --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 7bc96e2..3d19a2e 100644 --- a/cpus.c +++ b/cpus.c @@ -1477,7 +1477,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) handle_icount_deadline(); - if (sleep) { + if (sleep && cpu->queued_work_first == NULL) { qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } -- 2.8.3