From nobody Thu Nov 6 01:11:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153829609855129.874872842726518; Sun, 30 Sep 2018 01:28:18 -0700 (PDT) Received: from localhost ([::1]:54282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6X5N-0006nH-6P for importer@patchew.org; Sun, 30 Sep 2018 04:28:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Wrf-0002aO-JP for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6Wre-0000u0-RO for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:07 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6Wre-0000tD-Kk for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:06 -0400 Received: by mail-wm1-x342.google.com with SMTP id s12-v6so5813760wmc.0 for ; Sun, 30 Sep 2018 01:14:06 -0700 (PDT) Received: from 640k.lan (94-36-187-248.adsl-ull.clienti.tiscali.it. [94.36.187.248]) by smtp.gmail.com with ESMTPSA id u76-v6sm11369194wmd.10.2018.09.30.01.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Sep 2018 01:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=W/MqhJvGcMqwq1KukRNpoXEaFyEsc1r6McOP4cWOT3Q=; b=ZAgpKJ62td5JZVOW2qBFmPHKXmwWLWtjn4Srme3zSe/rs5nFqHq94Yi2CV/5xj63pZ ReIeZ59HwrEBdlsXNZ5ERh8FM172zbmKkWzbBueN7mAWfVtcfKe2wYZi5TIEz7WP7a4m wxxZa+X17MjEmrJ03kM/qWxQadAcI+eGAEArw1O6yT+nM2xQ4xdQ5tm1zRMGifpp32zg FXVusXr71yV7DMG1TvUXzF1YyL66YKze+E14vAyQk7AE9mfmkMvgsndm37GyysRiXhEB 4U/RueT2M7OGOp9siBcu7f33bhJzr5Q3FKo64Ozrc9RLjQ6fqT/2a+V1qoZXL438v+92 wMWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=W/MqhJvGcMqwq1KukRNpoXEaFyEsc1r6McOP4cWOT3Q=; b=oMFza9l64VktJQgdBSz3PRKKgW78aGFQ710w95fK3BYJOfq4ptL+MRX7PZCD0IqDEN DN85xGElsh0dnEwBag1CvZSYcZjKpJlocH6RXohK84jvxWJcI7Fn9JINswC8ygmmteoZ 32sDieZCCQnURBaDgVLLT5L5u9MT0Y0bioPhRqykz+XQsWSwM6u2qlpld79mY7h70Azy 6tpelEMPEN8nnkMm/jKXZr8BpHqWrCtRfJpgb2jUcU7fLcrqko5B77hElVuzUtCGzsBi ohDjSLr6vSPDxQ5L1VJ+4eD/qM9ebdCPuC50nYgtx8AGdp4N1Vr3a4F9ZOoNSPDfj6nA iz2w== X-Gm-Message-State: ABuFfogsErnZ4c+R/eKwao/BVOke8XsEZClmXWDvk2Exlqtlo2YI1iYD pDu0GR8TSBWLYzMBBJ6GXwfr/FVn X-Google-Smtp-Source: ACcGV62HO0InhoXQyV8oXQ6Yaoq0g2O83wOyz+gq9gYetcsY/SCCLQUgAZlkesNj1CD4im96uvLmrQ== X-Received: by 2002:a1c:9a11:: with SMTP id c17-v6mr400907wme.101.1538295244850; Sun, 30 Sep 2018 01:14:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 30 Sep 2018 10:12:40 +0200 Message-Id: <1538295197-23704-43-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> References: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PULL 42/79] timer: introduce new virtual clock 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk Slirp and VNC modules use virtual clock for processing some events that are related to the guest execution speed. But virtual clock-related events are consideres to be deterministic and are recorded/replayed by icount mechanism. But slirp and VNC lie outside the recorded guest core (which includes CPU and peripherals). Therefore slirp and VNC are external for the guest, but should work at guest speed. This patch introduces new virtual clock which can be used for external subsystems for running timers that are synchronized with the guest. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180912082002.3228.82417.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- include/qemu/timer.h | 9 +++++++++ util/qemu-timer.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 39ea907..a005ed2 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -42,6 +42,14 @@ * In icount mode, this clock counts nanoseconds while the virtual * machine is running. It is used to increase @QEMU_CLOCK_VIRTUAL * while the CPUs are sleeping and thus not executing instructions. + * + * @QEMU_CLOCK_VIRTUAL_EXT: virtual clock for external subsystems + * + * The virtual clock only runs during the emulation. It stops + * when the virtual machine is stopped. The timers for this clock + * do not recorded in rr mode, therefore this clock could be used + * for the subsystems that operate outside the guest core. + * */ =20 typedef enum { @@ -49,6 +57,7 @@ typedef enum { QEMU_CLOCK_VIRTUAL =3D 1, QEMU_CLOCK_HOST =3D 2, QEMU_CLOCK_VIRTUAL_RT =3D 3, + QEMU_CLOCK_VIRTUAL_EXT =3D 4, QEMU_CLOCK_MAX } QEMUClockType; =20 diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 86bfe84..eb60d8f 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -496,6 +496,7 @@ bool timerlist_run_timers(QEMUTimerList *timer_list) =20 switch (timer_list->clock->type) { case QEMU_CLOCK_REALTIME: + case QEMU_CLOCK_VIRTUAL_EXT: break; default: case QEMU_CLOCK_VIRTUAL: @@ -597,6 +598,7 @@ int64_t qemu_clock_get_ns(QEMUClockType type) return get_clock(); default: case QEMU_CLOCK_VIRTUAL: + case QEMU_CLOCK_VIRTUAL_EXT: if (use_icount) { return cpu_get_icount(); } else { --=20 1.8.3.1