From patchwork Wed Mar 1 15:40:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 734262 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vYKVY33Wrz9s7j for ; Thu, 2 Mar 2017 02:43:49 +1100 (AEDT) Received: from localhost ([::1]:47242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj6Pq-0002Mx-WE for incoming@patchwork.ozlabs.org; Wed, 01 Mar 2017 10:43:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj6N9-0000N5-1z for qemu-devel@nongnu.org; Wed, 01 Mar 2017 10:41:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cj6N5-0000C5-BE for qemu-devel@nongnu.org; Wed, 01 Mar 2017 10:40:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cj6N4-0000Bl-T0 for qemu-devel@nongnu.org; Wed, 01 Mar 2017 10:40:55 -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 059DAC054901; Wed, 1 Mar 2017 15:40:55 +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 AB31072380; Wed, 1 Mar 2017 15:40:54 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id B8CBB80945; Wed, 1 Mar 2017 16:40:51 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 1 Mar 2017 16:40:49 +0100 Message-Id: <1488382850-19252-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1488382850-19252-1-git-send-email-kraxel@redhat.com> References: <1488382850-19252-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.32]); Wed, 01 Mar 2017 15:40:55 +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 v3 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Zubrytskyi) 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 {