From nobody Thu Nov 6 19:51:27 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14882098651417.1966744762900134; Mon, 27 Feb 2017 07:37:45 -0800 (PST) Received: from localhost ([::1]:53697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciNMr-0000ir-Qn for importer@patchew.org; Mon, 27 Feb 2017 10:37:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMxg-00038B-5T for qemu-devel@nongnu.org; Mon, 27 Feb 2017 10:11:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMxd-0005BV-1A for qemu-devel@nongnu.org; Mon, 27 Feb 2017 10:11:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMxc-0005BE-Qw for qemu-devel@nongnu.org; Mon, 27 Feb 2017 10:11:36 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0FDCFAF56; Mon, 27 Feb 2017 15:11:36 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC0DD2D5C0; Mon, 27 Feb 2017 15:11:35 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 1AD0880752; Mon, 27 Feb 2017 16:11:33 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 27 Feb 2017 16:11:30 +0100 Message-Id: <1488208291-14775-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1488208291-14775-1-git-send-email-kraxel@redhat.com> References: <1488208291-14775-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 27 Feb 2017 15:11:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] audio: make audio poll timer deterministic 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: Gerd Hoffmann , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: 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 This patch changes resetting strategy of the audio polling timer. It does not change expiration time if the timer is already set. This patch is needed to make this timer deterministic and to use execution record/replay for audio devices. audio_reset_timer is used in the function audio_vm_change_state_handler. Therefore every time VM is stopped or restarted the timer will be reset to new timeout. Virtual clock does not proceed while VM is stopped. Therefore there is no need in resetting the timeout when VM restarts. v2: updated commit message v3: now using timer_mod_anticipate function (as suggested by Yurii Zubrytsk= yi) Signed-off-by: Pavel Dovgalyuk Message-id: 20170214071510.6112.76764.stgit@PASHA-ISP Signed-off-by: Gerd Hoffmann --- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 21f7b0b..c8898d8 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1113,7 +1113,7 @@ static int audio_is_timer_needed (void) static void audio_reset_timer (AudioState *s) { if (audio_is_timer_needed ()) { - timer_mod (s->ts, + timer_mod_anticipate_ns(s->ts, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + conf.period.ticks); } else { --=20 1.8.3.1