From nobody Wed Apr 24 19:49:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590130439; cv=none; d=zohomail.com; s=zohoarc; b=KucvTZKbyM+1VQvE4zdNfb0YKHLLd4+br5VKosBdunDSSGDcUkagCRpmPUV3Agr5cRWEdpG9625eGfJ31W2rqtHWV5S1wBhiSYHEQfjs6fLc3V7OueYAvWykKUQZT7Dgw4kITzi/wnJbBQwFigBVoK648SIhpkIhhdHKXAYvR70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590130439; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ai8k1aUJ1Bbgx+v/y9A+YBJE4orncDV83TQ9Ql2uUJg=; b=Y2fwhesIeCvUGj+a6ex+O77MRAJv2z5LIQRg1bdRaCsBu6YyBCqNWN2wQncvY75oP3xzW8luATfpw0PZPFP/rvpBkG54Jigv4zqHu3IcCUiXK+BjwKge4Hyec2kVtx6f2SBoOlZkdNhKhxNQd4KZhh9hyA5K1rb5+1zFjEtbEoc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590130439355289.81998617688794; Thu, 21 May 2020 23:53:59 -0700 (PDT) Received: from localhost ([::1]:33408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jc1Z8-000788-35 for importer@patchew.org; Fri, 22 May 2020 02:53:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jc1TN-0007Ub-S9 for qemu-devel@nongnu.org; Fri, 22 May 2020 02:48:01 -0400 Received: from mail.ispras.ru ([83.149.199.45]:40200) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jc1TN-00016S-6H for qemu-devel@nongnu.org; Fri, 22 May 2020 02:48:01 -0400 Received: from [127.0.1.1] (unknown [62.118.151.149]) by mail.ispras.ru (Postfix) with ESMTPSA id 6F2F6CD46A; Fri, 22 May 2020 09:47:59 +0300 (MSK) Subject: [PATCH] replay: notify the main loop when there are no instructions From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Fri, 22 May 2020 09:47:58 +0300 Message-ID: <159013007895.28110.2020104406699709721.stgit@pasha-ThinkPad-X280> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: softfail client-ip=83.149.199.45; envelope-from=Pavel.Dovgaluk@gmail.com; helo=mail.ispras.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/22 02:35:28 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, alex.bennee@linaro.org, pavel.dovgaluk@ispras.ru, dovgaluk@ispras.ru Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" When QEMU is executed in console mode without any external event sources, main loop may sleep for a very long time. But in case of replay there is another event source - event log. This patch adds main loop notification when the vCPU loop has nothing to do and main loop should process the inputs from the event log. Signed-off-by: Pavel Dovgalyuk --- 0 files changed diff --git a/cpus.c b/cpus.c index 7ce0d569b3..b4d0d9f21b 100644 --- a/cpus.c +++ b/cpus.c @@ -1362,6 +1362,13 @@ static int64_t tcg_get_icount_limit(void) } } =20 +static void notify_aio_contexts(void) +{ + /* Wake up other AioContexts. */ + qemu_clock_notify(QEMU_CLOCK_VIRTUAL); + qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); +} + static void handle_icount_deadline(void) { assert(qemu_in_vcpu_thread()); @@ -1370,9 +1377,7 @@ static void handle_icount_deadline(void) QEMU_TIMER_ATTR_ALL); =20 if (deadline =3D=3D 0) { - /* Wake up other AioContexts. */ - qemu_clock_notify(QEMU_CLOCK_VIRTUAL); - qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); + notify_aio_contexts(); } } } @@ -1395,6 +1400,10 @@ static void prepare_icount_for_run(CPUState *cpu) cpu->icount_extra =3D cpu->icount_budget - insns_left; =20 replay_mutex_lock(); + + if (cpu->icount_budget =3D=3D 0 && replay_has_checkpoint()) { + notify_aio_contexts(); + } } } =20