From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Gerd Hoffmann 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> Subject: [Qemu-devel] [PULL 2/3] audio: make audio poll timer deterministic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pavel Dovgalyuk , Gerd Hoffmann 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 { -- 1.8.3.1