qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 2/3] audio: make audio poll timer deterministic
Date: Mon, 27 Feb 2017 16:11:30 +0100	[thread overview]
Message-ID: <1488208291-14775-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1488208291-14775-1-git-send-email-kraxel@redhat.com>

From: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>

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 <pavel.dovgaluk@ispras.ru>
Message-id: 20170214071510.6112.76764.stgit@PASHA-ISP
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 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

  parent reply	other threads:[~2017-02-27 15:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 15:11 [Qemu-devel] [PULL 0/3] audio patch queue Gerd Hoffmann
2017-02-27 15:11 ` [Qemu-devel] [PULL 1/3] replay: add record/replay for audio passthrough Gerd Hoffmann
2017-02-27 15:11 ` Gerd Hoffmann [this message]
2017-02-27 15:11 ` [Qemu-devel] [PULL 3/3] audio/sdlaudio: Allow audio playback with SDL2 Gerd Hoffmann
2017-02-27 17:08 ` [Qemu-devel] [PULL 0/3] audio patch queue Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2017-02-20 14:12 Gerd Hoffmann
2017-02-20 14:12 ` [Qemu-devel] [PULL 2/3] audio: make audio poll timer deterministic Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488208291-14775-3-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).