From patchwork Thu May 26 16:35:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alvise rigo X-Patchwork-Id: 9137273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F2BC16075A for ; Thu, 26 May 2016 16:49:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E673727BFE for ; Thu, 26 May 2016 16:49:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA55A282E1; Thu, 26 May 2016 16:49:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6255B27BFE for ; Thu, 26 May 2016 16:49:38 +0000 (UTC) Received: from localhost ([::1]:39549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5yTZ-0002Fl-Hn for patchwork-qemu-devel@patchwork.kernel.org; Thu, 26 May 2016 12:49:37 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtualopensystems-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4ITaZRZFSFmw9LjKnXXtaO/7Fwswj8cgf3W9hvWGHnM=; b=zPgnMjRah/efoHUMd4cEu9Nko7BeI/uO/C8BpbYIJRIAyWlO4nZhyh/N9shzRo7ztX s31gfjXKa2/MlYHyGY5bGS+4y23Hh5s7/fCOM9PmP4z/UOHEfrKMPR/C/pHJ7zpfeyAr 7A64JjUzFs8A0zlwCuTQsQeHoz9iwuOAeS+fHvWwfCzlZwVb457uS8YLE8AOpwDI4vDg o1s424pFqQYqM5y/eanmfZLW7aQ+DetuP85OGWCKhVvFunqB7gSKrRcCiQeJXdftM+ik zuOffRJGUYcQSA8foHpw3a3yQLz5SMKr0rDn9zds6LjTPtLtixmodm7h1Ix1ijGGESsq 0OrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4ITaZRZFSFmw9LjKnXXtaO/7Fwswj8cgf3W9hvWGHnM=; b=FzOGQrSpQMSf2rBXQybdMC3RzfMjfWoyeWpeKkaUOD8bW1uwDuJTXigzyiSm2bAjT1 XBHF+3CE9eX1xNFmeL+MxlxRV+NpVBNcT0/jQBT1Dzh10L+LzI7dYwi8jRf9Jr9iBZaX S/0Xv83L+RoGqBmsh1eNpmThUTjBndbe4+JvAIncJEiNVKBPY1w0iPbvqTYTkj5JPRYD JXcKFs5ImSUlnvwusDDdRVEAVX8VEcJ9ht1XDyy/mnLRZZX6vY37AG0xc1+jnp1igLDr Gl98/3pyKrG126wz+iSn1kBmUenDnz12xhbdVR0AdR37jNdZ/KEFJJ1xM1kaMKsTlQr9 gMhg== X-Gm-Message-State: ALyK8tIcqRWfNk1gZl/VEN1IfVdyNmWkrzsvl/u2Ecvdi5p5T+oA40sc6cjK3hFflcS7jA== X-Received: by 10.28.107.85 with SMTP id g82mr4409446wmc.65.1464280583405; Thu, 26 May 2016 09:36:23 -0700 (PDT) Received: from linarch.localdomain (LPuteaux-656-1-278-113.w80-15.abo.wanadoo.fr. [80.15.154.113]) by smtp.googlemail.com with ESMTPSA id lf9sm15133703wjc.44.2016.05.26.09.36.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2016 09:36:22 -0700 (PDT) From: Alvise Rigo To: mttcg@listserver.greensocs.com, alex.bennee@linaro.org Date: Thu, 26 May 2016 18:35:49 +0200 Message-Id: <20160526163549.3276-11-a.rigo@virtualopensystems.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160526163549.3276-1-a.rigo@virtualopensystems.com> References: <20160526163549.3276-1-a.rigo@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [RFC 10/10] cpus: Do not sleep if some work item is pending X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, rth@twiddle.net, claudio.fontana@huawei.com, qemu-devel@nongnu.org, Alvise Rigo , cota@braap.org, serge.fdrv@gmail.com, pbonzini@redhat.com, jani.kokkonen@huawei.com, tech@virtualopensystems.com, fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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); }