From nobody Sun Apr 28 14:30:25 2024 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 148705657348176.67325537381225; Mon, 13 Feb 2017 23:16:13 -0800 (PST) Received: from localhost ([::1]:33128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdXLO-0006jC-Eb for importer@patchew.org; Tue, 14 Feb 2017 02:16:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdXKX-0006Sd-IZ for qemu-devel@nongnu.org; Tue, 14 Feb 2017 02:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdXKU-0007T0-9m for qemu-devel@nongnu.org; Tue, 14 Feb 2017 02:15:17 -0500 Received: from mail.ispras.ru ([83.149.199.45]:49986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdXKU-0007QC-1k for qemu-devel@nongnu.org; Tue, 14 Feb 2017 02:15:14 -0500 Received: from [10.10.150.97] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 6DCE354006A; Tue, 14 Feb 2017 10:15:09 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Tue, 14 Feb 2017 10:15:10 +0300 Message-ID: <20170214071510.6112.76764.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH v3] 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: pbonzini@redhat.com, zyy@google.com, dovgaluk@ispras.ru, kraxel@redhat.com, marcandre.lureau@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 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 --- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index c845a44..beadf7b 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1112,7 +1112,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 {