[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] audio: make audio poll timer deterministic

From: Pavel Dovgalyuk
Subject: Re: [Qemu-devel] [PATCH] audio: make audio poll timer deterministic
Date: Tue, 31 Jan 2017 15:32:57 +0300

This patch is needed to make this timer deterministic and to use execution 

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 

Virtual clock does not proceed while VM is stopped. Therefore there is no need

in resetting the timeout when VM restarts.


Pavel Dovgalyuk


From: Marc-André Lureau [mailto:address@hidden 
Sent: Tuesday, January 31, 2017 3:16 PM
To: Pavel Dovgalyuk; address@hidden
Cc: address@hidden; address@hidden; address@hidden
Subject: Re: [Qemu-devel] [PATCH] audio: make audio poll timer deterministic




On Tue, Jan 31, 2017 at 4:03 PM Pavel Dovgalyuk <address@hidden> wrote:

This patch changes resetting strategy of the audio polling timer.
It does not change expiration time if the timer is already set.


You describe the change, but could you explain the reasons you propose it?

Signed-off-by: Pavel Dovgalyuk <address@hidden>
 audio/audio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/audio/audio.c b/audio/audio.c
index c845a44..1ee95a5 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1112,8 +1112,10 @@ static int audio_is_timer_needed (void)
 static void audio_reset_timer (AudioState *s)
     if (audio_is_timer_needed ()) {
-        timer_mod (s->ts,
-            qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + conf.period.ticks);
+        if (!timer_pending(s->ts)) {
+            timer_mod (s->ts,
+                qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + conf.period.ticks);
+        }
     else {
         timer_del (s->ts);


Marc-André Lureau

reply via email to

[Prev in Thread] Current Thread [Next in Thread]